Algorithm Search⌘K

Proofs: Lanczos algorithm

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

The Lanczos recurrence gives an orthonormal Krylov basis and a tridiagonal projection full

This proof shows: correctness, termination.

Notation of the page: A=A∗∈Cn×nA = A^* \in \mathbb{C}^{n \times n} with eigenvalues λ1≥⋯≥λn\lambda_1 \ge \dots \ge \lambda_n and orthonormal eigenvectors viv_i; b≠0b \ne 0; Kk(A,b)=span⁡{b,Ab,…,Ak−1b}K_k(A, b) = \operatorname{span}\{b, Ab, \dots, A^{k-1} b\}; Qk=[q1,…,qk]Q_k = [q_1, \dots, q_k]; TkT_k the k×kk \times k real symmetric tridiagonal matrix with diagonal α1,…,αk\alpha_1, \dots, \alpha_k and off-diagonal β1,…,βk−1\beta_1, \dots, \beta_{k-1}. Exact arithmetic unless stated; the reorthogonalization of line L5 then changes nothing, since it subtracts zero.

Theorem 1 (orthonormal basis and the Lanczos relation). Suppose the loop runs steps 1,…,k1, \dots, k with β1,…,βk−1>0\beta_1, \dots, \beta_{k-1} > 0. Then q1,…,qkq_1, \dots, q_k are orthonormal, span⁡{q1,…,qj}=Kj(A,b)\operatorname{span}\{q_1, \dots, q_j\} = K_j(A, b) for j≤kj \le k, and

AQk=QkTk+βkqk+1ekT,Qk∗qk+1=0,Qk∗AQk=Tk,A Q_k = Q_k T_k + \beta_k q_{k+1} e_k^T, \qquad Q_k^* q_{k+1} = 0, \qquad Q_k^* A Q_k = T_k,

where βkqk+1\beta_k q_{k+1} means the vector ww of step kk (which may be zero).

Proof. By induction on jj. For j=1j = 1, q1=b/∥b∥2q_1 = b / \|b\|_2. Assume q1,…,qjq_1, \dots, q_j are orthonormal, span KjK_j, and satisfy Aqi=βi−1qi−1+αiqi+βiqi+1A q_i = \beta_{i-1} q_{i-1} + \alpha_i q_i + \beta_i q_{i+1} for i<ji < j (with β0q0=0\beta_0 q_0 = 0). Step jj forms w=Aqj−βj−1qj−1−αjqjw = A q_j - \beta_{j-1} q_{j-1} - \alpha_j q_j with αj=qj∗Aqj\alpha_j = q_j^* A q_j, real because AA is Hermitian.

  • qj∗w=qj∗Aqj−αj=0q_j^* w = q_j^* A q_j - \alpha_j = 0, using qj∗qj−1=0q_j^* q_{j-1} = 0.
  • qj−1∗w=qj−1∗Aqj−βj−1q_{j-1}^* w = q_{j-1}^* A q_j - \beta_{j-1}. By symmetry, qj−1∗Aqj=(Aqj−1)∗qj=(βj−2qj−2+αj−1qj−1+βj−1qj)∗qj=βj−1q_{j-1}^* A q_j = (A q_{j-1})^* q_j = (\beta_{j-2} q_{j-2} + \alpha_{j-1} q_{j-1} + \beta_{j-1} q_j)^* q_j = \beta_{j-1}, as the β\beta are real. So qj−1∗w=0q_{j-1}^* w = 0.
  • For i≤j−2i \le j - 2, qi∗w=(Aqi)∗qj=(βi−1qi−1+αiqi+βiqi+1)∗qj=0q_i^* w = (A q_i)^* q_j = (\beta_{i-1} q_{i-1} + \alpha_i q_i + \beta_i q_{i+1})^* q_j = 0, because the indices are at most j−1j - 1.

This is the point where symmetry is used: ww is orthogonal to all earlier vectors although only two are subtracted. If βj=∥w∥2>0\beta_j = \|w\|_2 > 0, then qj+1=w/βjq_{j+1} = w / \beta_j is a unit vector orthogonal to q1,…,qjq_1, \dots, q_j, and Aqj=βj−1qj−1+αjqj+βjqj+1A q_j = \beta_{j-1} q_{j-1} + \alpha_j q_j + \beta_j q_{j+1}. As Aqj∈AKj⊆Kj+1A q_j \in A K_j \subseteq K_{j+1}, also qj+1∈Kj+1q_{j+1} \in K_{j+1}; the j+1j + 1 orthonormal vectors in Kj+1K_{j+1}, which has dimension at most j+1j + 1, span it. Writing the relations for i=1,…,ki = 1, \dots, k as columns gives AQk=QkTk+wekTA Q_k = Q_k T_k + w e_k^T, and multiplying by Qk∗Q_k^* gives Qk∗AQk=TkQ_k^* A Q_k = T_k. □\square

