19. Characteristic polynomial, eigenvalues, eigenvectors
§18.4 asked what basis makes a transformation's matrix simplest. This lesson finds the answer's raw ingredients: directions a matrix doesn't rotate or mix, only stretches — its eigenvectors — and the stretch factors along them, its eigenvalues. Everything in Modules 19–21 is built from this single idea.
Definition
For a square matrix A, a nonzero vector \vec v is an eigenvector with eigenvalue \lambda if
A\vec v=\lambda\vec v
A applied to \vec v doesn't rotate or shear it (§18.2's language) — it comes back out exactly parallel to \vec v, only scaled by \lambda. \vec v=\vec0 is deliberately excluded: A\vec0=\vec0= \lambda\vec0 for every \lambda, so allowing it would make every number an eigenvalue trivially, destroying the whole idea. \lambda itself is allowed to be 0 (meaning A\vec v=\vec0 for some nonzero \vec v — exactly a nontrivial kernel, §18.3) or negative (the vector flips direction) or complex (§19.4 touches this briefly; this course works mostly over the reals).
Finding eigenvalues: the characteristic polynomial
Rewrite A\vec v=\lambda\vec v as (A-\lambda I)\vec v=\vec0. For a nonzero \vec v to exist, A-\lambda I must be singular — by §16.4's determinant test:
\det(A-\lambda I)=0
Expanding this determinant produces a degree-n polynomial in \lambda, the characteristic polynomial, and its roots are exactly A's eigenvalues. For 2\times2:
\det\begin{pmatrix}a-\lambda&b\\c&d-\lambda\end{pmatrix}=(a-\lambda)(d-\lambda)-bc=\lambda^2-(a+d)\lambda+(ad-bc)
using a+d=\operatorname{tr}A (the trace, sum of diagonal entries) and ad-bc=\det A — so for 2\times2 matrices specifically,
\lambda^2-(\operatorname{tr}A)\lambda+\det A=0
a fast shortcut worth memorizing: read the trace and determinant straight off A, then solve one quadratic.
By the Fundamental Theorem of Algebra, a degree-n polynomial has exactly n roots counted with multiplicity (possibly complex, possibly repeated) — so an n\times n matrix always has exactly n eigenvalues in that counted sense, even though it may have fewer distinct real ones (§19.2 develops what "counted with multiplicity" means precisely).
Finding eigenvectors
For each eigenvalue \lambda, its eigenvectors are the nonzero solutions of (A-\lambda I)\vec v=\vec0 — exactly \operatorname{Null}(A-\lambda I) from §17.4, computed by the same row-reduction as always, now aimed at the matrix A-\lambda I instead of A itself.
Doing it in Python
import sympy as sp
A = sp.Matrix([[4, 1], [2, 3]])
lam = sp.Symbol('lambda')
charpoly = A.charpoly(lam)
print("characteristic polynomial:", charpoly.as_expr())
eigenvalues = A.eigenvals() # {eigenvalue: algebraic multiplicity}
print("eigenvalues:", eigenvalues)
for val, vecs in [(v, (A - v*sp.eye(2)).nullspace()) for v in eigenvalues]:
print(f"lambda={val}: eigenvector {list(vecs[0])}")
characteristic polynomial: lambda**2 - 7*lambda + 10
eigenvalues: {5: 1, 2: 1}
lambda=5: eigenvector [1, 1]
lambda=2: eigenvector [-1/2, 1]
Confirming A\vec v=\lambda\vec v directly, and the trace/determinant shortcut:
import sympy as sp
A = sp.Matrix([[4, 1], [2, 3]])
for val in A.eigenvals():
v = (A - val*sp.eye(2)).nullspace()[0]
print(f"A @ v = {list(A * v)}, lambda*v = {list(val * v)}")
tr, det = A.trace(), A.det()
print(f"\ntrace={tr}, det={det}")
print("sum of eigenvalues == trace:", sum(A.eigenvals()) == tr)
print("product of eigenvalues == det:", sp.prod(A.eigenvals()) == det)
A @ v = [5, 5], lambda*v = [5, 5]
A @ v = [-1, 2], lambda*v = [-1, 2]
trace=7, det=10
sum of eigenvalues == trace: True
product of eigenvalues == det: True
Worked example
Find the eigenvalues and eigenvectors of A=\begin{pmatrix}5&4\\1&2\end{pmatrix}.
\operatorname{tr}A=7, \det A=5(2)-4(1)=6. \lambda^2-7\lambda+6=0\Rightarrow(\lambda-1)(\lambda-6)=0\Rightarrow\lambda=1,6.
For \lambda=1: (A-I)\vec v=\vec0: \begin{pmatrix}4&4\\1&1\end{pmatrix}\vec v=\vec0\Rightarrow 4v_1+4v_2=0\Rightarrow v_1=-v_2. Eigenvector: (1,-1) (or any multiple).
For \lambda=6: (A-6I)\vec v=\vec0: \begin{pmatrix}-1&4\\1&-4\end{pmatrix}\vec v=\vec0\Rightarrow -v_1+4v_2=0\Rightarrow v_1=4v_2. Eigenvector: (4,1).
\boxed{\lambda_1=1,\ \vec v_1=(1,-1);\quad\lambda_2=6,\ \vec v_2=(4,1)}
Sanity check. A(1,-1)^T=(5-4,\,1-2)=(1,-1)=1\cdot(1,-1) ✓. A(4,1)^T=(20+4,\,4+2)=(24,6)=6(4,1) ✓. Both eigenvalues also satisfy 1+6=7=\operatorname{tr}A ✓ and 1\times6=6=\det A ✓ — a quick check that costs nothing and catches most sign or arithmetic slips.
Your turn
1. Find the eigenvalues of A=\begin{pmatrix}3&0\\0&-2\end{pmatrix} without any computation. Why is this immediate?
2. Find the eigenvalues of A=\begin{pmatrix}2&1\\0&2\end{pmatrix} using \operatorname{tr}A,\det A.
3. True or false: every real 2\times2 matrix has at least one real eigenvalue.
Solutions
1. \lambda=3,-2 — for any diagonal matrix, the eigenvalues are exactly the diagonal entries. (A-\lambda I is diagonal too, and a diagonal matrix is singular exactly when some diagonal entry is 0 — so \det(A-\lambda I)=(3-\lambda)(-2-\lambda)=0 directly, with roots read straight off.)
2. \operatorname{tr}A=4, \det A=2(2)-1(0)=4. \lambda^2-4\lambda+4=0\Rightarrow(\lambda-2)^2=0\Rightarrow\lambda=2 (a repeated eigenvalue — §19.2 studies exactly this case, where a single eigenvalue's algebraic multiplicity is 2).
3. False. A=\begin{pmatrix}0&-1\\1&0\end{pmatrix} (a 90° rotation, §18.2) has characteristic polynomial \lambda^2-0\lambda+1=\lambda^2+1=0\Rightarrow\lambda=\pm i — purely complex, no real eigenvalues at all. Geometrically this makes sense: a 90° rotation sends every nonzero vector to a genuinely different direction, so no real direction can be "only stretched."
Check yourself in code
Find the eigenvalues of A=\begin{pmatrix}6&-1\\2&3\end{pmatrix} and, for each, one eigenvector.
Print exactly this:
eigenvalues: {5: 1, 4: 1}
lambda=5: eigenvector [1, 1]
lambda=4: eigenvector [1/2, 1]
import sympy as sp
A = sp.Matrix([[6, -1], [2, 3]])
eigenvalues = A.eigenvals()
print("eigenvalues:", eigenvalues)
# for each eigenvalue, print "lambda=<value>: eigenvector <list>"
import sympy as sp
A = sp.Matrix([[6, -1], [2, 3]])
eigenvalues = A.eigenvals()
print("eigenvalues:", eigenvalues)
for val in eigenvalues:
v = (A - val*sp.eye(2)).nullspace()[0]
print(f"lambda={val}: eigenvector {list(v)}")
An eigenvector of A points in a direction A only stretches, never rotates; its scale factor is the eigenvalue. Eigenvalues are the roots of \det(A-\lambda I)=0, the characteristic polynomial — for 2\times2, \lambda^2-(\operatorname{tr}A)\lambda+\det A=0 — and each eigenvalue's eigenvectors form \operatorname{Null}(A-\lambda I).
Next: collecting eigenvectors into a full eigenbasis, and diagonalization — the payoff §18.4 promised, where a matrix becomes diagonal in exactly the right coordinates.