AI Knowledge Tree

Eigenvalues & eigenvectors

Define eigenpairs, find them through the characteristic polynomial, and interpret them as invariant scaling directions.

⏱ 32 minPrerequisites:Determinants and volume

Most vectors, when multiplied by a matrix, change direction. An eigenvector is a direction that a matrix leaves alone, only stretching or flipping it. Finding these invariant directions reveals the intrinsic geometry of the transformation.

Definition

A nonzero vector v∈Rnv \in \mathbb{R}^n is an eigenvector of A∈Rn×nA \in \mathbb{R}^{n \times n} with eigenvalue λ∈R\lambda \in \mathbb{R} (or C\mathbb{C}) if[1]

Av=λv.Av = \lambda v.

The vector vv is mapped to a scalar multiple of itself: it stays on its own line. The scalar λ\lambda may be positive (same direction), negative (flipped), zero (collapsed), or complex.

The pair (λ,v)(\lambda, v) is called an eigenpair. Eigenvectors are not unique: any nonzero multiple cvcv of an eigenvector is again an eigenvector for the same λ\lambda (since A(cv)=c(Av)=cλv=λ(cv)A(cv) = c(Av) = c\lambda v = \lambda(cv)). The eigenspace Eλ=ker⁡(A−λI)E_\lambda = \ker(A - \lambda I) is the set of all eigenvectors for λ\lambda, together with 00.

Finding eigenvalues: the characteristic polynomial

Rewrite Av=λvAv = \lambda v as (A−λI)v=0(A - \lambda I)v = 0. A nonzero solution exists if and only if A−λIA - \lambda I is singular, which by the previous lesson means

det⁡(A−λI)=0.\det(A - \lambda I) = 0.

Expanding the determinant in the variable λ\lambda yields the characteristic polynomial p(λ)=det⁡(A−λI)p(\lambda) = \det(A - \lambda I), a polynomial of degree nn in λ\lambda. Its roots are the eigenvalues[2]. By the fundamental theorem of algebra, counting complex roots with multiplicity, there are exactly nn roots.

Two useful facts

Trace and determinant.

∑i=1nλi=tr⁡(A),∏i=1nλi=det⁡(A).\sum_{i=1}^n \lambda_i = \operatorname{tr}(A), \qquad \prod_{i=1}^n \lambda_i = \det(A).

The trace is the sum of diagonal entries. These follow from expanding p(λ)=det⁡(A−λI)p(\lambda) = \det(A - \lambda I) and comparing coefficients at the leading and constant terms.

Eigenvalues of triangular matrices. If AA is upper (or lower) triangular, A−λIA - \lambda I is also triangular, and its determinant is the product of diagonal entries aii−λa_{ii} - \lambda. So the eigenvalues are exactly the diagonal entries.

Algebraic vs. geometric multiplicity

The algebraic multiplicity of λ\lambda is its multiplicity as a root of the characteristic polynomial. The geometric multiplicity is dim⁡Eλ\dim E_\lambda. Geometric multiplicity is always ≤\le algebraic multiplicity. When they are equal for every eigenvalue, the matrix is called diagonalizable (the next lesson proves this rigorously).

Complex eigenvalues for real matrices

A real matrix can have complex eigenvalues, always in conjugate pairs λ,λˉ\lambda, \bar\lambda. For a 2×22\times 2 rotation matrix

Rθ=(cos⁡θ−sin⁡θsin⁡θcos⁡θ)R_\theta = \begin{pmatrix}\cos\theta & -\sin\theta \\ \sin\theta & \cos\theta\end{pmatrix}

the characteristic polynomial is λ2−2cos⁡θ λ+1=0\lambda^2 - 2\cos\theta\,\lambda + 1 = 0, whose roots are e±iθe^{\pm i\theta}: pure rotation has no real invariant direction.

A maps the unit circle to an ellipse: a generic vector changes direction, but the two eigenvectors keep their direction and are only stretched, by λ = 5 and λ = 2.
A maps the unit circle to an ellipse: a generic vector changes direction, but the two eigenvectors keep their direction and are only stretched, by λ = 5 and λ = 2.

Check it on arrays

python · numpy
import numpy as np

A = np.array([[4.0, 1.0],
              [2.0, 3.0]])

eigenvalues, eigenvectors = np.linalg.eig(A)
print("eigenvalues:", eigenvalues)       # [5, 2]
print("eigenvectors (columns):\n", eigenvectors)

# Verify: A @ v == lambda * v for each pair
for i, lam in enumerate(eigenvalues):
    v = eigenvectors[:, i]
    print(f"A@v - lam*v = {np.round(A @ v - lam * v, 10)}")  # ~zero

# Trace and det from eigenvalues
print("trace(A):", np.trace(A), "= sum of eigenvalues:", eigenvalues.sum())
print("det(A):", np.linalg.det(A), "= product of eigenvalues:", eigenvalues.prod())

