Algorithm Search⌘K

Proofs: Jacobi eigenvalue algorithm

These are the human proofs of Jacobi eigenvalue algorithm, at full length.

Jacobi rotations reduce the off-diagonal norm and converge to the eigenvalues full

This proof shows: correctness, termination.

Notation of the page: A=AT∈Rn×nA = A^T \in \mathbb{R}^{n \times n}, off⁡(A)2=∑i≠jaij2\operatorname{off}(A)^2 = \sum_{i \ne j} a_{ij}^2, ∥⋅∥F\|\cdot\|_F the Frobenius norm, and J=J(p,q,θ)J = J(p, q, \theta) the rotation equal to the identity except Jpp=Jqq=cJ_{pp} = J_{qq} = c, Jpq=sJ_{pq} = s, Jqp=−sJ_{qp} = -s, with c=cos⁡θc = \cos\theta, s=sin⁡θs = \sin\theta. One rotation step is B=JTAJB = J^T A J. Exact arithmetic unless stated.

Lemma 1 (the rotation zeroes apqa_{pq}). Let apq≠0a_{pq} \ne 0, τ=(aqq−app)/(2apq)\tau = (a_{qq} - a_{pp}) / (2 a_{pq}), let tt be the root of smaller modulus of t2+2τt−1=0t^2 + 2\tau t - 1 = 0, that is t=sign⁡(τ)/(∣τ∣+1+τ2)t = \operatorname{sign}(\tau) / (|\tau| + \sqrt{1 + \tau^2}) with sign⁡(0)=1\operatorname{sign}(0) = 1, and c=1/1+t2c = 1/\sqrt{1 + t^2}, s=tcs = t c. Then bpq=bqp=0b_{pq} = b_{qp} = 0, bpp=app−tapqb_{pp} = a_{pp} - t a_{pq}, bqq=aqq+tapqb_{qq} = a_{qq} + t a_{pq}, and ∣θ∣≤π/4|\theta| \le \pi/4.

Proof. Only rows and columns pp and qq change. The 2×22 \times 2 block is

(bppbpqbqpbqq)=(c−ssc)(appapqapqaqq)(cs−sc),\begin{pmatrix} b_{pp} & b_{pq} \\ b_{qp} & b_{qq} \end{pmatrix} = \begin{pmatrix} c & -s \\ s & c \end{pmatrix} \begin{pmatrix} a_{pp} & a_{pq} \\ a_{pq} & a_{qq} \end{pmatrix} \begin{pmatrix} c & s \\ -s & c \end{pmatrix},

so bpq=apq(c2−s2)+cs(app−aqq)b_{pq} = a_{pq}(c^2 - s^2) + cs(a_{pp} - a_{qq}). With t=s/ct = s/c, bpq=0b_{pq} = 0 if and only if apq(1−t2)+t(app−aqq)=0a_{pq}(1 - t^2) + t(a_{pp} - a_{qq}) = 0, that is t2+2τt−1=0t^2 + 2\tau t - 1 = 0. The two roots have product −1-1, so the smaller one has ∣t∣≤1|t| \le 1 and ∣θ∣=∣arctan⁡t∣≤π/4|\theta| = |\arctan t| \le \pi/4. Next, bpp=c2app−2cs apq+s2aqqb_{pp} = c^2 a_{pp} - 2cs\,a_{pq} + s^2 a_{qq}; with s2(aqq−app)=2s2τapqs^2 (a_{qq} - a_{pp}) = 2 s^2 \tau a_{pq} and 2τt=1−t22\tau t = 1 - t^2, this is app+c2apq(t(1−t2)−2t)=app−tapqa_{pp} + c^2 a_{pq}(t(1 - t^2) - 2t) = a_{pp} - t a_{pq}, since c2(1+t2)=1c^2(1 + t^2) = 1. The formula for bqqb_{qq} follows from the invariance of the trace of the block. □\square

Lemma 2 (the off-diagonal norm drops by 2apq22 a_{pq}^2). off⁡(B)2=off⁡(A)2−2apq2\operatorname{off}(B)^2 = \operatorname{off}(A)^2 - 2 a_{pq}^2.

Proof. ∥B∥F=∥A∥F\|B\|_F = \|A\|_F since JJ is orthogonal. For r≠p,qr \ne p, q the pair (brp,brq)(b_{rp}, b_{rq}) is a rotation of (arp,arq)(a_{rp}, a_{rq}), so brp2+brq2=arp2+arq2b_{rp}^2 + b_{rq}^2 = a_{rp}^2 + a_{rq}^2, and entries outside rows and columns p,qp, q do not change. So the only change of the off-diagonal sum is in the (p,q)(p, q) block: the Frobenius norm of the 2×22 \times 2 block is kept, and its off-diagonal part goes from 2apq22 a_{pq}^2 to 00. So ∑ibii2=∑iaii2+2apq2\sum_i b_{ii}^2 = \sum_i a_{ii}^2 + 2 a_{pq}^2, and the claim follows from off⁡2=∥⋅∥F2−∑i(⋅)ii2\operatorname{off}^2 = \|\cdot\|_F^2 - \sum_i (\cdot)_{ii}^2. □\square

Theorem 1 (classical Jacobi converges linearly). If each step rotates on an entry of largest modulus, then off⁡(B)2≤(1−1/N)off⁡(A)2\operatorname{off}(B)^2 \le (1 - 1/N) \operatorname{off}(A)^2 with N=n(n−1)/2N = n(n-1)/2. So after kk steps off⁡(A(k))≤(1−1/N)k/2off⁡(A)\operatorname{off}(A^{(k)}) \le (1 - 1/N)^{k/2} \operatorname{off}(A).

