explainer
Eigenvalues and eigenvectors: find the lines a matrix preserves
Understand eigenvalues through 2D transformations. Test stretching, reversal, zero eigenvalues, rotation, and repeated values, then connect them to robot error dynamics.
What you will learn
- Verify an eigenvector by checking whether A v equals a scalar multiple of v.
- Explain negative, zero, complex, and repeated eigenvalues with simple matrices.
- Predict decay or growth in a fixed discrete linear error model.
Before you start
A matrix can stretch a vector while leaving it on the same line. The vector is then an eigenvector, and its signed scale factor is an eigenvalue.
This gives you a way to understand repeated transformations. A factor of 0.8 shrinks the vector on each application. A factor of −0.5 shrinks it and reverses its direction.
We will find these directions in two dimensions, check the exceptions, and follow a simple robot error model.
Start with what the matrix does
A two-by-two matrix maps a two-coordinate input into a two-coordinate output. Consider this matrix, written with one row on each line:
A = [2, 1; 1, 2]
A(x, y) = (2x + y, x + 2y)
Each output coordinate is the dot product of a matrix row with the input. The semicolon in this compact notation separates rows.
The matrix multiplication lesson develops this row-by-column calculation and shows how repeated matrix applications combine into a product.
For v = (1, 0), the output is (2, 1). The matrix changes its line. For v = (1, 1), the output is (3, 3), which stays on the line y = x.
Find a vector that stays on its line
A nonzero vector v is an eigenvector of a square matrix A when:
A v = λ v, with v ≠ 0
The Greek letter λ, pronounced “lambda,” names the eigenvalue. It tells you the signed scale factor along that vector. Interactive Linear Algebra defines eigenvectors through this equation.
For a real eigenvector and real eigenvalue, its line through the origin is invariant: A sends every point on that line back into the line. A negative λ reverses the arrow. A zero λ sends it to the origin.
Any nonzero multiple of an eigenvector has the same eigenvalue. For our matrix, (1, 1), (2, 2), and (−1, −1) all have eigenvalue 3.
The zero vector satisfies A0 = λ0 for every λ, so it cannot identify a scale factor. The definition excludes it. An eigenspace includes all eigenvectors for one eigenvalue, together with zero.
Compare the input and output
The experiment starts with v = (1, 1) and A v = (3, 3). Change the y coordinate to 0. The output moves off the input's line, and the eigenvector check changes to “No.”
Return to “Stretch” and set v = (1, −1). Its image equals itself. The two eigendirections have different scale factors, even though the same matrix acts on both.
The dotted guides mark eigendirections for these known matrices. “Repeated value” has infinitely many such lines, so the figure leaves the guides out. The readouts let you check any vector you choose.
Work through both eigenvalues
To check v = (1, 1), multiply directly:
A(1, 1) = (2 + 1, 1 + 2) = (3, 3) = 3(1, 1)
That verifies λ = 3. To find every eigenvalue, rearrange the defining equation as (A − λI)v = 0, where I leaves vectors unchanged. A nonzero solution requires A − λI to have determinant zero.
For this matrix, the determinant gives the characteristic equation:
(2 − λ)² − 1 = 0
(λ − 3)(λ − 1) = 0
The roots are 3 and 1. Substituting 3 gives y = x. Substituting 1 gives y = −x, which explains the figure's two lines.
Check the second result: A(1, −1) = (1, −1). Both coordinates scale by 1. Comparing just one coordinate would miss errors in the other.
Read reversal, collapse, and rotation
Choose “Reverse and shrink.” Its matrix maps (x, y) to (−0.5x, 0.8y). Horizontal eigenvectors reverse and halve; vertical eigenvectors keep their direction and shrink by 20%.
Choose “Collapse a direction.” Its matrix maps (x, y) to (x, 0). The nonzero vector (0, 1) has image (0, 0), so its eigenvalue is 0. This transformation loses the original y coordinate and has no inverse. The lost y direction belongs to its null space.
Set both input coordinates to zero. The output still equals zero, but the input now fails the eigenvector definition.
“Quarter-turn” maps (x, y) to (−y, x). Every nonzero real vector turns 90°, leaving its original line. This matrix has no real eigenvectors; its eigenvalues are i and −i, where i² = −1. Interactive Linear Algebra explains the complex eigenvalues of rotation matrices.
A 180° rotation behaves differently: A v = −v for every vector. Every nonzero real vector then has eigenvalue −1. The rotation angle matters.
Check what a repeated value gives you
“Repeated value” uses A = 2I. Its characteristic equation is (λ − 2)² = 0. Every nonzero vector is an eigenvector, and you can choose two independent ones as a basis.
“Shear” uses A = [1, 1; 0, 1]. Its characteristic equation is (λ − 1)² = 0. Yet A(x, y) = (x + y, y) equals (x, y) only when y = 0.
The shear has one independent eigendirection. The repeated root alone cannot tell you the dimension of its eigenspace.
A matrix is diagonalizable when its eigenvectors can form a basis. In that basis, the matrix scales each coordinate separately. The shear cannot supply that basis. Interactive Linear Algebra gives the basis criterion for diagonalization.
Review span, independence, and basis if the distinction between a line and a plane needs another example.
Follow a robot error through repeated updates
Suppose a simplified controller updates two position errors at a fixed sampling interval. Let eₖ hold those errors in metres after update k:
eₖ₊₁ = B eₖ
B = [−0.5, 0; 0, 0.8]
Starting from e₀ = (1, 1), four updates give (0.0625, 0.4096). The first error alternates sign while halving. The second keeps its sign and decays more slowly.
Along an eigenvector, repeated updates multiply its starting value by λᵏ. If the magnitude |λ| is below 1, that component approaches zero. A magnitude above 1 produces growth along that mode.
For a fixed, finite-dimensional linear model eₖ₊₁ = B eₖ, every initial error approaches zero exactly when every eigenvalue has magnitude below 1. This also covers complex and repeated eigenvalues. Stephen Boyd's Stanford notes derive this discrete-time stability condition.
An eigenvalue with magnitude exactly 1 needs closer inspection. The identity matrix keeps errors unchanged. The shear can make errors grow, despite having only eigenvalue 1.
This example assumes a constant matrix and no external disturbances. A real robot's nonlinear motion may match such a model only near one operating point. The sampling interval, controller, and operating point all affect the matrix being analyzed.
Markov chains apply repeated matrix updates to probabilities. With the row-vector convention used in that lesson, a stationary distribution satisfies πP = π: it is a left eigenvector with eigenvalue 1, normalized so its entries sum to one.
Reproduce the calculation in Python
This standard-library example checks the worked eigenpair, then prints the robot error updates. It needs no packages.
def matvec(matrix, vector):
return tuple(sum(a * x for a, x in zip(row, vector))
for row in matrix)
A = ((2, 1), (1, 2))
v = (1, 1)
image = matvec(A, v)
assert image == tuple(3 * x for x in v)
print("A v:", image)
B = ((-0.5, 0), (0, 0.8))
error = (1.0, 1.0)
for step in range(5):
print(f"{step}: ({error[0]:.4f}, {error[1]:.4f})")
error = matvec(B, error)
Expected output:
A v: (3, 3)
0: (1.0000, 1.0000)
1: (-0.5000, 0.8000)
2: (0.2500, 0.6400)
3: (-0.1250, 0.5120)
4: (0.0625, 0.4096)
Try it yourself
Exercise 1. Use A = [2, 1; 1, 2]. Check whether (2, −2) and (1, 0) are eigenvectors. Give an eigenvalue when one exists.
Show solution: check both coordinates
A(2, −2) = (2, −2), so the first vector has eigenvalue 1. Scaling an eigenvector by 2 keeps its eigenvalue.
A(1, 0) = (2, 1). No scalar multiple of (1, 0) can have a nonzero second coordinate, so it is not an eigenvector.
Exercise 2. Apply the shear A = [1, 1; 0, 1] repeatedly to (0, 1). Find the first three outputs. Does its repeated eigenvalue of 1 guarantee bounded motion?
Show solution: follow the shear
The outputs are (1, 1), (2, 1), (3, 1). Each update adds the unchanged second coordinate to the first. After k updates, the state is (k, 1), which grows without bound.
The starting vector lies outside the shear's single eigendirection. This is why eigenvalues on the unit-circle boundary need more information about the matrix.
Continue with tensors and array axes to connect these small matrices to the shapes used in code.
Sources and further study
- Interactive Linear Algebra: Eigenvalues and Eigenvectors, for the definition, eigenspaces, and zero eigenvalues.
- Interactive Linear Algebra: Complex Eigenvalues, for rotation and complex conjugate pairs.
- Interactive Linear Algebra: Diagonalization, for the role of an eigenvector basis.
- Stephen Boyd, Stanford EE263: Eigenvectors and Diagonalization, for repeated transformations and discrete-time stability, especially slide 11–34.