TExcelTAD
Home › Numerical Methods › Eigenvalue Problems and Their Conditioning

Eigenvalues: Conditioning and Pitfalls

Eigenvalues decide the stability of ODEs, the vibration frequencies of structures, the long-run behaviour of Markov chains and the principal components of data. Before computing them we should ask how sensitive they are. The answer depends strongly on the matrix: for symmetric matrices eigenvalues are always well conditioned, while for non-normal matrices they can be wildly sensitive.

Why not use the characteristic polynomial

Mathematically the eigenvalues are the roots of det⁡(A−λI)\det(A - \lambda I). Numerically this is a bad route: computing polynomial coefficients loses information, and polynomial roots can be extremely ill-conditioned (Conditioning of Problems). Libraries never do it. Instead they use similarity transformations (The QR Algorithm).

python · try it yourself
import numpy as np

lam = np.arange(1.0, 21.0)
A = np.diag(lam)                                 # eigenvalues exactly 1..20
via_poly = np.sort(np.roots(np.poly(A)).real)
via_eig = np.sort(np.linalg.eigvals(A).real)
print(f"max error via characteristic polynomial: {np.max(np.abs(via_poly - lam)):.1e}")
print(f"max error via eigvals                  : {np.max(np.abs(via_eig - lam)):.1e}")
max error via characteristic polynomial: 6.5e-02
max error via eigvals                  : 0.0e+00

Bauer-Fike: diagonalizable matrices

If A=VΛV−1A = V\Lambda V^{-1} and EE is a perturbation, every eigenvalue μ\mu of A+EA + E satisfies

min⁡j∣μ−λj∣≤κ(V) ∥E∥2.\min_j\lvert\mu - \lambda_j\rvert \le \kappa(V)\,\lVert E\rVert_2.

The condition number of the eigenvector matrix controls sensitivity. For symmetric (more generally, normal) matrices VV is orthogonal, κ(V)=1\kappa(V) = 1, and eigenvalues move no more than the perturbation itself. For a nearly defective matrix κ(V)\kappa(V) is huge.

python · try it yourself
import numpy as np

rng = np.random.default_rng(41)
E = rng.normal(size=(6, 6)); E *= 1e-10 / np.linalg.norm(E, 2)

S = rng.normal(size=(6, 6)); S = S + S.T                 # symmetric
J = np.diag(np.ones(6)) + np.diag(np.ones(5), 1)          # Jordan block, eigenvalue 1

for name, M in (("symmetric", S), ("Jordan block", J)):
    ev = np.sort_complex(np.linalg.eigvals(M))
    ev2 = np.sort_complex(np.linalg.eigvals(M + E))
    print(f"{name:13s}: eigenvalues move by up to {np.max(np.abs(ev2 - ev)):.1e} for a perturbation of 1e-10")
symmetric    : eigenvalues move by up to 1.6e-11 for a perturbation of 1e-10
Jordan block : eigenvalues move by up to 1.0e-02 for a perturbation of 1e-10

For the 6×66 \times 6 Jordan block a perturbation of size ϵ\epsilon moves the eigenvalue by about ϵ1/6\epsilon^{1/6}: here 10−1010^{-10} becomes about 10−210^{-2}.

Non-normal matrices in practice

Matrices from fluid flow, Markov chains and some ODE discretizations are far from normal. Their eigenvalues may not tell the whole story: ∥etA∥\lVert e^{tA}\rVert can grow by large factors before decaying even when all eigenvalues have negative real part. Pseudospectra (the sets where ∥(zI−A)−1∥\lVert(zI - A)^{-1}\rVert is large) describe such behaviour better.

Eigenvectors

Eigenvectors are sensitive when eigenvalues are close together: the condition number of an eigenvector grows like 1gap\frac{1}{\text{gap}} to the nearest other eigenvalue. When two eigenvalues coincide, only the invariant subspace is well defined, not individual vectors.

In software

  • np.linalg.eigh / scipy.linalg.eigh for symmetric/Hermitian matrices: faster, real eigenvalues sorted, orthonormal eigenvectors. Use it whenever the matrix is symmetric.
  • np.linalg.eig for general matrices; scipy.linalg.eig(..., left=True) also returns left eigenvectors, from which individual eigenvalue condition numbers 1∣yHx∣\frac{1}{\lvert\mathbf{y}^H\mathbf{x}\rvert} can be computed.
  • Stability analysis of ODE solvers uses eigenvalues of the Jacobian (Stiff Equations).

Exercises

Exercise 1: Symmetric perturbation

A symmetric matrix is perturbed by a symmetric EE with ∥E∥2=10−8\lVert E\rVert_2 = 10^{-8}. How far can its eigenvalues move?

Answer

At most 10−810^{-8}.

Solution

For symmetric matrices κ(V)=1\kappa(V) = 1 (Weyl's theorem gives the same bound with each eigenvalue paired in order).

Exercise 2: Jordan block sensitivity

The 2×22 \times 2 matrix (11ϵ1)\begin{pmatrix} 1 & 1 \\ \epsilon & 1\end{pmatrix} has eigenvalues 1±ϵ1 \pm \sqrt{\epsilon}. For ϵ=10−16\epsilon = 10^{-16} how far do they move from 1?

Answer

10−810^{-8}.

Solution

(1−λ)2=ϵ(1 - \lambda)^2 = \epsilon, so λ=1±ϵ=1±10−8\lambda = 1 \pm \sqrt{\epsilon} = 1 \pm 10^{-8}: a change 10810^8 times larger than the perturbation.

Exercise 3: Condition of each eigenvalue (code)

For A=(1100002)A = \begin{pmatrix} 1 & 1000 \\ 0 & 2\end{pmatrix} compute the eigenvalue condition numbers ∥x∥ ∥y∥∣yTx∣\frac{\lVert\mathbf{x}\rVert\,\lVert\mathbf{y}\rVert}{\lvert\mathbf{y}^T\mathbf{x}\rvert} from right and left eigenvectors.

Answer

Both are about 10001000.

Solution
python · try it yourself
import numpy as np
from scipy.linalg import eig
A = np.array([[1.0, 1000.0], [0.0, 2.0]])
w, vl, vr = eig(A, left=True, right=True)
for k in range(2):
    x, y = vr[:, k], vl[:, k]
    print(round(w[k].real, 6), round(float(np.linalg.norm(x) * np.linalg.norm(y) / abs(y.conj() @ x)), 3))
1.0 1000.0
2.0 1000.0

Test yourself

Why do libraries not compute eigenvalues as roots of the characteristic polynomial?

  1. It is too slow only
  2. Polynomial roots can be extremely sensitive to rounding of the coefficients
  3. It only works for 2x2 matrices
  4. It gives complex numbers

The eigenvalues of a symmetric matrix are…

  1. always ill-conditioned
  2. perfectly conditioned: they move at most by ∥E∥2\lVert E\rVert_2
  3. complex
  4. conditioned like κ(A)\kappa(A)

Bauer-Fike bounds eigenvalue movement by…

  1. κ(A)∥E∥\kappa(A)\lVert E\rVert
  2. κ(V)∥E∥\kappa(V)\lVert E\rVert with VV the eigenvector matrix
  3. ∥E∥2\lVert E\rVert^2
  4. det⁡E\det E