TExcelTAD
Home › Linear Algebra & Matrix Theory › Finding Eigenvalues

Finding Eigenvalues

An eigenvalue λ\lambda is a number for which A−λIA - \lambda I squashes some nonzero vector to zero. That happens exactly when A−λIA - \lambda I is not invertible, so its determinant is zero. This turns the hunt for eigenvalues into finding the roots of a polynomial, the characteristic polynomial.

The characteristic equation

Av=λvA\mathbf{v} = \lambda\mathbf{v} with v≠0\mathbf{v} \ne \mathbf{0} is the same as (A−λI)v=0(A - \lambda I)\mathbf{v} = \mathbf{0} with v≠0\mathbf{v} \ne \mathbf{0}. A square matrix has a nonzero null vector exactly when it is singular, and by Properties of Determinants that means its determinant is 0:

λ is an eigenvalue of A  ⟺  det⁡(A−λI)=0\lambda \text{ is an eigenvalue of } A \iff \det(A - \lambda I) = 0

For an n×nn \times n matrix, p(λ)=det⁡(A−λI)p(\lambda) = \det(A - \lambda I) is a polynomial of degree nn in λ\lambda, the characteristic polynomial. Its roots are the eigenvalues, so an n×nn \times n matrix has at most nn distinct eigenvalues. (Some books use det⁡(λI−A)\det(\lambda I - A), which differs only by the sign (−1)n(-1)^n and has the same roots.)

The full recipe:

  1. Compute p(λ)=det⁡(A−λI)p(\lambda) = \det(A - \lambda I) and find its roots λ1,λ2,…\lambda_1, \lambda_2, \ldots
  2. For each root, row reduce A−λIA - \lambda I and read off the null space. Those vectors (minus 0\mathbf{0}) are the eigenvectors.

The 2×22 \times 2 shortcut

For A=[abcd]A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}:

det⁡(A−λI)=(a−λ)(d−λ)−bc=λ2−(a+d)λ+(ad−bc)=λ2−tr⁡(A)⋅λ+det⁡(A)\begin{aligned} \det(A - \lambda I) &= (a - \lambda)(d - \lambda) - bc = \lambda^2 - (a + d)\lambda + (ad - bc) \\ &= \lambda^2 - \operatorname{tr}(A) \cdot \lambda + \det(A) \end{aligned}

Example: A=[4−211]A = \begin{bmatrix} 4 & -2 \\ 1 & 1 \end{bmatrix} has trace 5 and determinant 4+2=64 + 2 = 6, so p(λ)=λ2−5λ+6=(λ−2)(λ−3)p(\lambda) = \lambda^2 - 5\lambda + 6 = (\lambda - 2)(\lambda - 3). The eigenvalues are 2 and 3.

λ=2: A−2I=[2−21−1]→x−y=0→v=(1,1)λ=3: A−3I=[1−21−2]→x−2y=0→v=(2,1)\begin{aligned} \lambda = 2&: \ A - 2I = \begin{bmatrix} 2 & -2 \\ 1 & -1 \end{bmatrix} \to x - y = 0 \to \mathbf{v} = (1, 1) \\ \lambda = 3&: \ A - 3I = \begin{bmatrix} 1 & -2 \\ 1 & -2 \end{bmatrix} \to x - 2y = 0 \to \mathbf{v} = (2, 1) \end{aligned}

A 3×33 \times 3 example in SymPy

Let A=[411141114]A = \begin{bmatrix} 4 & 1 & 1 \\ 1 & 4 & 1 \\ 1 & 1 & 4 \end{bmatrix}. SymPy computes the characteristic polynomial, its roots with multiplicities, and the eigenvectors, all exactly:

python · try it yourself
from sympy import Matrix, symbols, factor, eye

lam = symbols("lambda")
A = Matrix([[4, 1, 1], [1, 4, 1], [1, 1, 4]])

p = (A - lam * eye(3)).det()
print("det(A - lambda I) =", factor(p))
print("eigenvalues {value: multiplicity}:", A.eigenvals())
for value, mult, vecs in A.eigenvects():
    print(f"lambda = {value}: basis of eigenspace", [list(v) for v in vecs])
det(A - lambda I) = -(lambda - 6)*(lambda - 3)**2
eigenvalues {value: multiplicity}: {6: 1, 3: 2}
lambda = 3: basis of eigenspace [[-1, 1, 0], [-1, 0, 1]]
lambda = 6: basis of eigenspace [[1, 1, 1]]