Proof. off⁡(A)2=2∑p<qapq2≤2Nmax⁡p<qapq2\operatorname{off}(A)^2 = 2 \sum_{p < q} a_{pq}^2 \le 2N \max_{p<q} a_{pq}^2, so 2apq2≥off⁡(A)2/N2 a_{pq}^2 \ge \operatorname{off}(A)^2 / N for the largest entry; apply Lemma 2. □\square

Theorem 2 (the diagonal converges to the eigenvalues). Let A(k)=VkTAVkA^{(k)} = V_k^T A V_k with VkV_k orthogonal (the product of the rotations), and let off⁡(A(k))→0\operatorname{off}(A^{(k)}) \to 0. Then, with the eigenvalues λ1≥⋯≥λn\lambda_1 \ge \dots \ge \lambda_n of AA and the sorted diagonal d[1](k)≥⋯≥d[n](k)d^{(k)}_{[1]} \ge \dots \ge d^{(k)}_{[n]},

max⁡i∣d[i](k)−λi∣≤off⁡(A(k)),\max_i |d^{(k)}_{[i]} - \lambda_i| \le \operatorname{off}(A^{(k)}),

and the columns of VkV_k have residuals ∥Avi(k)−aii(k)vi(k)∥2≤off⁡(A(k))\|A v^{(k)}_i - a^{(k)}_{ii} v^{(k)}_i\|_2 \le \operatorname{off}(A^{(k)}).

Proof. A(k)=Dk+EkA^{(k)} = D_k + E_k with DkD_k its diagonal and EkE_k symmetric with ∥Ek∥2≤∥Ek∥F=off⁡(A(k))\|E_k\|_2 \le \|E_k\|_F = \operatorname{off}(A^{(k)}). By Weyl's inequality, the sorted eigenvalues of A(k)A^{(k)}, which are those of AA, differ from the sorted eigenvalues of DkD_k, its diagonal entries, by at most ∥Ek∥2\|E_k\|_2. For the residual, AVk=VkA(k)A V_k = V_k A^{(k)}, so Avi(k)−aii(k)vi(k)=VkEkeiA v_i^{(k)} - a^{(k)}_{ii} v_i^{(k)} = V_k E_k e_i, whose norm is the norm of column ii of EkE_k. □\square

Theorem 3 (cyclic Jacobi converges, and fast). For the cyclic-by-row order with ∣θ∣≤π/4|\theta| \le \pi/4 (Lemma 1), off⁡(A(k))→0\operatorname{off}(A^{(k)}) \to 0 (Forsythe and Henrici 1960). If the eigenvalues are distinct with minimum gap δ\delta, the convergence is ultimately quadratic per sweep: once off⁡\operatorname{off} is small compared with δ\delta, one sweep maps off⁡\operatorname{off} to at most a constant times off⁡2/δ\operatorname{off}^2 / \delta (Henrici 1958; Wilkinson 1962), and Schönhage (1964) extended quadratic convergence to multiple eigenvalues. These are cited results; the proofs are long and not repeated here. The test file measures the ratio off⁡k+1/off⁡k2\operatorname{off}_{k+1} / \operatorname{off}_k^2 and finds it bounded.

Termination of the implementation. The sweep loop of line L2 runs at most max_sweeps times. With the threshold test of line L4, a sweep that performs no rotation ends the loop (line L7). Under Theorem 3 every off-diagonal entry tends to zero, while for a matrix with off⁡(A(k))\operatorname{off}(A^{(k)}) small the diagonal entries approach the eigenvalues. If no eigenvalue is zero, ∣appaqq∣\sqrt{|a_{pp} a_{qq}|} stays bounded away from zero, so every entry eventually falls below its threshold and the sweep loop stops. If some eigenvalues are zero, the entries still go to zero; in floating point they reach exact zero or underflow, and the bound max_sweeps guarantees a stop in every case.

Correctness at the stop. When the loop stops at line L7, every off-diagonal entry satisfies ∣apq∣≤tol∣appaqq∣|a_{pq}| \le \mathrm{tol} \sqrt{|a_{pp} a_{qq}|}, so off⁡(A(k))≤tol ∑p≠q∣appaqq∣≤tol nmax⁡i∣aii∣≤tol n∥A∥2\operatorname{off}(A^{(k)}) \le \mathrm{tol} \, \sqrt{\sum_{p \ne q} |a_{pp} a_{qq}|} \le \mathrm{tol} \, n \max_i |a_{ii}| \le \mathrm{tol} \, n \|A\|_2, and Theorem 2 gives the error of the returned eigenvalues and the residuals of the returned vectors.

Floating point. Each rotation is computed in floating point as B^=JT(A+E)J\hat B = J^T (A + E) J with ∥E∥F≤c nu∥A∥F\|E\|_F \le c\, n u \|A\|_F and JJ exactly orthogonal, up to a small error in V^\hat V (Wilkinson 1965, Chapter 3 and Chapter 5). A full run of ss sweeps is therefore normwise backward stable with an error of order sn3u∥A∥Fs n^3 u \|A\|_F in this crude bound, and the observed error is of order u∥A∥u \|A\|. For a positive definite A=DHDA = D H D with DD diagonal and HH with unit diagonal, Demmel and Veselić (1992) proved that the computed eigenvalues have relative errors of order umax⁡kκ(Hk)u \max_k \kappa(H_k), where HkH_k is the scaled form of the iterate A(k)A^{(k)}; they observed that max⁡kκ(Hk)\max_k \kappa(H_k) is not much larger than κ(H)\kappa(H). This is a stronger result than any normwise bound when DD is strongly graded.

Back to Jacobi eigenvalue algorithm