Tutorials › Multivariate Statistics (Graduate) › Stable Symmetric Eigenvalue Computation

Resampling and Numerical Methods · Tutorial 967 of 975

Stable Symmetric Eigenvalue Computation

Learn how symmetric eigensolvers work and how to assess their computed eigenpairs using residuals, orthogonality, and backward-error diagnostics.

Advanced 12 min read

What You'll Learn

  • Explain why symmetry should be preserved in an eigenvalue computation
  • Describe the reduction of a symmetric matrix to tridiagonal form and subsequent eigensolution
  • Compute eigenpair residuals and relative residuals
  • Check orthogonality and interpret backward error for a computed eigendecomposition
  • Relate residual size to eigenvalue accuracy and eigenvector accuracy
  • Recognize why small eigenvalue gaps make eigenvectors sensitive

Why Symmetry Matters in Eigenvalue Computation

Eigenvalues and eigenvectors of a symmetric matrix summarize important features of multivariate data, including directions of variation and the structure of estimated covariance matrices. In computation, however, an eigenvalue list is not enough to establish that the result is reliable. Rounding can affect both the matrix and the computed eigenvectors, and eigenvectors can be sensitive when eigenvalues are close. A useful assessment therefore combines the eigenpair residuals, the orthogonality of the computed vectors, and the size of the perturbation that would make the result exact.

For a real symmetric matrix \(A\in\mathbb{R}^{p\times p}\), the spectral theorem guarantees an orthogonal matrix \(Q\) and a diagonal matrix \(\Lambda\) such that \(A=Q\Lambda Q^T\). The columns of \(Q\) are unit eigenvectors, and the diagonal entries of \(\Lambda\) are real eigenvalues. A numerical eigensolver aims to produce approximations to this decomposition while respecting the symmetry that makes it well behaved.

Definition: For a candidate eigenpair \((\hat\lambda,\hat q)\), its residual is \(r=A\hat q-\hat\lambda\hat q\). For a computed set of eigenpairs, define \(R=A\hat Q-\hat Q\hat\Lambda\). A small residual means the reported pairs nearly satisfy the eigenvalue equations. It does not, by itself, establish that the vectors are mutually orthogonal or that individual eigenvectors are accurate.

How Symmetric Eigensolvers Use Structure

A standard dense symmetric eigensolver first reduces \(A\) to a symmetric tridiagonal matrix by orthogonal transformations. In exact arithmetic, this has the form \(T=U^TAU\), where \(U^TU=I\) and \(T\) is tridiagonal: its entries are zero more than one position from the diagonal. The eigenvalues of \(T\) are those of \(A\), and if \(Tz=\lambda z\), then \(Uz\) is an eigenvector of \(A\). Orthogonal transformations preserve vector lengths and do not amplify errors through repeated changes of scale in the way general, nonorthogonal transformations can.

The tridiagonal problem can then be solved with methods designed for its structure, such as implicit shifted QR iteration or divide-and-conquer methods. These methods differ in speed, memory use, and how they obtain eigenvectors. In practical use, a symmetric eigensolver should be selected for a symmetric input, rather than treating \(A\) as a general matrix. The precise numerical guarantees depend on the implementation and floating-point conditions, but well-designed symmetric algorithms aim for a backward-stable result: the computed decomposition should be exact for a matrix close to the input.

If the supplied matrix is only approximately symmetric because of data processing or rounding, inspect the discrepancy before proceeding. Replacing it by \((A+A^T)/2\) gives a symmetric matrix, but it is a change to the input, not a harmless correction in every application. Record the size of that change and make sure averaging is justified by the model.

Worked Example: Exact Eigenpairs and Residual Checks

Consider \(A=\begin{pmatrix}4&1\\1&2\end{pmatrix}\). Its characteristic polynomial is \[ \det(A-\lambda I)=(4-\lambda)(2-\lambda)-1 =\lambda^2-6\lambda+7. \] Thus the eigenvalues are \(3+\sqrt{2}\) and \(3-\sqrt{2}\), approximately \(4.4142\) and \(1.5858\).

For \(\lambda_1=3+\sqrt{2}\), the first row of \((A-\lambda_1 I)q_1=0\) gives \(q_{1,2}=(\sqrt{2}-1)q_{1,1}\). A unit eigenvector is therefore \[ q_1=\frac{(1,\sqrt{2}-1)^T}{\sqrt{1+(\sqrt{2}-1)^2}}. \] For \(\lambda_2=3-\sqrt{2}\), the corresponding ratio is \(q_{2,2}=-(1+\sqrt{2})q_{2,1}\). The two eigenvectors are orthogonal, as follows either by direct calculation or by the spectral theorem for distinct eigenvalues of a symmetric matrix.