The polynomial is −(λ−6)(λ−3)2-(\lambda - 6)(\lambda - 3)^2, so λ=6\lambda = 6 appears once and λ=3\lambda = 3 twice. The number of times a root repeats is its algebraic multiplicity. The dimension of the eigenspace is its geometric multiplicity. Here λ=3\lambda = 3 has a two-dimensional eigenspace: (−1,1,0)(-1, 1, 0) and (−1,0,1)(-1, 0, 1) are independent, and every vector whose entries add up to 0 is an eigenvector. The geometric multiplicity is always between 1 and the algebraic multiplicity, and when it is smaller the matrix cannot be diagonalized (Diagonalization).

Shortcuts worth knowing

Matrix Eigenvalues
triangular (upper or lower), or diagonal the diagonal entries
2×22 \times 2 roots of λ2−tr⁡⋅λ+det⁡\lambda^2 - \operatorname{tr} \cdot \lambda + \det
singular (det⁡=0\det = 0) 0 is one of them
any n×nn \times n they add up to tr⁡(A)\operatorname{tr}(A) and multiply to det⁡(A)\det(A) (counted with multiplicity)

The triangular rule works because A−λIA - \lambda I is again triangular, and the determinant of a triangular matrix is the product of its diagonal (The Determinant of a Triangular Matrix): p(λ)=(a11−λ)(a22−λ)⋯(ann−λ)p(\lambda) = (a_{11} - \lambda)(a_{22} - \lambda) \cdots (a_{nn} - \lambda).

How computers really do it

For large nn nobody computes the characteristic polynomial. Its coefficients are very sensitive to rounding, and there is no formula for the roots of a polynomial of degree 5 or more. Numerical libraries (LAPACK, behind numpy.linalg.eig) use iterative methods, mainly the QR algorithm, which converges to a triangular matrix with the eigenvalues on the diagonal.

python · try it yourself
import numpy as np

A = np.array([[4.0, -2.0], [1.0, 1.0]])
values, vectors = np.linalg.eig(A)
for i in range(2):
    v = vectors[:, i]
    print(f"lambda = {float(values[i]):.4f}, unit eigenvector = ({v[0]:.4f}, {v[1]:.4f})")
    print("   A v - lambda v =", np.round(A @ v - values[i] * v, 12) + 0.0)
lambda = 3.0000, unit eigenvector = (0.8944, 0.4472)
   A v - lambda v = [0. 0.]
lambda = 2.0000, unit eigenvector = (0.7071, 0.7071)
   A v - lambda v = [0. 0.]

NumPy normalises each eigenvector to length 1, so (1,1)(1, 1) appears as (0.7071,0.7071)(0.7071, 0.7071) and (2,1)(2, 1) as (0.8944,0.4472)(0.8944, 0.4472). The sign and order are up to the library. For symmetric matrices use np.linalg.eigh, which is faster, returns sorted real eigenvalues and orthonormal eigenvectors.

Tip: Eigenvectors are only defined up to a nonzero factor. When comparing your hand answer with a library, check the direction (is one a multiple of the other?), not the exact numbers.

Exercises

Exercise 1: A 2×22 \times 2 by hand

Find the eigenvalues and eigenvectors of A=[5222]A = \begin{bmatrix} 5 & 2 \\ 2 & 2 \end{bmatrix}.

Answer

λ=6\lambda = 6 with v=(2,1)\mathbf{v} = (2, 1), and λ=1\lambda = 1 with v=(1,−2)\mathbf{v} = (1, -2).

Solution
tr⁡=7, det⁡=10−4=6 → λ2−7λ+6=(λ−6)(λ−1)λ=6: A−6I=[−122−4]→−x+2y=0→(2,1)λ=1: A−I=[4221]→2x+y=0→(1,−2)\begin{aligned} &\operatorname{tr} = 7,\ \det = 10 - 4 = 6 \ \to\ \lambda^2 - 7\lambda + 6 = (\lambda - 6)(\lambda - 1) \\ &\lambda = 6: \ A - 6I = \begin{bmatrix} -1 & 2 \\ 2 & -4 \end{bmatrix} \to -x + 2y = 0 \to (2, 1) \\ &\lambda = 1: \ A - I = \begin{bmatrix} 4 & 2 \\ 2 & 1 \end{bmatrix} \to 2x + y = 0 \to (1, -2) \end{aligned}

Exercise 2: Read them off

What are the eigenvalues of [73−10−25007]\begin{bmatrix} 7 & 3 & -1 \\ 0 & -2 & 5 \\ 0 & 0 & 7 \end{bmatrix}? What are their algebraic multiplicities?