Theorem 2 (termination and breakdown). Let mm be the number of distinct eigenvalues λ\lambda for which bb has a nonzero component in the eigenspace of λ\lambda. Then β1,…,βm−1>0\beta_1, \dots, \beta_{m-1} > 0 and βm=0\beta_m = 0. At that step Km(A,b)K_m(A, b) is invariant under AA, and the eigenvalues of TmT_m are exactly those mm eigenvalues of AA. So the loop stops after at most min⁡(k,m)≤n\min(k, m) \le n steps.

Proof. Write b=∑ℓ=1mcℓzℓb = \sum_{\ell=1}^{m} c_\ell z_\ell with zℓz_\ell unit vectors in the eigenspaces of distinct eigenvalues μ1,…,μm\mu_1, \dots, \mu_m, and cℓ≠0c_\ell \ne 0. Then Kj={p(A)b:deg⁡p<j}K_j = \{p(A) b : \deg p < j\}, and p(A)b=∑ℓcℓp(μℓ)zℓp(A) b = \sum_\ell c_\ell p(\mu_\ell) z_\ell is zero only if pp vanishes at all μℓ\mu_\ell. So dim⁡Kj=j\dim K_j = j for j≤mj \le m and Km+1=KmK_{m+1} = K_m. By Theorem 1, as long as βj>0\beta_{j} > 0, the basis has j+1j + 1 elements in Kj+1K_{j+1}; this is impossible for j=mj = m. So βj>0\beta_j > 0 for j<mj < m (otherwise AKj⊆KjA K_j \subseteq K_j, giving Kj+1=KjK_{j+1} = K_j of dimension j<j+1j < j + 1) and βm=0\beta_m = 0. With βm=0\beta_m = 0, AQm=QmTmA Q_m = Q_m T_m, so KmK_m is invariant and every eigenpair (θ,s)(\theta, s) of TmT_m gives an eigenpair (θ,Qms)(\theta, Q_m s) of AA. The eigenvalues of TmT_m are distinct (an unreduced symmetric tridiagonal matrix has simple eigenvalues), and the restriction of AA to Km=span⁡{zℓ}K_m = \operatorname{span}\{z_\ell\} has the eigenvalues μ1,…,μm\mu_1, \dots, \mu_m. □\square

Theorem 3 (Ritz pairs and their residuals). Let Tksi=θisiT_k s_i = \theta_i s_i with ∥si∥2=1\|s_i\|_2 = 1, and let yi=Qksiy_i = Q_k s_i. Then ∥yi∥2=1\|y_i\|_2 = 1 and

∥Ayi−θiyi∥2=βk∣ekTsi∣.\|A y_i - \theta_i y_i\|_2 = \beta_k |e_k^T s_i|.

So, by the residual bound for Hermitian matrices, each interval [θi−βk∣ekTsi∣,θi+βk∣ekTsi∣][\theta_i - \beta_k |e_k^T s_i|, \theta_i + \beta_k |e_k^T s_i|] contains an eigenvalue of AA.

Proof. Ayi=AQksi=QkTksi+βkqk+1ekTsi=θiyi+βk(ekTsi)qk+1A y_i = A Q_k s_i = Q_k T_k s_i + \beta_k q_{k+1} e_k^T s_i = \theta_i y_i + \beta_k (e_k^T s_i) q_{k+1}, and ∥qk+1∥2=1\|q_{k+1}\|_2 = 1. For the interval: if ∥Ay−θy∥2=ρ\|A y - \theta y\|_2 = \rho with ∥y∥2=1\|y\|_2 = 1, then expanding yy in the eigenvectors gives ρ2=∑i∣vi∗y∣2(λi−θ)2≥min⁡i(λi−θ)2\rho^2 = \sum_i |v_i^* y|^2 (\lambda_i - \theta)^2 \ge \min_i (\lambda_i - \theta)^2. □\square

Theorem 4 (monotone extremal Ritz values and the Kaniel-Paige-Saad bound). The largest Ritz value θ1(k)=max⁡0≠x∈Kkx∗Ax/x∗x\theta_1^{(k)} = \max_{0 \ne x \in K_k} x^* A x / x^* x is nondecreasing in kk and satisfies