A numerical routine will report rounded values and vectors, so verify the defining equation using the reported values. For any reported \((\hat\lambda,\hat q)\), calculate \(r=A\hat q-\hat\lambda\hat q\), and inspect \(\|r\|_2\). If the vector is unit length, this is the absolute residual; a scale-aware version is \[ \eta=\frac{\|A\hat q-\hat\lambda\hat q\|_2} {(\|A\|_2+|\hat\lambda|)\|\hat q\|_2}. \] The exact pairs above give zero residual. Rounded outputs generally give a small nonzero residual, which should be interpreted relative to the scale of \(A\), not in isolation.

What a Residual Can Guarantee

For a symmetric matrix, a small residual has a precise implication for eigenvalue proximity. It does not require that the candidate vector already be an exact eigenvector.

Theorem: Let \(A\) be real symmetric, let \(\hat q\) be a unit vector, and let \(\hat\lambda\in\mathbb{R}\). Then some eigenvalue \(\lambda_j\) of \(A\) satisfies \[ |\lambda_j-\hat\lambda|\leq \|A\hat q-\hat\lambda\hat q\|_2. \]

Proof. By the spectral theorem, write \(A=Q\Lambda Q^T\), with orthonormal eigenvectors \(q_j\) and eigenvalues \(\lambda_j\). Expand \(\hat q=\sum_{j=1}^p c_jq_j\), where \(\sum_j c_j^2=1\). Then \[ \|A\hat q-\hat\lambda\hat q\|_2^2 =\sum_{j=1}^p c_j^2(\lambda_j-\hat\lambda)^2. \] The right side is a weighted average of the squared distances from \(\hat\lambda\) to the eigenvalues. It cannot be smaller than the smallest such squared distance. Taking square roots proves the claim. \(\square\)

This result certifies closeness to some eigenvalue. It does not identify which eigenvalue, and it does not guarantee a small eigenvector error when eigenvalues are clustered. A gap condition is needed for that.

Theorem: Let \(A\) be real symmetric with an orthonormal eigenbasis \(q_1,\ldots,q_p\). Suppose \(\hat\lambda\) is closer to \(\lambda_k\) than to any other eigenvalue, and define \(\delta=\min_{j\ne k}|\lambda_j-\hat\lambda|>0\). For a unit candidate vector \(\hat q\), let \(\theta\) be its angle to the line spanned by \(q_k\), so that \(\sin\theta\) is the norm of its component orthogonal to \(q_k\). Then \[ \sin\theta\leq \frac{\|A\hat q-\hat\lambda\hat q\|_2}{\delta}. \]

Proof. Expand \(\hat q=\sum_j c_jq_j\). By definition, \(\sin^2\theta=\sum_{j\ne k}c_j^2\). The residual expansion gives \[ \|A\hat q-\hat\lambda\hat q\|_2^2 =\sum_j c_j^2(\lambda_j-\hat\lambda)^2 \geq \delta^2\sum_{j\ne k}c_j^2 =\delta^2\sin^2\theta. \] Taking square roots and dividing by \(\delta>0\) proves the bound. \(\square\)

Orthogonality and Backward Error

For a full symmetric eigendecomposition, check both the eigenpair equations and the orthogonality of the reported vectors. Given a computed matrix \(\hat Q\) and diagonal matrix \(\hat\Lambda\), useful diagnostics include the residual norm \(\|A\hat Q-\hat Q\hat\Lambda\|_2\) or Frobenius norm, and the orthogonality error \(\|\hat Q^T\hat Q-I\|_2\) or Frobenius norm. Relative versions should scale these quantities by the size of the input where appropriate.

Theorem: Suppose \(\hat Q\) is a square orthogonal matrix, \(\hat\Lambda\) is real diagonal, and \(A\) is real symmetric. With \(R=A\hat Q-\hat Q\hat\Lambda\), the symmetric matrix \(\Delta A=-R\hat Q^T\) satisfies \[ (A+\Delta A)\hat Q=\hat Q\hat\Lambda, \qquad \|\Delta A\|_2=\|R\|_2. \] Thus the computed decomposition is the exact eigendecomposition of a nearby symmetric matrix.

Proof. Since \(\hat Q\) is orthogonal, \(\hat Q^T\hat Q=I\), and \[ \hat Q^TR=\hat Q^TA\hat Q-\hat\Lambda. \] Both terms on the right are symmetric, so \(\hat Q^TR\) is symmetric. Also \(R\hat Q^T=\hat Q(\hat Q^TR)\hat Q^T\), which is symmetric; hence \(\Delta A\) is symmetric. From the definition of \(R\), \(A\hat Q=\hat Q\hat\Lambda+R\). Therefore \[ (A+\Delta A)\hat Q =A\hat Q-R\hat Q^T\hat Q =\hat Q\hat\Lambda+R-R =\hat Q\hat\Lambda. \] Finally, multiplication by an orthogonal matrix preserves the spectral norm, so \(\|\Delta A\|_2=\|R\hat Q^T\|_2=\|R\|_2\). \(\square\)