Answer

7 (algebraic multiplicity 2) and −2 (multiplicity 1).

Solution

The matrix is upper triangular, so p(λ)=(7−λ)(−2−λ)(7−λ)=−(λ−7)2(λ+2)p(\lambda) = (7 - \lambda)(-2 - \lambda)(7 - \lambda) = -(\lambda - 7)^2(\lambda + 2). Check: the eigenvalues add up to 7−2+7=12=trace7 - 2 + 7 = 12 = \text{trace}.

Exercise 3: A block matrix

Find the eigenvalues of B=[210120007]B = \begin{bmatrix} 2 & 1 & 0 \\ 1 & 2 & 0 \\ 0 & 0 & 7 \end{bmatrix} and one eigenvector for each.

Answer

λ=1\lambda = 1: (1,−1,0)(1, -1, 0); λ=3\lambda = 3: (1,1,0)(1, 1, 0); λ=7\lambda = 7: (0,0,1)(0, 0, 1).

Solution

Expanding det⁡(B−λI)\det(B - \lambda I) along the last row gives (7−λ)⋅det⁡[2−λ112−λ]=(7−λ)(λ2−4λ+3)=(7−λ)(λ−1)(λ−3)(7 - \lambda) \cdot \det\begin{bmatrix} 2 - \lambda & 1 \\ 1 & 2 - \lambda \end{bmatrix} = (7 - \lambda)(\lambda^2 - 4\lambda + 3) = (7 - \lambda)(\lambda - 1)(\lambda - 3). The upper-left 2×22 \times 2 block is the matrix from Eigenvectors and Eigenvalues, and e3\mathbf{e}_3 is left alone except for the factor 7.

python · try it yourself
from sympy import Matrix

B = Matrix([[2, 1, 0], [1, 2, 0], [0, 0, 7]])
for value, mult, vecs in B.eigenvects():
    print(value, mult, [list(v) for v in vecs])
1 1 [[-1, 1, 0]]
3 1 [[1, 1, 0]]
7 1 [[0, 0, 1]]

Exercise 4: Trace and determinant check

A 2×22 \times 2 matrix has trace 1 and determinant −12. Find its eigenvalues without knowing the matrix, then check your answer on [332−2]\begin{bmatrix} 3 & 3 \\ 2 & -2 \end{bmatrix}, which has that trace and determinant.

Answer

λ=4\lambda = 4 and λ=−3\lambda = -3.

Solution
λ2−1⋅λ−12=(λ−4)(λ+3)=0 → λ=4,−3check: 4+(−3)=1=trace,4⋅(−3)=−12=det⁡[332−2]: (3−λ)(−2−λ)−6=λ2−λ−12(same polynomial)\begin{aligned} &\lambda^2 - 1 \cdot \lambda - 12 = (\lambda - 4)(\lambda + 3) = 0 \ \to\ \lambda = 4, -3 \\ &\text{check: } 4 + (-3) = 1 = \text{trace}, \quad 4 \cdot (-3) = -12 = \det \\ &\begin{bmatrix} 3 & 3 \\ 2 & -2 \end{bmatrix}: \ (3 - \lambda)(-2 - \lambda) - 6 = \lambda^2 - \lambda - 12 \qquad \text{(same polynomial)} \end{aligned}
python · try it yourself
import numpy as np

M = np.array([[3.0, 3.0], [2.0, -2.0]])
print(sorted(round(float(x), 6) for x in np.linalg.eigvals(M)))
[-3.0, 4.0]

Test yourself

Why are the eigenvalues the roots of det⁡(A−λI)\det(A - \lambda I)?

  1. Because the determinant is linear in λ\lambda
  2. Because (A−λI)v=0(A - \lambda I)\mathbf{v} = \mathbf{0} has a nonzero solution exactly when A−λIA - \lambda I is singular
  3. Because AA is always invertible
  4. Because eigenvectors have length 1

What is the characteristic polynomial of a 2×22 \times 2 matrix with trace 6 and determinant 8?

  1. λ2+6λ+8\lambda^2 + 6\lambda + 8
  2. λ2−8λ+6\lambda^2 - 8\lambda + 6
  3. λ2−6λ+8\lambda^2 - 6\lambda + 8
  4. λ2−6λ−8\lambda^2 - 6\lambda - 8

λ=3\lambda = 3 is a double root of the characteristic polynomial, and its eigenspace is a line. What are its algebraic and geometric multiplicities?

  1. 2 and 2
  2. 1 and 2
  3. 2 and 1
  4. 3 and 1