A number is an eigenvalue exactly when A minus lambda times I flattens space. Turn that into the equation det(A - lambda I) = 0, solve it for the running matrix, find each eigenvector as a null space, and meet numpy.linalg.eig.
M03.1.2L2 Intermediate25 minIn review (what this means)
The maths and code on this page are checked by automated tests on every change, but an independent reader has not signed it off yet. Spot a mistake or a confusing step? Tell us.
Derive the condition det(A - lambda I) = 0 from the eigenvector equation and the link between null spaces and determinants.
Expand the characteristic polynomial of a 2 by 2 matrix as lambda squared minus the trace times lambda plus the determinant.
Find the eigenvalues of a 2 by 2 matrix and of a triangular matrix, and each eigenvector as the null space of A - lambda I by elimination.
Use numpy.linalg.eig and explain why its eigenvectors have length 1 and an arbitrary sign.
The question
Sweeping a vector round a circle found the eigenvectors of a 2 by 2 matrix, but a covariance matrix of 784 pixels has 784 dimensions, and no one can sweep round a sphere in 784 dimensions. Is there an equation whose solutions are exactly the eigenvalues, so that algebra, and later a library, can find them all?
From the last lesson
1. Why must an eigenvector be non-zero?
Show answer
Because \({\mat{A}\vect{0}} = {\lambda\vect{0}}\) for every number \(\lambda\), so allowing the zero vector would make every number an eigenvalue.
2. What are the eigenvalues of the projection onto a line, and of the reflection across a line, in the plane?
Show answer
The projection: 1 (vectors on the line) and 0 (vectors it projects along). The reflection: 1 (the mirror line) and \(-1\) (the perpendicular line).
Intuition
Move everything in \({\mat{A}\vect{v}} = {\lambda\vect{v}}\) to one side. The equation says that the matrix \(\mat{A} - \lambda\mat{I}\) sends the non-zero vector \(\vect{v}\) to the zero vector. A matrix that sends a non-zero vector to zero has flattened the plane: it has crushed a whole line to the origin, so it squashes areas to nothing.
M03.1.2-F1
Try two values of \(\lambda\) on the running matrix. \(\mat{A} - 3\mat{I}\) keeps the plane a plane, so only \(\vect{0}\) goes to \(\vect{0}\) and 3 is not an eigenvalue. \(\mat{A} - 5\mat{I}\) flattens the plane onto a line and crushes \((1, 1)\) to the origin, so 5 is an eigenvalue.
The determinant measures how a matrix scales area (M02.8), and it is zero exactly when the matrix flattens. So the hunt for eigenvalues becomes one equation: find the \(\lambda\) that make the determinant of \(\mat{A} - \lambda\mat{I}\) zero.
Build it up
Step 1. Write \(\lambda\vect{v}\) as a matrix times \(\vect{v}\). The identity matrix \(\mat{I}\) leaves every vector alone, so \({\lambda\vect{v}} = {\lambda\mat{I}\vect{v}}\). Then
The last line collects the two terms with the distributive rule. We need \(\mat{I}\) because a number cannot be subtracted from a matrix; \(\lambda\mat{I}\) is the matrix with \(\lambda\) down the diagonal.
Step 2. A non-zero vector sent to zero. The equation asks for a non-zero vector in the null space of \(\mat{A} - \lambda\mat{I}\) (M02.7.3). A square matrix has a non-zero vector in its null space exactly when it has no inverse, which happens exactly when its determinant is zero (M02.8.3).
Step 3. The determinant is a polynomial in \(\lambda\). For the running matrix,
The characteristic polynomial of \(\mat{A}\). Its zeros, 2 and 5, are the eigenvalues. Its value at 3 is \(-2\), the area factor of \(\mat{A} - 3\mat{I}\) in the anchor figure, and its value at 0 is \(\det\mat{A} = 10\).
The formal statement
NoteDefinition and theorem: the characteristic polynomial
For an \({n \times n}\) matrix \(\mat{A}\), the characteristic polynomial is
and \(p(\lambda) = 0\) is the characteristic equation. A number \(\lambda\) is an eigenvalue of \(\mat{A}\) exactly when \(p(\lambda) = 0\). Its eigenvectors are then the non-zero vectors of the null space of \(\mat{A} - \lambda\mat{I}\).
Proof. Steps 1 and 2 above, read in both directions: \(\lambda\) is an eigenvalue \(\iff\) some \(\vect{v} \neq \vect{0}\) has \({(\mat{A} - \lambda\mat{I})\vect{v}} = \vect{0}\)\(\iff\)\(\mat{A} - \lambda\mat{I}\) is not invertible \(\iff\)\({\det(\mat{A} - \lambda\mat{I})} = 0\). \(\blacksquare\)
The 2 by 2 formula. Let \(\mat{A}\) have rows \((a, b)\) and \((c, d)\). Expand the determinant, multiply out the product of the diagonal, and collect powers of \(\lambda\):
\[
\begin{aligned}
p(\lambda) &= (a - \lambda)(d - \lambda) - bc \\
&= ad - a\lambda - d\lambda + \lambda^2 - bc \\
&= \lambda^2 - (a + d)\,\lambda + (ad - bc).
\end{aligned}
\]
The sum \({a + d}\) of the diagonal entries is the trace, \(\operatorname{tr}(\mat{A})\), and \({ad - bc}\) is \(\det\mat{A}\). So for every 2 by 2 matrix
The discriminant\(\Delta\) decides the kind of answer: two different real eigenvalues when \(\Delta > 0\), one repeated eigenvalue when \(\Delta = 0\), and a pair of complex ones when \(\Delta < 0\) (lesson M03.1.4).
Triangular matrices. For a larger matrix the determinant is harder to expand, but one case is free. If every entry below the diagonal is zero, then \(\mat{A} - \lambda\mat{I}\) is triangular too, and the determinant of a triangular matrix is the product of its diagonal entries (M02.8.4).
M03.1.2-F4
A triangular matrix wears its eigenvalues on its diagonal: subtracting \(\lambda\) there keeps the matrix triangular, and its determinant is the product of the diagonal.
So the eigenvalues of a triangular matrix are its diagonal entries. In general, \(\det(\mat{A} - \lambda\mat{I})\) is a polynomial of degree \(n\), so an \({n \times n}\) matrix has at most \(n\) distinct eigenvalues.
Go deeper: why the degree is exactly n
Expand \(\det(\mat{A} - \lambda\mat{I})\) as a sum over permutations: each term is a product of \(n\) entries, one from each row and each column. An entry carries a \(\lambda\) only if it is on the diagonal. The only term with all \(n\) diagonal entries is \({(a_{11} - \lambda)(a_{22} - \lambda) \cdots (a_{nn} - \lambda)}\), which contains \({(-1)^n\lambda^n}\). Every other permutation leaves the diagonal at least twice, so its term has degree at most \({n - 2}\). The polynomial therefore has degree exactly \(n\), with leading coefficient \({(-1)^n}\). Some books use \(\det(\lambda\mat{I} - \mat{A})\) instead, which differs by the factor \({(-1)^n}\) and has the same roots.
Worked example
Find every eigenvalue and eigenvector of the running \(\mat{A}\).
Eigenvalues. Step 3 gave \({p(\lambda)} = {\lambda^2 - 7\lambda + 10}\). Two numbers with sum 7 and product 10 are 5 and 2, so \({p(\lambda)} = {(\lambda - 5)(\lambda - 2)}\). The formula agrees: \(\Delta = {49 - 40} = 9\) and \({\lambda = (7 \pm 3)/2}\), that is 5 or 2.
Eigenvectors. For each eigenvalue, solve \({(\mat{A} - \lambda\mat{I})\vect{v}} = \vect{0}\) by elimination (M02.6). One row always becomes zero, because the matrix is singular.
M03.1.2-F3
Each eigenvector is the null space of \(\mat{A} - \lambda\mat{I}\). Elimination clears the second row, the remaining row gives one equation, and any non-zero solution is an eigenvector.
For \(\lambda_1 = 5\) the matrix has rows \((-1, 1)\) and \((2, -2)\). Adding twice the first row to the second clears it, leaving \({-x + y} = 0\), so \(y = x\): the line of \(\vect{v}_1 = (1, 1)\). For \(\lambda_2 = 2\) the rows are \((2, 1)\) and \((2, 1)\). Subtracting clears the second, leaving \({2x + y} = 0\), so \(y = -2x\): the line of \(\vect{v}_2 = (1, -2)\). These are the lines the sweep found in the last lesson, now exact.
A triangular 3 by 3 example. For the matrix \(\mat{U}\) of the figure above, \({p(\lambda)} = {(2 - \lambda)(3 - \lambda)(5 - \lambda)}\), so the eigenvalues are 2, 3 and 5. The eigenvectors come from back-substitution, last row first:
\(\lambda = 3\): the rows of \(\mat{U} - 3\mat{I}\) give \({-x + y} = 0\), \({z} = 0\) and \({2z} = 0\), so \(\vect{v} = (1, 1, 0)\).
\(\lambda = 5\): they give \({-3x + y} = 0\) and \({-2y + z} = 0\). Choose \(z = 6\); then \(y = 3\) and \(x = 1\), so \(\vect{v} = (1, 3, 6)\). Check: \({\mat{U}\,(1, 3, 6)} = (5, 15, 30)\), which is \({5\,(1, 3, 6)}\).
\(\lambda = 2\): the rows give \({y} = 0\) and \({z} = 0\) with \(x\) free, so \(\vect{v} = (1, 0, 0)\).
Code
From scratch: the 2 by 2 formula, with cmath.sqrt so that a negative discriminant gives complex eigenvalues instead of an error. An eigenvector for \(\lambda\) comes from the first row of \(\mat{A} - \lambda\mat{I}\): the equation \({(a - \lambda)x + by} = 0\) is solved by \({(x, y)} = {(b,\; \lambda - a)}\) whenever \(b \neq 0\).
import cmathdef eig2(a, b, c, d):"""Eigenvalues of [[a, b], [c, d]] by the quadratic formula, larger real part first.""" tr, det = a + d, a * d - b * c root = cmath.sqrt(tr * tr -4* det) lams = [(tr + root) /2, (tr - root) /2]return [l.real ifabs(l.imag) <1e-12else l for l in lams]def eigvec2(a, b, c, d, lam):"""A vector in the null space of A - lam I (needs b != 0)."""return (b, lam - a)lams = eig2(4, 1, 2, 3)print("eigenvalues:", lams)print("eigenvectors:", [eigvec2(4, 1, 2, 3, l) for l in lams])print("the running map T:", eig2(1, 1, -1, 2))
The columns are the hand answers \((1, 1)\) and \((1, -2)\) divided by their lengths \(\sqrt2\) and \(\sqrt5\), possibly with the sign flipped. The order of the eigenvalues is not promised either, so the hidden checks match each column to its eigenvalue instead of assuming an order. On some computers the output is complex even here, 5.+0.j instead of 5.: an imaginary part of exactly zero, so the same real numbers in a complex array.
M03.1.2-F6
NumPy scales each eigenvector to length 1, landing on the unit circle, and may return either of the two unit vectors on the line. All of them name the same eigenvector line.
Explore
The eigenvector hunter lives in lesson M03.1.1. Its read-out prints the trace, determinant and discriminant of the chosen matrix. Set the entries to \((1, 2)\) and \((2, 1)\): the formula predicts eigenvalues 3 and \(-1\). Check them by turning \(\vect{u}\) until it lines up, and notice that \(-1\) makes the image point the other way.
Pitfalls
M03.1.2-F5
Wrong beside right. Subtracting \(\lambda\) from every entry gives a polynomial whose root, 2.5, is not an eigenvalue. \(\lambda\mat{I}\) has \(\lambda\) on the diagonal only.
“\(\mat{A} - \lambda\) means subtract \(\lambda\) from every entry.”
The equation is \({(\mat{A} - \lambda\mat{I})\vect{v}} = \vect{0}\), and \(\lambda\mat{I}\) is zero off the diagonal. Subtracting from every entry is NumPy’s broadcasting rule for A - lam, which is exactly why code must write A - lam * np.eye(2).
“Row-reduce \(\mat{A}\) first, then read the eigenvalues off the diagonal.”
Elimination keeps the null space of a matrix but not its eigenvalues. Subtracting half of row 1 from row 2 turns \(\mat{A}\) into the triangular matrix with rows \((4, 1)\) and \((0, 2.5)\), whose diagonal is 4 and 2.5, not 5 and 2. Eliminate on \(\mat{A} - \lambda\mat{I}\) after choosing \(\lambda\), never on \(\mat{A}\) to find \(\lambda\).
“NumPy got a different eigenvector from mine, so one of us is wrong.”
eig returns unit vectors with an arbitrary sign, in no promised order. Compare lines, not arrows: two answers agree when one is a multiple of the other. Tests that compare eigenvectors entry by entry break on another computer, where a different linear-algebra library may choose the other sign.
Check yourself
Recall
1. Why does \({\mat{A}\vect{v}} = {\lambda\vect{v}}\) with \(\vect{v} \neq \vect{0}\) force \({\det(\mat{A} - \lambda\mat{I})} = 0\)?
Show answer
It says \(\mat{A} - \lambda\mat{I}\) sends a non-zero vector to \(\vect{0}\), so it has a non-zero null space, is not invertible, and has determinant zero.
2. Write the characteristic polynomial of a 2 by 2 matrix in terms of its trace and determinant.
3. What does the sign of the discriminant tell you about the eigenvalues of a 2 by 2 matrix?
Show answer
Positive: two different real eigenvalues. Zero: one repeated real eigenvalue. Negative: a pair of complex eigenvalues and no real eigenvector.
4. What are the eigenvalues of a triangular matrix, and why?
Show answer
Its diagonal entries, because \(\mat{A} - \lambda\mat{I}\) is still triangular and its determinant is the product of its diagonal \({(a_{ii} - \lambda)}\).
5. Once you have an eigenvalue, how do you find its eigenvectors?
Show answer
Solve \({(\mat{A} - \lambda\mat{I})\vect{v}} = \vect{0}\) by elimination: the eigenvectors are the non-zero vectors of that null space.
Exercises
1.★ Find the eigenvalues and eigenvectors of \(\mat{S} = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}\) through its characteristic polynomial.
Show solution
\(\operatorname{tr}(\mat{S}) = 4\) and \(\det\mat{S} = 3\), so \({p(\lambda)} = {\lambda^2 - 4\lambda + 3} =
{(\lambda - 3)(\lambda - 1)}\). For \(\lambda = 3\) the rows of \(\mat{S} - 3\mat{I}\) are \((-1, 1)\) and \((1, -1)\), giving \(y = x\) and the eigenvector \((1, 1)\). For \(\lambda = 1\) both rows are \((1, 1)\), giving \({x + y} = 0\) and the eigenvector \((1, -1)\).
2.★★ Find the eigenvalues and eigenvectors of \(\begin{bmatrix} 0 & 1 \\ -2 & 3 \end{bmatrix}\), and check each eigenvector by multiplication.
Show solution
The trace is 3 and the determinant is \({0 \cdot 3 - 1 \cdot (-2)} = 2\), so \({p(\lambda)} = {\lambda^2 - 3\lambda + 2} = {(\lambda - 1)(\lambda - 2)}\). For \(\lambda = 1\) the first row of the shifted matrix is \((-1, 1)\), giving \(y = x\) and \((1, 1)\); check: the matrix sends \((1, 1)\) to \({(0 + 1,\; -2 + 3)} = (1, 1)\). For \(\lambda = 2\) the first row is \((-2, 1)\), giving \(y = 2x\) and \((1, 2)\); check: \((1, 2)\) goes to \({(0 + 2,\; -2 + 6)} = (2, 4) = {2\,(1, 2)}\).
3.★★★ Show that a 2 by 2 matrix and its transpose have the same characteristic polynomial. Then find the eigenvectors of \(\mat{A}\T\) for the running \(\mat{A}\) and compare them with those of \(\mat{A}\).
Show solution
\(\mat{A}\T\) has rows \((a, c)\) and \((b, d)\). Its characteristic polynomial is \({(a - \lambda)(d - \lambda) - cb}\), the same expression as for \(\mat{A}\) because \({cb} = {bc}\). So the eigenvalues agree.
For the running matrix, \(\mat{A}\T\) has rows \((4, 2)\) and \((1, 3)\), with eigenvalues 5 and 2. For \(\lambda = 5\) the first row of \(\mat{A}\T - 5\mat{I}\) is \((-1, 2)\), so \({-x + 2y} = 0\) and the eigenvector is \((2, 1)\). For \(\lambda = 2\) the first row is \((2, 2)\), so \({x + y} = 0\) and the eigenvector is \((1, -1)\). The eigenvalues are shared but the eigenvectors are not: \((2, 1)\) is not on the line of \((1, 1)\). Markov chains in M03.9 use exactly this: \(\mat{P}\) and \(\mat{P}\T\) share the eigenvalue 1 but not its eigenvector.
Summary card
\(\lambda\) is an eigenvalue exactly when \(\mat{A} - \lambda\mat{I}\) flattens space.
2 by 2.\({\lambda^2 - \operatorname{tr}(\mat{A})\,\lambda + \det\mat{A}} = 0\).
Eigenvectors. The null space of \(\mat{A} - \lambda\mat{I}\), minus \(\vect{0}\).
Triangular. Eigenvalues on the diagonal.
Running \(\mat{A}\).\({(\lambda - 5)(\lambda - 2)}\), with \((1, 1)\) and \((1, -2)\).
Sources and next steps
Sources. Each was opened and checked against this lesson on 15 November 2026.
Gilbert Strang, Eigenvalues and eigenvectors, MIT OpenCourseWare 18.06SC, lecture 21, and its lecture summary. Rewriting the equation as \({(A - \lambda I)x} = 0\), so that \({A - \lambda I}\) must be singular; the 2 by 2 equation \({\lambda^2 - \operatorname{trace}(A)\,\lambda + \det A} = 0\); eigenvectors as the null space of \({A - \lambda I}\) found by elimination; triangular matrices with their eigenvalues on the diagonal.
Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra, Section 5.2 (open textbook, Georgia Tech). The definition \({f(\lambda)} = {\det(A - \lambda I_n)}\), the 2 by 2 formula with the trace, and the eigenvalues of a triangular matrix.
Sheldon Axler, Linear Algebra Done Right, 4th edition (open access). Result 5.7: \(\lambda\) is an eigenvalue exactly when \({T - \lambda I}\) is not injective, equivalently not invertible.
NumPy reference, numpy.linalg.eig. It returns eigenvalues and eigenvectors, the eigenvalues “not necessarily ordered” and the eigenvectors normalised to unit length, column i belonging to eigenvalue i.