II.17 · Linear Algebra
Which input directions survive a transformation on their original line?
Drag a nonzero vector and compare it with its image. Discover stretching, reversal and collapse, then contrast a scalar map, a defective shear and a rotation with no real eigenvector.
Discover the directions that stay on their line
Find an input line that survives A
Two distinct real eigenvalues give two independent eigen-directions. This chosen input leaves its original line.
- Real eigen-directions
- distinct
- Trace
- 1
- Exact characteristic discriminant
- 9
- Chosen nonzero eigenvector gain
- undefinedAv is not a scalar multiple of v.
- Eigenvalue
- 2
- Numerical eigenpair residual
- 0
- Eigenvalue
- −1
- Numerical eigenpair residual
- 0
Exact values use =; numerical companions use ≈. Rank and zero decisions are exact.
Two distinct real eigenvalues give two independent eigen-directions. This chosen input leaves its original line.
Derive the characteristic equation
Subtract λ on the diagonal and expand the determinant. The discriminant classifies real roots exactly. A = [2, 0; 0, −1].
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
Try aligning the input with each dashed eigen-line. In Stretch and reversal, compare the positive and negative gains. Then choose Quarter-turn: no real direction. Every nonzero input turns away from its original line; the absence of a real eigenvector is a mathematical result, not an unfinished drawing.
Intuition: special directions simplify repeated action
Most vectors change both length and direction under a matrix. Some remain on the same line through the origin. Along such a direction, the full matrix acts like one scalar: stretch, reverse or collapse. Repeating the map multiplies that scalar repeatedly, which can explain growth and decay without multiplying the full matrix at every step.
Staying on the same line allows reversal; it does not require pointing the same way. A negative gain is therefore as meaningful as a positive one.
Definition
For square , an eigenvector is a nonzero vector such that
The scalar is its eigenvalue. Positive preserves its orientation, negative reverses it, and collapses the direction into the origin. The zero vector satisfies the equation for every scalar but is excluded: it identifies no direction.
All vectors associated with one eigenvalue, together with zero, form its eigenspace . A basis of that space counts independent eigen-directions; scaling an eigenvector does not create a new independent direction.
Mechanics: test a vector, then inspect the spectrum
The entered vector and its image are calculated exactly from the same rational matrix. Exact collinearity certifies whether it is an eigenvector; when it is, the inspector derives the exact scalar gain. The dashed spectral lines use checked numerical unit-vector companions. They are approximate drawings of the eigenspaces, not proofs from pixels.
Edit all four matrix entries or the input components, drag the vector, or use arrow keys. The live trace derives the characteristic equation and replays four exact applications of the current map. The worked trace below retains the canonical example. Numeric controls accept two decimal places in and reject invalid input.
Derivation: why the characteristic equation appears
Rearrange the definition as . A nonzero null vector exists exactly when is singular. Thus
For this expands to
Write , and . When the roots are . Exact rational arithmetic decides the sign of ; the existing radical representation preserves simple exact roots. A numerical approximation is labeled , and its eigenpair residual is checked separately.
Worked examples
For , the characteristic polynomial is . The x-axis stretches by , while the y-axis reverses by . Starting with , repeated applications give , , and . The x-component grows; the y-component alternates.
Replay the worked derivation
Derive the characteristic equation
Subtract λ on the diagonal and expand the determinant. The discriminant classifies real roots exactly. A = [2, 0; 0, −1].
For , the roots are . The positive eigen-direction satisfies . The lesson retains the exact radical eigenvalues and shows approximate normalized directions with residuals; it does not invent rational eigenvectors for irrational directions.
Repeated roots: scalar versus defective
The matrix has eigenvalue repeated twice, and every nonzero input is an eigenvector. Any two independent directions can serve as an eigenbasis; the displayed axes are one convenient choice.
By contrast, also has a repeated root, but forces . Only one independent direction exists. This is a defective matrix. Its shear behavior cannot be explained by two independent real eigenvectors; repeated root count is not eigenspace dimension.
No real eigenvector
For the quarter-turn , the characteristic equation is . No real scalar satisfies it. Geometrically, every nonzero vector rotates through a right angle and leaves its original line. Over complex numbers the eigenvalues are . This explains the boundary of the real picture; complex eigenvectors and complex geometry are outside this chapter.
The zero-eigenvalue preset instead has a real nonzero null direction. Collapse is allowed as an eigenvalue behavior; it is the zero input vector that is excluded.
Executable reference code
The pedagogical reference derives exact characteristic coefficients and high-precision real roots. NumPy computes eigenpairs and checks each residual, including a rotation whose spectrum is complex.
"""Read real 2×2 cases from the characteristic equation, with exact rational coefficients."""
from fractions import Fraction as F
from decimal import Decimal, localcontext
def eigenvalues(a):
p,q,r,s = [F(str(x)) for row in a for x in row]
trace, determinant = p+s, p*s-q*r
discriminant = trace*trace-4*determinant
if discriminant < 0:
return 'no real eigenvectors', []
with localcontext() as ctx:
ctx.prec = 50
dec = lambda x: Decimal(x.numerator)/Decimal(x.denominator)
h = dec(discriminant).sqrt()
values = [(dec(trace)+h)/2,(dec(trace)-h)/2]
scalar = q == r == 0 and p == s
kind = 'every nonzero direction' if scalar else 'one direction' if discriminant == 0 else 'two directions'
return kind, values
assert eigenvalues([[2,0],[0,-1]]) == ('two directions',[Decimal(2),Decimal(-1)])
assert eigenvalues([[1,1],[0,1]])[0] == 'one direction'
assert eigenvalues([[2,0],[0,2]])[0] == 'every nonzero direction'
assert eigenvalues([[0,-1],[1,0]])[1] == []import numpy as np
A = np.array([[2.,0.],[0.,-1.]])
values, vectors = np.linalg.eig(A) # Eigenvectors are columns; they must be nonzero.
for value, vector in zip(values, vectors.T):
assert np.linalg.norm(A @ vector-value*vector) < 1e-12
rotation = np.array([[0.,-1.],[1.,0.]])
assert np.all(np.abs(np.linalg.eigvals(rotation).imag) > 0)
# A defective matrix has one independent eigen-direction, despite two repeated roots.Explore
Move the input onto and away from an eigen-line. Reverse it and verify the gain stays the same. Compare the two repeated-root presets. Set the input to zero and read why its gain is undefined. Follow repeated actions for a negative gain, a zero gain and a quarter-turn.
Common mistakes
Eigenvectors need not be unit vectors, and eigenvalues need not be positive. A repeated eigenvalue does not guarantee two independent eigenvectors. A matrix with real entries may have no real eigenvector. The determinant condition finds candidate eigenvalues; finding independent null vectors still determines the eigenspaces.
Numerical considerations
The exact discriminant class is independent of display precision. Numerical companions use binary64 and a residual bound of for unit directions, where is machine epsilon. This conservative rounding envelope is validated independently against Decimal roots and NumPy eigenpairs; it never classifies an exact zero.
The cancellation-prone quadratic root is recovered using . Near defective matrices can have highly sensitive eigendirections even with small residuals. If distinct numerical roots cannot be separated or the residual check fails, the lesson reports a numerical limitation instead of fabricating a direction.
Engineering and ML connections
Eigen-directions describe repeated linear dynamics and stability, and symmetric eigenproblems underlie covariance analysis and PCA. General matrices can have complex or defective spectra, so a real eigenbasis is not universal. SVD will provide an orthogonal input/output decomposition for every real matrix, using distinct left and right directions.
Exercises
Summary and checkpoints
Test with , derive the characteristic polynomial, distinguish eigenvalue multiplicity from eigenspace dimension, and explain reversal, collapse, repeated action and absence of real eigenvectors.