λ1≥θ1(k)≥λ1−(λ1−λn)(tan⁡ϕ1Ck−1(1+2γ1))2,γ1=λ1−λ2λ2−λn,\lambda_1 \ge \theta_1^{(k)} \ge \lambda_1 - (\lambda_1 - \lambda_n) \left( \frac{\tan \phi_1}{C_{k-1}(1 + 2\gamma_1)} \right)^2, \qquad \gamma_1 = \frac{\lambda_1 - \lambda_2}{\lambda_2 - \lambda_n},

where cos⁡ϕ1=∣v1∗b∣/∥b∥2>0\cos \phi_1 = |v_1^* b| / \|b\|_2 > 0, Ck−1C_{k-1} is the Chebyshev polynomial of degree k−1k - 1, and λ2>λn\lambda_2 > \lambda_n.

Proof. By Theorem 1, x=Qksx = Q_k s ranges over KkK_k, and x∗Ax/x∗x=s∗Tks/s∗sx^* A x / x^* x = s^* T_k s / s^* s, whose maximum is the largest eigenvalue of TkT_k (Courant-Fischer). Since Kk⊆Kk+1K_k \subseteq K_{k+1}, the maximum does not decrease, and it is at most λ1\lambda_1. For the lower bound take x=p(A)bx = p(A) b with p(t)=Ck−1(1+2(t−λ2)/(λ2−λn))p(t) = C_{k-1}(1 + 2(t - \lambda_2)/(\lambda_2 - \lambda_n)), of degree k−1k - 1. Write b=∑icivib = \sum_i c_i v_i. Then

λ1−x∗Axx∗x=∑i≥2∣ci∣2p(λi)2(λ1−λi)∑i∣ci∣2p(λi)2≤(λ1−λn)∑i≥2∣ci∣2∣c1∣2p(λ1)2.\lambda_1 - \frac{x^* A x}{x^* x} = \frac{\sum_{i \ge 2} |c_i|^2 p(\lambda_i)^2 (\lambda_1 - \lambda_i)}{\sum_i |c_i|^2 p(\lambda_i)^2} \le (\lambda_1 - \lambda_n) \frac{\sum_{i \ge 2} |c_i|^2}{|c_1|^2 p(\lambda_1)^2}.

For i≥2i \ge 2 the argument of Ck−1C_{k-1} lies in [−1,1][-1, 1], so ∣p(λi)∣≤1|p(\lambda_i)| \le 1, while p(λ1)=Ck−1(1+2γ1)p(\lambda_1) = C_{k-1}(1 + 2\gamma_1). Also ∑i≥2∣ci∣2/∣c1∣2=tan⁡2ϕ1\sum_{i \ge 2} |c_i|^2 / |c_1|^2 = \tan^2 \phi_1. □\square

As Ck−1(1+2γ)≥12(1+2γ)k−1C_{k-1}(1 + 2\gamma) \ge \frac{1}{2}(1 + 2\sqrt{\gamma})^{k-1} for γ≥0\gamma \ge 0, the error decreases at least like (1+2γ1)−2(k−1)(1 + 2\sqrt{\gamma_1})^{-2(k-1)}, much faster than the (λ2/λ1)2k(\lambda_2/\lambda_1)^{2k} of power iteration for the same number of products. This is the bound of Kaniel (1966), corrected by Paige (1971) and Saad (1980); Golub and Van Loan give it in Section 10.1.

Termination of the implementation. The loop of line L2 runs at most kk times. It also stops when βj\beta_j falls below 10numax⁡(∣αj∣,βj−1,1)10 n u \max(|\alpha_j|, \beta_{j-1}, 1), the floating-point form of the breakdown of Theorem 2.

Floating point. Without line L5, rounding errors destroy the orthogonality of the qjq_j, and Theorem 1 then fails. Paige (1971, 1976, 1980) proved that the computed quantities still satisfy AQk=QkTk+βkqk+1ekT+FkA Q_k = Q_k T_k + \beta_k q_{k+1} e_k^T + F_k with ∥Fk∥\|F_k\| of order u∥A∥u \|A\|. He also proved that the loss of orthogonality is tied to convergence: for a Ritz vector yiy_i, ∣yi∗qk+1∣|y_i^* q_{k+1}| is about u∥A∥/(βk∣ekTsi∣)u \|A\| / (\beta_k |e_k^T s_i|), so orthogonality is lost exactly in the direction of the Ritz vectors that have converged. Every Ritz value is still within a small multiple of the residual estimate of an eigenvalue, but converged eigenvalues reappear as extra copies ("ghosts"). With full reorthogonalization by classical Gram-Schmidt applied twice, the computed QkQ_k satisfies ∥Qk∗Qk−I∥=O(u)\|Q_k^* Q_k - I\| = O(u) for each step, and Theorems 1 to 3 hold up to errors of order u∥A∥u \|A\|.

Back to Lanczos algorithm