Directions a matrix only stretches
Lesson 3.2.2 showed that a matrix moves almost every vector to a new direction. A few directions are special: the matrix only stretches them. This lesson finds them.
Take the symmetric matrix of lesson 3.2.3,
and see where it sends a few vectors:
The vector lands on , a new direction. But lands on : the same direction, three times as long. Every point of that line does the same, such as and .
On the line through , changes nothing at all: lands on itself, and so does .
Rule: Eigenvector and eigenvalue
A nonzero vector with is an eigenvector of the square matrix , and the number (lambda) is its eigenvalue. keeps the line through and multiplies every vector on it by .
So has the eigenvector with eigenvalue 3, and with eigenvalue 1. "Eigen" is German for "own": these are the matrix's own directions.
The eigenvalue says what happens along the line:
- stretches it, shrinks it, and leaves it alone.
- reverses it, and stretches or shrinks by .
- squashes the whole line onto .
The zero vector never counts, because for every . Any nonzero multiple of an eigenvector is an eigenvector with the same , so an eigenvector is really a whole line, an eigenvector line.
An eigenvalue is a scale factor, so it has the units of the entries of . Here those are plain numbers; in case study 3.6.5 the entries are variances, and so are the eigenvalues.
turns through 26.6°, but it keeps the two dashed lines. Along one it stretches by 3, along the other by 1.
The explorer starts on , with its two eigenvector lines dashed, and the last line of its readout lists the eigenvalues, 3 and 1. Drag the probe from onto : the readout says is an eigenvector, stretched by 3.
Try , then press Shear and Rotate 90°. Count the dashed lines that remain, and read the eigenvalues each time.
Explore
Pick a matrix or set its entries. Its first column is where e₁ lands and its second where e₂ lands; the whole grid follows. Then drag the probe x and look for directions that A only stretches.
- Matrix
- Columns
- Ae₁ = (2, 1), Ae₂ = (1, 2)
- det A
- 2 × 2 − 1 × 1 = 3: every area is multiplied by 3.
- Probe
- Ax = (4, 5): a different direction.
- Eigenvalues
- λ = 3 and 1
Try it
The loop rebuilds the table. The last column tests whether lies on the line through .
The test is , where . That is the determinant of the matrix with columns and (lesson 3.4.1): 0 exactly when the parallelogram they span is flat.
Finding the eigenvalues
Start from . Write as , since (lesson 3.2.3), and move it to the left: .
So must send a nonzero vector to . A matrix that does that flattens the plane, so its determinant is 0 (lesson 3.4.1). That gives an equation for alone.
Rule: The eigenvalue equation
is an eigenvalue of exactly when is singular. subtracts from the diagonal entries only.
For a matrix with entries , , , , multiply out the determinant:
This quadratic in is the characteristic polynomial of . Its roots are the eigenvalues: factorise it, or use the quadratic formula of lesson 1.2.2.
Example 1. For , the polynomial is . So the eigenvalues are 3 and 1, the stretch factors of the table.
A table of shows the same roots:
| 0 | 1 | 2 | 3 | 4 | |
|---|---|---|---|---|---|
| 3 | 0 | 0 | 3 |
At , has determinant , not 0. So no vector is doubled by .
Example 2. Take
Its polynomial is . The eigenvalues are 4 and .
Try it
The loop prints for the table. Then each polynomial is built from the coefficients , and .
np.roots (lesson 1.3.1) finds the roots of a polynomial from its coefficients. They are sorted, largest first.
Finding the eigenvectors
With an eigenvalue in hand, solve . Because is singular, its two rows are multiples of each other, and only one equation is left.
One equation in two unknowns has one free variable, so its solutions form a line through (lesson 3.3.2). That line is the null space of (lesson 3.5.1), and every nonzero point on it is an eigenvector.
| matrix | equation | eigenvector | ||
|---|---|---|---|---|
| 3 | ||||
| 1 | ||||
| 4 | ||||
Check by multiplying: . And : the line through is reversed, as an eigenvalue of says.
Rule: Eigenvectors of a 2 × 2 matrix
Row 1 of is , and solves it. If that gives , use row 2, , the same way: .
For with the shortcut gives ; with it gives , a multiple of .
The two eigenvectors of are not perpendicular: (lesson 3.1.2). Those of are, since . Lesson 3.6.3 shows that every symmetric matrix has perpendicular eigenvectors.
Try it
eigenvector_2x2 is the shortcut. Each line prints , , and ; the last two always match.
The last line prints the two dot products.
Trace and determinant
The trace of a square matrix, , is the sum of its diagonal entries: for a matrix. So the characteristic polynomial is .
If its roots are and , it also equals . Matching the two forms gives a check on any answer.
Rule: Trace and determinant
The eigenvalues add up to the trace and multiply to the determinant. The same holds for an matrix, with all eigenvalues and a repeated one counted twice; lesson 3.6.3 checks a one.
| matrix | eigenvalues | sum | product | ||
|---|---|---|---|---|---|
| 4 | 3 | 3 and 1 | 4 | 3 | |
| 3 | 4 and | 3 | |||
| 2 | 0 | 2 and 0 | 2 | 0 |
The product is the area factor of lesson 3.4.1. stretches by 3 along one eigenvector line and by 1 along the other, so it multiplies every area by 3. A negative product, as for , means one line is reversed: the plane is flipped.
A zero eigenvalue. , so one eigenvalue of the singular matrix (lesson 3.2.3) is 0, and the other is the trace, 2. Its eigenvectors are , sent to , and , sent to : the direction that flattens.
Try it
np.linalg.eig(M).eigenvalues lists the eigenvalues; the last section of this lesson explains eig. .real drops a zero imaginary part that some NumPy versions add, and the values are sorted and rounded.
Each line prints the trace, the determinant, the eigenvalues, their sum and their product. The last line maps and by .
Repeated and complex eigenvalues
The characteristic polynomial is a quadratic, so its discriminant (lesson 1.2.2) sorts the cases. Here it is .
Rule: Three cases for a 2 × 2 matrix
For the discriminant is : two real eigenvalues. A repeated eigenvalue can come with one eigenvector line or with every line; a complex pair comes with no real line at all.
One eigenvalue, twice
The shear of lesson 3.2.2, , has polynomial , so twice. Then says only : the -axis. The shear has one eigenvector line, and every other direction leans over.
is triangular: every entry on one side of its diagonal, here below it, is 0. The determinant of a triangular matrix is the product of its diagonal (lesson 3.4.1), so its eigenvalues are its diagonal entries.
A repeated eigenvalue can also keep every direction. has polynomial too, but is the zero matrix, so every nonzero vector is an eigenvector: stretches the whole plane evenly.
No real direction: rotations
The quarter turn has trace 0 and determinant 1, so its polynomial is . That has no real root: every vector turns through 90°, so no line is kept.
With complex numbers (lesson 1.7.2), has the roots and . Multiplying by is a quarter turn, which is exactly what does.
A turn through any angle has trace and determinant . Its eigenvalues are (lesson 1.7.3): the angle of the turn is the angle of the eigenvalues. For 30° they are .
Complex eigenvalues of a real matrix always come as a conjugate pair, like the roots of a real quadratic (lesson 1.7.2). A turn has real eigenvalues only at 0°, where it is , and at 180°, where it is .
Try it
The eigenvalues print as complex numbers for every matrix here, so the real ones show +0.j. The discriminant is 0 for the shear and for , and negative for both turns.
The shear's two eigenvector columns, with signs fixed, are both : one line only. The last line is , the turn through 30°.
Eigenvalues in NumPy
np.linalg.eig(A) returns the eigenvalues of , and a matrix whose columns are eigenvectors: column goes with eigenvalue . Each column has length 1.
Three habits make its answers safe to print and compare:
- Fix the order.
eiglists the eigenvalues in no particular order, so sort them, largest first, and reorder the columns to match. - Fix the sign. An eigenvector line has two directions of length 1, and another computer may return . Flip each column so that, say, its first entry is positive.
- Real or complex. Depending on the NumPy version, real eigenvalues may come back as complex numbers such as
3+0j. When you know they are real,.realgives plain numbers.
For the columns are and : the eigenvectors and , scaled to length 1, since . For they are , which is scaled, and .
Dividing each column by its first entry gives for , half of . Lesson 3.6.2 puts these columns side by side to compute powers of , and case study 3.6.5 finds them for a covariance matrix.
Try it
The cell fixes the order and the signs, then checks for every column at once. V * values multiplies column by eigenvalue .
The last array divides each column by its first entry.
Common mistakes
- The zero vector is never an eigenvector, but 0 can be an eigenvalue: sends to .
- Subtract on the diagonal only. changes and , not and .
- An eigenvector is a line. , and are the same answer for ; check by multiplying, not by matching numbers.
- The diagonal entries are the eigenvalues only for a triangular matrix. has 2 and 2 on its diagonal, but eigenvalues 3 and 1.
- A repeated eigenvalue may have only one line. The shear keeps just the -axis.
- No real root does not mean no eigenvalues. A turn has a complex pair, , and no real eigenvector line.
eigreturns eigenvectors as columns, in no fixed order and with either sign. Sort, fix the signs, and use.realwhen the values are real.
Eigenvalues and eigenvectors
0 of 12 correct
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
How to type answers
- Powers with
^:x^7,2^(1/3),a^-2. - Multiply with
*or by writing side by side:3x^2,2(x+1). ln(x)is the natural log,log(x, 2)is log base 2,eis Euler's number,sqrt(x)is a square root.sin(x),cos(x)andtan(x)take radians; writepifor π andsin(x)^2for sin²x.- Your first answer to each question is saved: it counts towards your score and brings the question back for review.
- Exact answers like
ln(20)/ln(3)are best. Decimals need about 4 significant figures.
Summary card
- An eigenvector of is a nonzero with : a line that keeps, stretched by the eigenvalue . A negative reverses the line, and squashes it to .
- The eigenvalues solve . For this is , the characteristic polynomial.
- The eigenvectors of solve : a line through . For , unless that is .
- and ; a zero eigenvalue means is singular.
- A repeated eigenvalue may keep one line (the shear) or every line (). A turn through has the complex pair and keeps no real line.
np.linalg.eigreturns eigenvectors as columns of length 1, in no fixed order and with either sign. Sort them, fix the signs, and use.realfor real values.