# Triangular matrix: eigenvalues are the diagonal entries
T = np.array([[3.0, 5.0, 1.0],
              [0.0, 7.0, 2.0],
              [0.0, 0.0,-1.0]])
lams = np.linalg.eig(T)[0]
print("triangular eigenvalues:", np.sort(lams)[::-1], "diagonal:", [3, 7, -1])

The residuals Av−λvAv - \lambda v are near zero; trace and determinant match the eigenvalue sums and products.

Exercises

Exercise 1. Find the eigenvalues and a corresponding eigenvector for each, of A=(2112)A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}, working entirely by hand.

Solution

Step 1. Form the characteristic polynomial det⁡(A−λI)=0\det(A - \lambda I) = 0:

det⁡(2−λ112−λ)=(2−λ)2−1=0.\det\begin{pmatrix} 2 - \lambda & 1 \\ 1 & 2 - \lambda \end{pmatrix} = (2 - \lambda)^2 - 1 = 0.

Step 2. Expand: (2−λ)2=1(2 - \lambda)^2 = 1, so 2−λ=±12 - \lambda = \pm 1, giving λ1=1\lambda_1 = 1 and λ2=3\lambda_2 = 3. (Check against trace and determinant: λ1+λ2=4=tr⁡A\lambda_1 + \lambda_2 = 4 = \operatorname{tr} A, and λ1λ2=3=det⁡A\lambda_1 \lambda_2 = 3 = \det A.)

Step 3. For λ1=1\lambda_1 = 1, solve (A−I)v=0(A - I)v = 0: the rows both read v1+v2=0v_1 + v_2 = 0, so v=(1,−1)v = (1, -1). For λ2=3\lambda_2 = 3, solve (A−3I)v=0(A - 3I)v = 0: the rows read −v1+v2=0-v_1 + v_2 = 0, so v=(1,1)v = (1, 1). The two eigenvectors are orthogonal, the symmetry of AA foreshadowing the spectral theorem.

Exercise 2. Prove that if λ\lambda is an eigenvalue of an invertible matrix AA, then 1/λ1/\lambda is an eigenvalue of A−1A^{-1}, with the same eigenvector.

Solution

Step 1. Start from the eigenpair relation Av=λvAv = \lambda v with v≠0v \neq 0. Since AA is invertible, λ≠0\lambda \neq 0 (a zero eigenvalue would mean a nonzero vv in ker⁡A\ker A, contradicting invertibility).

Step 2. Apply A−1A^{-1} to both sides: A−1Av=A−1(λv)A^{-1} A v = A^{-1}(\lambda v), i.e. v=λ A−1vv = \lambda\, A^{-1} v.

Step 3. Divide by λ≠0\lambda \neq 0: A−1v=1λvA^{-1} v = \tfrac{1}{\lambda} v. So vv is an eigenvector of A−1A^{-1} with eigenvalue 1/λ1/\lambda.

Exercise 3 (code). A real matrix can have complex eigenvalues in conjugate pairs. Build the rotation matrix RθR_\theta for θ=30∘\theta = 30^\circ, confirm its eigenvalues are e±iθe^{\pm i\theta}, and check the trace/determinant relations hold over the complex eigenvalues.

Solution
python · numpy
import numpy as np

theta = np.deg2rad(30.0)
R = np.array([[np.cos(theta), -np.sin(theta)],
              [np.sin(theta),  np.cos(theta)]])

eigvals = np.linalg.eigvals(R)
expected = np.array([np.exp(1j * theta), np.exp(-1j * theta)])

# Eigenvalues are e^{+/- i theta} (order may differ, so compare sorted).
assert np.allclose(np.sort_complex(eigvals), np.sort_complex(expected))

# Trace = sum of eigenvalues, det = product (both real for a real matrix).
assert np.isclose(eigvals.sum().real, np.trace(R))
assert np.isclose(eigvals.prod().real, np.linalg.det(R))
print("eigenvalues:", np.round(eigvals, 4))

The eigenvalues land on the unit circle at angle ±θ\pm\theta, their sum equals tr⁡R=2cos⁡θ\operatorname{tr} R = 2\cos\theta, and their product equals det⁡R=1\det R = 1: a pure rotation scales nothing.

When a symmetric matrix enters the picture, its eigenvalues are always real and its eigenvectors always orthogonal: the spectral theorem, the subject of the next lesson.


References

  1. [1]Strang, G. (2016). Introduction to Linear Algebra (5th ed.). Wellesley-Cambridge Press. Eigenvalues, eigenvectors, and their geometric meaning.↩
  2. [2]Horn, R. A., & Johnson, C. R. (2012). Matrix Analysis (2nd ed.). Cambridge University Press. The characteristic polynomial, trace/determinant relations, and multiplicities.↩