The theorem explains the backward-error interpretation of a small residual when the computed vectors are orthogonal. If \(\hat Q^T\hat Q\) is not close to \(I\), the theorem's premise fails: a small residual alone does not certify an accurate orthogonal eigendecomposition. In that case, report both diagnostics and investigate the computation, including whether the input was genuinely symmetric.

Worked Example: Checking a Complete Approximate Decomposition

Let \(A=\begin{pmatrix}2&1\\1&2\end{pmatrix}\), and suppose a calculation returns \[ \hat Q=\begin{pmatrix}0.8&-0.6\\0.6&0.8\end{pmatrix}, \qquad \hat\Lambda=\begin{pmatrix}2.96&0\\0&1.04\end{pmatrix}. \] The columns are unit length and have inner product \(0.8(-0.6)+0.6(0.8)=0\), so \(\hat Q^T\hat Q=I\).

For the first column, \(A(0.8,0.6)^T=(2.2,2.0)^T\). Subtracting \(2.96(0.8,0.6)^T=(2.368,1.776)^T\) gives residual \((-0.168,0.224)^T\), whose norm is \(0.28\). For the second column, \(A(-0.6,0.8)^T=(-0.4,1.0)^T\). Subtracting \(1.04(-0.6,0.8)^T=(-0.624,0.832)^T\) gives \((0.224,0.168)^T\), also of norm \(0.28\).

The spectral norm of the full residual matrix is \(0.28\): in the \(\hat Q\) coordinate system, \(\hat Q^TR=\begin{pmatrix}0&0.28\\0.28&0\end{pmatrix}\), whose eigenvalues are \(0.28\) and \(-0.28\). The theorem therefore gives a symmetric perturbation of spectral norm \(0.28\) for which the reported decomposition is exact. Since \(\|A\|_2=3\), its relative size is \(0.28/3\), about \(0.093\). This is not a particularly small backward error, despite perfect orthogonality: the vectors are rotated away from the true eigendirections.

Small Gaps and a Common Mistake

Worked Example: A Small Residual with a Poorly Identified Eigenvector

Take \(A=\begin{pmatrix}2&0\\0&2.0001\end{pmatrix}\) and the unit vector \(\hat q=(1,1)^T/\sqrt{2}\). Its Rayleigh quotient, \(\hat q^TA\hat q\), is \(2.00005\). With \(\hat\lambda=2.00005\), direct subtraction gives \(A\hat q-\hat\lambda\hat q=(-0.00005,0.00005)^T/\sqrt{2}\), whose norm is \(0.00005\).

The residual is small on an absolute scale, but \(\hat q\) is at a 45-degree angle to either true eigenvector. The separation between the eigenvalues is only \(0.0001\), so the residual is not small relative to the gap. The gap-based bound allows \(\sin\theta\) as large as \(0.00005/0.00005=1\), and therefore gives no useful guarantee of a well-determined individual eigenvector.

A common mistake is to judge an eigensolver by whether its reported eigenvalues match another calculation to many decimal places, or to conclude that a small absolute residual guarantees accurate eigenvectors. Eigenvalue differences can be misleading when methods use different rounding, and eigenvectors associated with a tight cluster can change substantially while the residual remains small. Prefer residuals and orthogonality checks, scaled to the problem, and interpret eigenvector accuracy in light of the relevant spectral gap. Within a clustered eigenspace, the subspace may be more stable and meaningful than any particular choice of basis vectors.

Key takeaway: A reliable symmetric eigenvalue computation should preserve symmetry, return nearly orthogonal eigenvectors, and have small scale-aware residuals. Residuals diagnose eigenpair equations and backward error; spectral gaps determine how strongly they can certify individual eigenvectors.

Check Your Understanding

Use the definitions and results above to answer these questions.

  1. What does a small residual guarantee about the distance from a candidate eigenvalue to the spectrum of a symmetric matrix?
  2. Why is orthogonality of the computed eigenvectors a separate diagnostic from the residual norm?
  3. For a unit candidate vector, what additional information is needed to use a residual bound to assess eigenvector accuracy?
  4. What does backward stability mean for a computed symmetric eigendecomposition?
  5. Why can eigenvectors be unreliable even when the computed eigenvalues and residuals appear accurate?
Clinical Biostats