A matrix is a machine that moves space: it stretches, squashes and turns. This unit asks two simple questions about any such machine. How much does it grow areas? That one number is the determinant. Which directions does it only stretch, and never turn? Those are the eigenvectors. Find them, and even a messy matrix becomes three easy moves: turn, stretch, turn back. That idea runs PCA, SVD and much of machine learning.
≈ 55 min read + play8 interactive widgets · 6 in 3D13 inline checks9 derived proofs✍ 5 solved practice problems
drag the ellipsoid to orbit
1
What survives the machine?
Imagine this
You open a photo on your phone and pull it wider with two fingers. Every face in it changes shape. Every point moves.
Still, two questions have clean answers. How much bigger did the photo get? And was there a direction that only got longer, without turning? Yes: the direction you pulled in.
This whole unit is those two questions, asked of a matrix.
In Unit 1, a matrix was a machine that moves every point of space. It stretches, squashes, slants and turns. Real data gives you big matrices with thousands of numbers inside. We want a few simple facts that sum up the whole machine.
There are two kinds of such facts:
#Numbers that describe the whole motion at once. The determinant says how much areas grow. The trace is a quick pulse check.
↗Directions that the machine only stretches and never turns. These are the eigenvectors. Each one comes with its own stretch number, the eigenvalueλ (read it: "lambda").
Here is the path, one step at a time:
①The determinant — how much a matrix grows areas, with an alarm bell at zero. (Sections 2–3)
②The trace — add up the diagonal. Cheap, and secretly useful. (Section 4)
③Eigenvectors — the directions a matrix cannot turn, and a recipe to find them. (Sections 5–6)
④The Spectral Theorem — every symmetric matrix is just turn, stretch, turn back. (Sections 7–8)
⑤Three extras — matrices that only turn, the "square root" of a matrix, and the fine print. (Sections 9–11)
Why ML cares PCA looks for the few directions in which your data spreads the most. Those directions are eigenvectors. By the end of this unit, the formula A=QΛQ⊤ will read like a plain sentence.
In one sentence: a matrix moves everything, but it has simple fingerprints: one number for how much it grows space, and special directions it only stretches.
2
The determinant — how much a matrix grows area
Imagine this
You roll a ball of dough into a roti. Before rolling, you mark a small square on the dough. After rolling, that square covers twice the area. So does every other square you marked. The whole roti grew by ×2.
Now flip the roti over on the tawa. Same size, but the other side faces up. And if you roll one way far too hard, the dough becomes a thin string. Its area is zero, and you can never roll it back.
Grow, flip, or squash flat. That is everything the determinant tells you.
A matrix does the same thing to the flat plane. Start with the unit square: the 1-by-1 tile with one corner at the origin. Feed every point of it through the matrix A. It comes out as a slanted tile, a parallelogram.
Which parallelogram? Remember Unit 1: the columns of A are where the two edges of the square land. So the new tile has the two columns of A as its sides.
The determinant is the area of that new tile, with a sign attached. For a 2×2 matrix it is one short formula:
det[acbd]=ad−bc
Try it on A=[2111.5]: detA=(2)(1.5)−(1)(1)=3−1=2. So this machine doubles every area. The square of area 1 becomes a tile of area 2. A shape of area 5 becomes area 10.
That one number tells you three things:
Look at
In everyday words
In symbols
Its size
How much every area grows. det=2 doubles areas. det=21 halves them.
area factor =∣detA∣
Its sign
A minus sign means the tile got flipped over, like the roti on the tawa. The size still grows by ∣detA∣.
detA<0
Zero
The alarm bell. The tile is squashed flat onto a line. Nothing can undo that, so A has no inverse.
detA=0⟺rankA<n
Keep this in mind the "squashed flat" alarm is exactly the tool that will find eigenvalues in Section 6.
The area machineA presses the square tile into a new shape · det = the new area
Try press ▶ to watch the tile grow, slide, flip and squash. Then drag the glowing tip of a₂ across a₁: the tile flips over the moment it passes flat.
✋ drag the glowing tips a₁ and a₂ — they are the columns of A · drag anywhere else to orbit
drag a glowing tip to reshape · drag elsewhere to orbit
A =2111.5
ad − bc = (2)(1.5) − (1)(1) = 2
det A = 2area × 2
—
The dashed square is the tile before the machine. The floor grid bends too: every small square grows by the same factor. Orange means flipped over; red means squashed flat.
The realization
detA is the area of the tile that the unit square becomes. Its size says how much every area grows. A minus sign means the tile was flipped over. Zero means it was squashed flat, and then nothing can undo A.
Pause & predict
A matrix has detA=−3. What does it do to a shape of area 5?
Pause & predict
In the widget, the ones button sets both columns to (1,1). What is detA, and what does it mean?
In one sentence: the determinant is the signed area of the tile the unit square becomes: its size is the growth, a minus means flipped, and zero means squashed flat for good.
3
Computing it — small pieces and the lazy row
Imagine this
You know how to find a 2×2 determinant: ad−bc. Now someone hands you a 3×3 matrix. Don't panic.
It is like a big restaurant bill for three tables. You don't add it all in one go. You add up each table's small bill, then combine the three. A 3×3 determinant is three small 2×2 determinants, each with a weight and a + or − sign.
Here is the recipe, going along the first row:
1Pick one entry of the row, say a11 (row 1, column 1).
2Cover up its row and its column. A small 2×2 matrix is left. Its determinant is called the minorM11.
3Give it a sign from the checkerboard below: + in the top-left corner, then − and + taking turns. The signed minor is the cofactorC11.
4Multiply the entry by its cofactor. Do the same for every entry of the row. Add the answers.
In symbols, going along row i:
detA=j=1∑naijCij,Cij=(−1)i+jMij
One example, slowly. Take the matrix used in the widget below, A=3−251−4403−2. Go along row 1:
The surprise: you may go along any row or any column, and the answer is always the same. So be lazy. Pick the line with the most zeros. A zero entry makes its whole term zero, so you skip it. Above, the 0 in row 1 saved us one small determinant.
The cofactor checkerboard. The sign never depends on the entries — only on the position(i,j).
One determinant, six roadsexpand along any row or column · tap a term to see its small 2×2 piece
Try row 1, then row 2. Same answer, but row 1 gets one term for free because of its 0. Then show the + − checkerboard.
A =
Tap a term. Its row and column go dim. What stays bright is its 2×2 minor.
det A = −1every road gives −1
Two moves that make it faster
For big matrices there is a quicker way, using Unit 1's row moves. Two facts make it work:
⇄Swap two rows → the determinant changes sign. The tile gets flipped over, like a mirror image.
↗Add a multiple of one row to another → nothing changes at all. The tile only slides, like pushing a deck of cards sideways. Same base, same height, same area.
Since detA⊤=detA, the same is true for columns, and columns are easier to draw. Here are both moves on a 3D box:
Swap and slidethe columns of A make a box · det is its volume, with a sign
drag the picture to orbit
The columns a1=(2,1,0), a2=(1,1.5,0), a3=(0,0,1) make a box of volume 2. Swap the first two: the same box, but mirror-imaged, so the signed volume is −2 (it glows orange). Slide: add a1 to a2. The box leans over, but its base and height stay the same, so the volume is still 2: (2)(2.5)−(1)(3)=2.
So you can run Unit 1's elimination. Turn A into a triangle U (all zeros below the diagonal). Then just multiply the diagonal, and flip the sign once for every row swap you made:
detA=(−1)su11u22⋯unn(s=number of row swaps)
Quick example: [2415]. Take 2 × row 1 away from row 2 to get [2013]. No swaps, so det=2×3=6. Check with the formula: 10−4=6 ✓.
Handy rule
In everyday words
det(AB)=detA⋅detB
Two machines in a row: their growth factors multiply.
detA⊤=detA
Flipping the matrix over its diagonal keeps the area.
detA−1=1/detA
The undo machine shrinks things back by the same factor.
triangular A
The determinant is the product of the diagonal.
If you want the algebra · why a triangle's determinant is its diagonal, and why sliding changes nothing
Prove it · why a triangle's determinant is its diagonal product — derived
Claim. If U is upper triangular (all zeros below the diagonal), then detU=u11u22⋯unn.
1
Expand along the first column. Below u11 that column is all zeros, so only one term survives:
detU=i=1∑nui1Ci1=u11C11+0+⋯+0=u11(−1)1+1M11=u11M11Every other term has a factor ui1=0 (i≥2). The sign of C11 is (−1)2=+1.
2
Look at what M11 is: delete row 1 and column 1 of U. What remains is an (n−1)×(n−1) matrix that is still upper triangular, with diagonal u22,…,unn.
Deleting the first row and column keeps every remaining entry in its relative position — zeros below the diagonal stay below the diagonal.
3
Apply step 1 to that smaller triangle, then again, and again:
detU=u11M11=u11u22M11′=⋯=u11u22⋯un−1,n−1det[unn]Each round peels one diagonal entry off the front and leaves a triangle one size smaller.
4
The 1×1 determinant is the entry itself, det[unn]=unn. Hence detU=u11u22⋯unn. Done. ∎For a lower triangle run the same argument along the first row (or use detL=detL⊤). Diagonal matrices are both, so their determinant is the diagonal product too.
Why does adding a row to another leave det unchanged? Expand the new determinant. It splits into the old detA plus c times a determinant with two equal rows. Swap those two equal rows: the determinant must change sign, yet the matrix is the same. A number equal to its own negative is 0. So the extra piece is 0, and det survives elimination.
Full rank ⟺ det ≠ 0. Eliminate A down to U. Full rank means every column has a pivot, so every uii=0, so detA=±∏uii=0. And the other way round: detA=0 forces every uii=0, so all pivots are there and only x=0 solves Ax=0. Hold this thought: in Section 6, eigenvalues appear exactly where A−λI loses full rank, and det(A−λI)=0 is how we catch that.
The realization
A big determinant is a sum of small ones: entry × sign × minor, along any row or column. Pick the line with the most zeros. For big matrices, eliminate down to a triangle and multiply the diagonal. Every road gives the same number.
Pause & predict
The widget's matrix has one zero, at a13 (row 1, column 3). Which roads take the least work?
In one sentence: break a big determinant into small signed pieces along the laziest line, or eliminate to a triangle and multiply the diagonal.
4
The trace — a quick pulse check
Imagine this
At a clinic, the nurse checks your pulse before anything else. It takes ten seconds and costs nothing. It does not tell the whole story. But it tells a lot, and it catches mistakes early.
The trace is the pulse check of a matrix. Just add the numbers on the diagonal, from top-left to bottom-right:
tr(A)=a11+a22+⋯+ann
Example: tr[1562]=1+2=3. The 6 and the 5 are simply ignored.
The trace follows easy rules:
Rule
In everyday words
tr(A+B)=trA+trB
Add the matrices first or add the traces later: same answer.
tr(αA)=αtrA
Scale the matrix, and the trace scales too.
tr(In)=n
The identity has n ones on its diagonal.
tr(AB)=tr(BA)
The order of a product does not matter to the trace. This even works when AB and BA are different sizes.
The last rule (the cyclic property) is the surprising one. Try it with a row A=[12] and a column B=[34]:
AB=[1⋅3+2⋅4]=[11],BA=[3468],tr(BA)=3+8=11
A 1×1 matrix and a 2×2 matrix, with the same trace. Many machine-learning formulas are simplified with exactly this shuffle.
Why give a whole section to such a cheap number? Because of a fact we will meet in Section 6: the trace is the sum of the eigenvalues, and the determinant is their product. Two numbers you can read in seconds already know something about eigenvalues you have not found yet.
If you want the algebra · why tr(AB) = tr(BA), even for different sizes
Prove it · why tr(AB) = tr(BA) — derived
Claim. For A of size m×n and B of size n×m (so both products exist), tr(AB)=tr(BA) — even though AB is m×m and BA is n×n.
1
Write one diagonal entry of AB with the row-times-column rule:
(AB)ii=k=1∑naikbkiRow i of A dotted with column i of B. The index k runs over the inner dimension n.
2
Add the diagonal entries to get the trace — a double sum:
tr(AB)=i=1∑mk=1∑naikbkiJust the definition of trace applied to step 1. Every term is one product aikbki.
3
Do the same for BA, whose diagonal entries are (BA)kk=∑i=1mbkiaik:
tr(BA)=k=1∑ni=1∑mbkiaikRow k of B dotted with column k of A; now the inner index is i, running to m.
4
Compare: both are the sum of the same mn numbers aikbki, listed in a different order. Finite sums don't care about order, so tr(AB)=tr(BA). Done. ∎bkiaik=aikbki because scalars commute; swapping the two ∑ signs is just re-grouping the same list of products. Nothing about the sizes m,n ever mattered.
The realization
trA is the sum of the diagonal. It ignores everything off the diagonal, and tr(AB)=tr(BA) always. Soon you will see it is also the sum of the eigenvalues.
Pause & predict
A is 2×5 and B is 5×2. So AB is 2×2, but BA is 5×5. What about their traces?
In one sentence: the trace adds up the diagonal, ignores the order of a product, and turns out to be the sum of the eigenvalues.
5
Eigenvectors — the directions a matrix cannot turn
Imagine this
Before rolling a roti, draw a few arrows on the dough with a knife tip. Now roll only forwards and backwards.
Look at the arrows afterwards. Most of them now point a slightly different way: they got tilted. But the arrow drawn along the rolling direction still points the same way. It just got longer. And the arrow drawn straight across also kept its direction.
Those two special arrows are what this section is about.
A matrix knocks almost every arrow off its line. But a few special arrows only get stretched, shrunk or flipped along their own line. These are the eigenvectors ("eigen" is German for "own": the matrix's own directions). The stretch number is the eigenvalueλ.
Ax=λx(x=0)
Read it: "A times x is just a number times x." On this one arrow, the whole matrix acts like plain multiplication by λ. What the number tells you:
>1λ>1: the arrow gets longer, like the rolling direction.
<10<λ<1: the arrow gets shorter.
1λ=1: the arrow is left exactly as it was, like the axis of a spinning globe.
0λ=0: the arrow is squashed to nothing.
−λ<0: the arrow flips to point backwards, then stretches by ∣λ∣.
Two small rules. The zero arrow does not count, because A0=λ0 is true for every λ and tells us nothing. And if x works, so does 2x or −5x. So an eigenvector is really a whole direction: a line that the matrix keeps.
Checking a guess takes one multiplication. Take A=[1562] and the arrow u=(6,−5):
Au=[1(6)+6(−5)5(6)+2(−5)]=[−2420]=−4[6−5]
The answer is −4 times u. So u is an eigenvector with λ=−4: flipped backwards and made 4 times longer, but still on its own line. Now try v=(3,−2): Av=(−9,11). That is not a multiple of (3,−2), so v is not an eigenvector. Go hunting yourself:
The resonance findermove the gold arrow x · when Ax lands on the same line, you found an eigen-direction
Try sweep x slowly around the circle and find both hidden directions of the first matrix. Then open rotation: nothing lines up anywhere.
✋ drag on the floor — the gold arrow follows your pointer · press ↻ to spin the view instead
drag on the floor to move the arrow · ↻ spins the view
alignment = —λ ≈ —found 0/2
—
Gold is your arrow x. Blue is where A sends it. The wall of light is tallest where Ax lines up with x, and every line you find stays drawn.
Notice this
On the symmetric matrix, the two directions you find are at a right angle. They also sit exactly on the long and short axes of the blue oval. That is no accident. Section 7 turns it into a theorem.
On the rotation, nothing ever lines up. A merry-go-round leaves no direction alone. Section 9 solves that mystery.
The realization
An eigenvector is an arrow that A only stretches: Ax=λx. The stretch number λ is its eigenvalue. To test a guess, multiply once and check if the answer is a multiple of the arrow.
Pause & predict
For A=[1562], one multiplication gives A[11]=[77]. What did we just learn?
Pause & predict
In the widget, the shear[1011] lines up along just one line, the x-axis. How many independent eigen-directions does it have?
In one sentence: an eigenvector is a direction the matrix only stretches, and its eigenvalue says by how much: Ax=λx.
6
Hunting eigenvalues — the characteristic equation
Imagine this
An old radio has a tuning dial. Turn it slowly: hiss, hiss, hiss… then, at one exact spot, a clear station. Turn a little more: hiss again. Then another station.
Finding eigenvalues works the same way. The dial is the number λ. At most settings nothing happens. At a few exact settings, something "clicks". Those settings are the eigenvalues.
What exactly clicks? Move λx to the left side of Ax=λx:
Ax−λx=0⟹(A−λI)x=0
Here A−λI just means: take λ away from every number on the diagonal of A. This new matrix sends a non-zero arrow x to zero. So it squashes space flat. And from Section 2, "squashed flat" means the determinant is zero:
det(A−λI)=0
This is the characteristic equation, our station finder. Its solutions are exactly the eigenvalues. Its left side is a polynomial in λ, called the characteristic polynomialpA(λ).
For a 2×2 matrix it is a quadratic, and it looks very familiar:
pA(λ)=λ2−tr(A)λ+det(A)
The trace and the determinant are its two coefficients! Now the full example, start to finish. For A=[1562]: the trace is 1+2=3 and the determinant is 2−30=−28. So
pA(λ)=λ2−3λ−28=(λ−7)(λ+4)
The stations are λ1=7 and λ2=−4. Now find each direction by solving (A−λI)x=0, just like Unit 1:
7A−7I=[−656−5]. Both rows say x1=x2. So the direction is (1,1).
−4A+4I=[5566]. Both rows say 5x1+6x2=0. So the direction is (6,−5), the u from Section 5.
Notice that in both cases the two rows point along the same line. That is what "squashed flat" looks like in the numbers.
The free check
The eigenvalues always add up to the trace and multiply to the determinant. Here: 7+(−4)=3=trA ✓ and 7×(−4)=−28=detA ✓. Spend five seconds on this every time. It catches mistakes at once.
It also explains the alarm bell one level deeper: detA=0 exactly when some eigenvalue is 0, that is, when some direction gets squashed to nothing.
The eigenvalue dialthe curve is p(λ) = det(A − λI) · eigenvalues sit where it crosses zero
Try press ▶ and watch the small tile of A−λI go flat exactly as the dial passes λ=7 and λ=−4.
A =
tr = 3det = −28Σλ ✓ · Πλ ✓
—
The chips run the free check live: the roots must add to the trace and multiply to the determinant. If the curve never touches zero, the eigenvalues are complex (Section 9).
What "squashed flat" looks like. At an eigenvalue, both rows of A−λI lie on one line. So (A−λI)x=0 is really just one condition: "x is at a right angle to that row". The answers form a line (dashed), and the green eigenvector sits on it.
The recipe card
1Write A−λI: take λ off the diagonal, touch nothing else.
2Solve det(A−λI)=0. The roots are all the eigenvalues.
3For each root λi, solve (A−λiI)x=0 by elimination. The answers form the eigenspaceEλi, the eigen-directions of λi.
4Free check: the roots add up to trA and multiply to detA.
A shortcut worth stealing
A triangular matrix shows its eigenvalues on its diagonal. Why? A−λI is triangular too, and a triangle's determinant is its diagonal product: pA(λ)=(a11−λ)(a22−λ)⋯(ann−λ). So the roots are just a11,a22,…. Two more freebies: A and A⊤ have the same eigenvalues, and every eigenvalue of I is 1.
If you want the algebra · where λ² − tr(A)λ + det A comes from, and why the eigenvalues add to the trace
Prove it · why the 2×2 characteristic polynomial is λ² − tr(A)λ + det A — derived
Claim. For A=[acbd], det(A−λI)=λ2−(a+d)λ+(ad−bc).
1
Subtract λ down the diagonal and apply the 2×2 formula ad−bc:
det[a−λcbd−λ]=(a−λ)(d−λ)−bcThe off-diagonal entries b,c are untouched by the shift — only the diagonal moves.
2
Multiply out the product:
(a−λ)(d−λ)=ad−aλ−dλ+λ2=λ2−(a+d)λ+adFour terms from FOIL; the two λ terms collect into −(a+d)λ.
3
Put the −bc back and name the coefficients:
λ2−(a+d)λ+(ad−bc)=λ2−tr(A)λ+detA. Done. ∎a+d is the trace by definition and ad−bc is the determinant by definition. Check on the lecture's matrix: λ2−3λ−28.
Prove it · why the eigenvalues sum to the trace and multiply to the determinant — derived
Claim. If λ1,λ2 are the roots of pA, then λ1+λ2=trA and λ1λ2=detA.
1
A degree-2 polynomial with roots λ1,λ2 and leading coefficient 1 factors as
pA(λ)=(λ−λ1)(λ−λ2)Plugging in λ=λ1 or λ2 gives 0, and the λ2 coefficient is 1 — matching the box above. (If the roots are complex, this still holds over C.)
2
Expand the factored form:
(λ−λ1)(λ−λ2)=λ2−(λ1+λ2)λ+λ1λ2Same FOIL as before, with the roots in place of a,d.
3
Two ways of writing the same polynomial must have the same coefficients. Compare with λ2−tr(A)λ+detA:
λ1+λ2=trA and λ1λ2=detA. Done. ∎For n×n: pA(λ)=∏i(λi−λ); the λn−1 coefficient of the product is (−1)n−1∑iλi, which must equal (−1)n−1trA; and setting λ=0 gives ∏iλi=pA(0)=detA. Same idea, more terms.
The realization
det(A−λI)=0
An eigenvalue is a setting of the dial λ where A−λI squashes space flat. Solve this equation for the eigenvalues, then solve (A−λI)x=0 for the directions. Check: sum = trace, product = determinant.
Pause & predict
No pencil allowed: what are the eigenvalues of [5073]?
Pause & predict
A classmate works out the eigenvalues of [1562] (trace 3, det −28) and says λ=6 and −3. Your ten-second verdict?
In one sentence: eigenvalues are the values of λ where det(A−λI)=0; they always add up to the trace and multiply to the determinant.
7
The Spectral Theorem — symmetric matrices come apart cleanly
Imagine this
Tear a sheet of newspaper from top to bottom. It rips in a clean, straight line. Now tear it from side to side. The rip wanders all over.
The paper has a hidden grain, set when it was made in the factory. The grain has two directions at a right angle: an easy one and a hard one. You cannot see them, but they control everything.
Symmetric matrices have a hidden grain too.
A matrix is symmetric if it looks the same after flipping it over its diagonal: A=A⊤. For example [2112]. Why care? Almost every matrix machine learning builds from data is symmetric: covariance matrices, A⊤A, kernel matrices. So this is not a special case. It is the case you will meet most.
The Spectral Theorem makes three promises about any symmetric matrix:
The promise
In everyday words
① Real eigenvalues
Every stretch number is an ordinary real number. No complex numbers, ever.
② Right angles
Eigen-directions with different eigenvalues are at a right angle to each other: the grain.
③ Enough of them
There are always enough eigen-directions to make a full square grid of the space.
Put the grain directions (each of length 1) as the columns of a matrix Q, and the stretch numbers on the diagonal of Λ (read it: "capital lambda"). Then
A=QΛQ⊤
Read it from right to left, as three easy moves:
1Q⊤: turn the space so the grain lines up with the axes. Like Unit 3's stiff turns, it changes no length.
2Λ: stretch along each axis by its own λ. Just numbers on a diagonal.
3Q: turn back.
So every symmetric matrix is just turn, stretch, turn back. And turning back is easy, because for such a Q the inverse is simply the flip: Q−1=Q⊤.
The worked example: A=[2112]. Trace 4, determinant 3, so pA(λ)=λ2−4λ+3=(λ−3)(λ−1). The eigenvalues are 3 and 1. Their directions are (1,1) and (−1,1): at a right angle, as promised. Shrink each to length 1:
Multiply back and you get QΛQ⊤=[2112] ✓. Watch the three moves happen:
Turn · stretch · turn backA = QΛQᵀ acted out on a ring of beads · drag the gold arrow
Try press ▶ and follow the bright bead: it turns, slides out along the grain, and turns back. Then drag x onto the q₁ line and play again: x just ends up 3 times longer.
✋ drag the gold tip to choose x · drag anywhere else to orbit
drag the gold tip to choose x · drag elsewhere to orbit
QΛQᵀx = Ax ✓ — three simple moves, same answer
The ring of beads is every direction at once. The two turns keep it a circle. Only the stretch makes it an oval: 3 times longer along q1, unchanged along q2.
Careful: a second ellipse. This one is the set of points where x⊤Ax=1. Along q1 the value grows fastest (λ1=3), so it reaches 1 sooner: the axis is only 1/3 long. Big eigenvalue, short axis. That is the opposite of the widget, where q1 gets stretched by 3.If you want the algebra · why the eigenvalues are real, and why the directions meet at right angles
Prove it · why a symmetric matrix has real eigenvalues — derived
Claim. If A is real and A⊤=A, every eigenvalue of A is a real number.
1
Allow λ and x=0 to be complex for now, with Ax=λx. Multiply on the left by the conjugate-transpose xH=x⊤:
xHAx=λxHxSection 9 introduces xH properly; all we use is that it's a row vector, so both sides are single numbers.
2
The right-hand factor xHx is a positive real number:
xHx=i∑xixi=i∑∣xi∣2>0Each xixi=∣xi∣2≥0, and at least one xi=0 because x=0.
3
The left-hand side s=xHAx equals its own conjugate. Take the conjugate-transpose of the 1×1 "matrix" s:
s=sH=(xHAx)H=xHAH(xH)H=xHAx=sReverse the order and conjugate-transpose each factor (the rule (XYZ)H=ZHYHXH). Then AH=A⊤=A⊤=A because A is real and symmetric. A number equal to its own conjugate is real.
4
Divide step 1 by the positive real number from step 2:
λ=xHxxHAx=positive realreal, so λ is real. ∎The same argument with AH=A (Hermitian) instead of A⊤=A is what Section 9 uses.
Prove it · why eigenvectors of different eigenvalues are perpendicular — derived
Claim. If A⊤=A, Ax=λx, Ay=μy and λ=μ, then y⊤x=0.
1
Start from the number y⊤Ax and evaluate it using x's eigen-equation:
y⊤Ax=y⊤(λx)=λy⊤xReplace Ax by λx, then pull the scalar out front.
2
Evaluate the same number using y's eigen-equation instead. First move A onto y:
y⊤Ax=(A⊤y)⊤x=(Ay)⊤x=(μy)⊤x=μy⊤xy⊤A=(A⊤y)⊤ is the transpose rule; A⊤=A is the only place symmetry is used.
3
Subtract the two expressions for the same number:
λy⊤x−μy⊤x=(λ−μ)y⊤x=0Steps 1 and 2 both equal y⊤Ax, so their difference is zero.
4
Since λ−μ=0, divide by it: y⊤x=0 — perpendicular. ∎A product of two numbers is zero only if one of them is; the first factor isn't. With a repeated eigenvalue the eigenspace has extra dimensions, and Gram–Schmidt (Unit 3) builds an orthonormal basis inside it. The one fact we take on faith is that for symmetric matrices those dimensions always add up to n — no direction goes missing.
Where it powers ML
PCA: the main directions of a data set are the eigenvectors of its covariance matrix. Each eigenvalue says how much the data spreads along its direction. Keep the top few, and you compress the data while losing the least (Units 12–13). SVD: apply this theorem to A⊤A and AA⊤ and you can break down any matrix (Unit 5). Shapes:x⊤Ax=c draws an ellipse or ellipsoid whose axes are the eigenvectors, like the figure above.
The realization
A=QΛQ⊤
A symmetric matrix is: turn into the grain, stretch each grain direction by its λ, turn back. Its eigenvalues are real, its eigen-directions are at right angles, and undoing Q is just flipping it.
Pause & predict
In A=QΛQ⊤ we used Q⊤, where normally we would need the inverse Q−1. Why is that allowed here?
In one sentence: every symmetric matrix has a hidden right-angle grain, so it is just turn, stretch along the grain, turn back: A=QΛQ⊤.
8
The theorem in 3D — a ball becomes an egg
Imagine this
Squeeze a round ball of clay with your hands. It becomes an egg shape, like a rugby ball: long one way, medium another way, short the third way.
Those three ways are at right angles to each other. They are the grain of your squeeze.
Everything from Section 7 works in 3D. A symmetric 3×3 matrix has three real eigenvalues and three eigen-directions, all at right angles. Feed it the round ball of all length-1 arrows. Out comes an ellipsoid (an egg shape). Its three axes lie along the three grain directions, with lengths ∣λ1∣, ∣λ2∣, ∣λ3∣.
The volume grows by the product of the three stretches, which is the determinant again: ∣detA∣=∣λ1λ2λ3∣. For example, stretches 3, 1.5 and 0.6 give detA=3×1.5×0.6=2.7. And if one λ is 0, the egg is pressed flat into a disc: detA=0, Section 2's alarm.
Why ML cares a covariance matrix is exactly such a symmetric A. Its ellipsoid is the shape of your data cloud, and its axes are the principal components.
The eigen-ellipsoidslide the three stretch numbers · drag to orbit
Try slide λ₃ to 0: the egg flattens into a disc. Watch the nine numbers of A all change while the three tilted axes never move.
✋ drag to orbit the scene
drag the picture to orbit
A = QΛQᵀ =
det = λ₁λ₂λ₃ = 2.7volume × 2.7
—
The axes are tilted on purpose: a symmetric matrix carries its own private right-angle axes. Its nine numbers look messy, but the three λ's are the simple truth underneath.
The realization
A symmetric 3×3 matrix turns the round ball into an egg. The egg's axes are the eigen-directions, their lengths are the ∣λ∣'s, and the volume grows by ∣λ1λ2λ3∣=∣detA∣.
Pause & predict
In the widget, set λ1=3,λ2=1.5,λ3=−2. What happens to the ball's volume and to its handedness?
In one sentence: in 3D a symmetric matrix squeezes the ball into an egg along three right-angle axes, and the volume grows by the product of the three eigenvalues.
9
When nothing lines up — turns and complex eigenvalues
Imagine this
Look up at a ceiling fan. Every blade keeps turning. No blade stays pointing the same way.
A matrix that only turns is like that. It moves every arrow off its line. So in Section 5's widget, the rotation had no eigen-directions at all. Does the eigen-story just break here?
Let's run the recipe anyway, on a turn by the angle θ (read it: "theta"):
Rθ=[cosθsinθ−sinθcosθ],p(λ)=λ2−2cosθλ+1
(The trace is 2cosθ, and the determinant is cos2θ+sin2θ=1.) Take a quarter turn, θ=90∘. Then p(λ)=λ2+1, and we need λ2=−1. No ordinary number squares to −1.
Here is a friendly way to see it. Think of "multiply by i" as "turn by 90°". Do it twice: you have turned by 180°, which just flips an arrow. Flipping is the same as multiplying by −1. So i×i=−1. The number i is a quarter turn.
So the eigenvalues of a quarter turn are λ=±i. They are not nonsense. They are saying exactly "I turn things by 90°". For any angle, the recipe gives
λ=cosθ±isinθ
These are complex numbers: an ordinary part plus an i part. They come as a pair of twins with opposite i parts. Draw them on a plane, with the ordinary part going across and the i part going up. Both twins sit on the circle of radius 1, at the angles θ and −θ. The angle of the eigenvalue is the turn.
Eigenvalues on the unit circleturn the dial θ · watch the two twin eigenvalues move round a circle
Try press ▶. The gold arrow on the turntable turns by θ. The eigenvalue λ₁ on the standing circle climbs by the same angle.
drag the picture to orbit
p(λ) = λ² − 1.64λ + 1λ = 0.82 ± 0.57i
—
At 0° and 180° the twins meet on the flat line, at 1 or at −1. Those are the only turns with real eigen-directions.
Turn and grow at once. An eigenvalue off the circle adds a stretch to the turn. Practice Problem 2 has λ=1±2i. Its size is ∣λ∣=12+22=5≈2.24, and its angle is about 63.4∘. So each step turns by 63.4∘ and grows by 5. Repeat it, and an arrow traces a spiral:
The spiral of λ=1±2i. C=[1−221] has the same eigenvalues as Problem 2's matrix (it is the same machine seen from a different angle). The lengths go 1,5,5,55: the size of λ is the growth, and the angle of λ is the turn.
One repair for complex arrows. For complex arrows, the old length formula breaks. With x=(1+i,2+i), x⊤x=(1+i)2+(2+i)2=3+6i: a "length squared" that is not even a real number. The fix: flip the sign of every i in one copy first. This is the conjugate transposexH. Then xHx=∣1+i∣2+∣2+i∣2=2+5=7, a proper length squared.
With H in place of ⊤, the symmetric story carries over. A matrix with AH=A is called Hermitian, for example [13+i3−i4]. Hermitian matrices have real eigenvalues and right-angle eigen-directions, by the same proofs as Section 7. That is why quantum physics uses them: a measured energy must come out as a real number.
The realization
A pure turn has no real eigen-directions. Its eigenvalues are the twins cosθ±isinθ, which sit on the unit circle. The angle of λ is the turn, and the size of λ is the stretch.
Pause & predict
Set the widget to θ = 90°, the quarter turn [01−10]. What are its eigenvalues?
In one sentence: a matrix that turns has no real eigen-directions, and its complex eigenvalues cosθ±isinθ are the turn written as a number.
10
Cholesky — the square root of a matrix
Imagine this
A cricket video game needs 1000 made-up players. Their heights and weights must look real: taller players are usually heavier.
The game starts with plain random numbers, where height and weight have nothing to do with each other. Plotted, they make a round cloud of dots. Then it bends that cloud with one small matrix L. Out comes a tilted oval cloud, exactly like real players.
That bending matrix L is the "square root" of a matrix.
Every positive number has a square root: 9=3×3. A symmetric positive-definite matrix (Unit 3's kind: all its eigenvalues are positive) has one too:
A=LL⊤
Here L is lower-triangular: zeros above the diagonal, and positive numbers on it. You find its entries one at a time, starting from the top-left corner, like filling in a crossword. For a 2×2 matrix:
ℓ11=a11,ℓ21=ℓ11a21,ℓ22=a22−ℓ212
Example: A=[4223]. Then ℓ11=4=2, ℓ21=2/2=1, and ℓ22=3−1=2. Check by multiplying:
[2102][2012]=[4223]✓
If A is not positive-definite, one of the square roots gets a negative number inside, and the recipe stops. So Cholesky is also the quickest test for "positive-definite": don't hunt for eigenvalues, just try to factor.
Back to the cricket game. Say Σ (read it: "sigma") is the covariance matrix you want: how much heights spread, how much weights spread, and how much they move together. Factor Σ=LL⊤. Draw a round cloud z of plain random numbers. Output x=Lz. The new cloud has covariance exactly Σ. Every simulation library does precisely this.
If you want the algebra · where the recipe comes from, and why Lz has covariance Σ
Prove it · where the 2×2 Cholesky recipe comes from — derived
Claim. If A=[a11a21a21a22] is SPD, then A=LL⊤ with L=[ℓ11ℓ210ℓ22], ℓ11=a11,ℓ21=a21/ℓ11,ℓ22=a22−ℓ212.
1
Multiply out LL⊤ with unknown entries:
[ℓ11ℓ210ℓ22][ℓ110ℓ21ℓ22]=[ℓ112ℓ11ℓ21ℓ11ℓ21ℓ212+ℓ222]Row-times-column, four times. The result is automatically symmetric — which is why this shape can only ever match a symmetric A.
2
Match the top-left entries: ℓ112=a11, so ℓ11=a11.
We take the positive root by convention. It exists because a11=e1⊤Ae1>0 for a positive-definite A.
3
Match the off-diagonal entries: ℓ11ℓ21=a21, so ℓ21=a21/ℓ11.
Division is legal because ℓ11>0 from step 2. This is the only equation that involves ℓ21, so it pins it down.
4
Match the bottom-right entries: ℓ212+ℓ222=a22, so ℓ22=a22−ℓ212. Done. ∎The radicand is a22−a212/a11=detA/a11, which is positive exactly when detA>0 — i.e. when both eigenvalues are positive. A failed square root here is the algorithm detecting "not positive-definite". The n×n recipe repeats this entry by entry, top-left to bottom-right.
Prove it · why Lz has covariance Σ — derived
Claim. If z has mean 0 and covariance I (independent standard normals), and Σ=LL⊤, then x=Lz has covariance Σ.
1
Covariance is the expected outer product of the centred vector. First, x is centred:
E[x]=E[Lz]=LE[z]=L0=0Expectation is linear, and L is a constant matrix, so it slides outside.
2
Write the covariance of x and substitute x=Lz:
Cov(x)=E[xx⊤]=E[(Lz)(Lz)⊤]=E[Lzz⊤L⊤](Lz)⊤=z⊤L⊤ — the transpose reverses the order.
3
Pull the constant matrices outside the expectation:
E[Lzz⊤L⊤]=LE[zz⊤]L⊤=LIL⊤Only zz⊤ is random. E[zz⊤]=Cov(z)=I: each coordinate has variance 1, and different coordinates are uncorrelated.
4
LIL⊤=LL⊤=Σ. ∎Nothing used the triangular shape — any M with MM⊤=Σ works (e.g. QΛ1/2 from Section 7). Cholesky is simply the cheapest such M to compute.
The Gaussian lensΣ is the shape you want · L bends a round cloud into it
Try switch between round cloud z and shaped cloud Lz: the same 300 points. Then press not PD and see where the recipe stops.
✋ drag to orbit the cloud · the floor shows the flat 2D picture
drag the picture to orbit
Σ =
L =
—
1σ & 2σ shapes of Σ√λ₁·q₁ (long axis)√λ₂·q₂ (short axis)
The glass shell is the 1σ shape of Σ. Its axes are Σ's eigenvectors, straight from Section 7. Only L changes between the two views.
The realization
A=LL⊤
Fill in L from the top-left corner, one entry at a time. It only works when A is positive-definite, so it doubles as a test. And x=Lz bends a round random cloud into one with covariance Σ.
Pause & predict
Factor Σ=[9335] in your head: ℓ11=3, ℓ21=1, and ℓ22=?
In one sentence: a positive-definite matrix has a triangular square root L, found corner by corner, and L is exactly the lens that turns plain random numbers into realistic data.
11
The fine print — missing directions, and the bridge to ML
Imagine this
Push the top of a deck of cards sideways. Every card slides flat, horizontally. A flat arrow stays flat. Every other arrow tilts over.
So the push (a shear) has just one eigen-direction. A 2×2 matrix usually has two. One is missing.
Does every n×n matrix have n independent eigen-directions? No. But you are safe in two cases:
✓All n eigenvalues are different. Then the eigen-directions are automatically independent (proof in the drawer below).
✓A is symmetric. That is the Spectral Theorem, even when eigenvalues repeat.
Trouble only comes when an eigenvalue repeats in a matrix that is not symmetric. The shear [1011] has p(λ)=(1−λ)2, so λ=1 counts twice. But (A−I)x=[0010]x=0 only says x2=0. That is just one line, through (1,0). So we have two ways of counting:
Name
In everyday words
For the shear
algebraic multiplicity
how many times λ shows up as a root of pA
am(1)=2
geometric multiplicity
how many independent directions λ really owns
gm(1)=1
Always 1≤gm≤am. When gm<am, the matrix is one direction short. We call it defective, and no change of axes will ever make it diagonal. You felt this in Section 5's widget: the shear's second direction was simply not there.
Every vertical line (orange) tilts to the blue slope under the shear; only the x-axis is left in place. One eigen-line, no second direction to be found.Symmetric matrices never come up short: the repeated eigenvalue 3 owns a whole plane (two independent eigenvectors), and the eigenvalue 6 owns the plane's normal. Multiplicities match, and the eigenspaces are perpendicular.
If you want the algebra · why different eigenvalues give independent directions
Prove it · why distinct eigenvalues give independent eigenvectors — derived
Claim. If Av1=λ1v1, Av2=λ2v2, both non-zero, and λ1=λ2, then v1,v2 are linearly independent. (The same trick, repeated, handles any number of distinct eigenvalues.)
1
Suppose some combination gives zero: c1v1+c2v2=0. We must show c1=c2=0.
That is the definition of independence: only the trivial combination gives zero.
2
Apply the matrix A−λ2I to both sides:
c1(A−λ2I)v1+c2(A−λ2I)v2=0Multiplying 0 by any matrix gives 0; on the left we distribute.
3
Evaluate each piece with the eigen-equations:
(A−λ2I)v1(A−λ2I)v2=λ1v1−λ2v1=(λ1−λ2)v1=λ2v2−λ2v2=0The shift by λ2 is chosen to send v2 to zero and only rescale v1.
4
So step 2 collapses to c1(λ1−λ2)v1=0. Since λ1−λ2=0 and v1=0, we get c1=0.
A non-zero scalar times a non-zero vector is non-zero, so the only way out is c1=0.
5
Back in step 1, c2v2=0 with v2=0 forces c2=0. Independent. ∎For k distinct eigenvalues, apply (A−λ2I)(A−λ3I)⋯(A−λkI) to kill every vector but v1, conclude c1=0, and repeat. Distinct eigenvalues ⇒ a full eigenbasis ⇒ diagonalisable.
The bridge to machine learning
Your data sits in a table A: 100 rows (one per example) and 8 columns (one per feature). Say the columns are independent. Now build A⊤A, a small 8×8 table. It has two big properties:
⇆Symmetric:(A⊤A)⊤=A⊤(A⊤)⊤=A⊤A.
+Positive-definite:x⊤A⊤Ax=∥Ax∥2>0 for every x=0, because independent columns mean Ax=0.
So everything in this unit works on it: real positive eigenvalues, a right-angle grain, and a Cholesky factor.
A hundred examples shrink into an 8×8 summary. Its (i,j) entry is the dot product of feature i with feature j. After centring the data, this is the covariance matrix, up to a scale.
So what this one fact drives least squares (Unit 9 solves A⊤Ax^=A⊤b), the SVD (Unit 5 uses the eigenvectors of A⊤A and AA⊤), and PCA (Units 12–13 break down the covariance matrix). This unit holds up all of them.
The realization
Different eigenvalues, or a symmetric matrix, guarantee a full set of eigen-directions. A repeated eigenvalue in a non-symmetric matrix can come up short (gm<am). And the data matrix A⊤A is always in the safe, symmetric, positive-definite club.
Pause & predict
Your data matrix A has 100 rows (examples) and 8 independent columns (features). Which tools from this unit work on A⊤A?
In one sentence: only non-symmetric matrices with repeated eigenvalues can run short of eigen-directions, and the data matrix A⊤A never does.
12
The whole story, in five lines
①The determinant is the area dial. Its size is how much areas (or volumes) grow. A minus sign means flipped over. Zero means squashed flat and impossible to undo. Compute it along the laziest line, or by elimination to a triangle.
②The trace adds the diagonal. It equals the sum of the eigenvalues, while the determinant equals their product: a free check.
③Eigenvectors are the directions a matrix only stretches:Ax=λx. Find the eigenvalues from det(A−λI)=0, then each direction by elimination.
④Symmetric matrices are turn, stretch, turn back:A=QΛQ⊤, with real eigenvalues and right-angle directions. Pure turns have complex eigenvalues cosθ±isinθ.
⑤Cholesky A=LL⊤ is the square root of a positive-definite matrix. It tests positive-definiteness and turns random numbers into realistic data.
The one thing to remember
A matrix is its eigenvalues and eigenvectors, seen through a choice of axes. Find the directions it cannot turn and how much it stretches each one, and the grid of numbers turns into a simple picture. That is exactly what PCA, SVD and spectral clustering do for a living.
13
Practice arena — the unit's problem set, solved in full
These five problems come from Prof. Saurabh's practice set, which covers this unit and the next. The eigenvalue problems are here; the diagonalisation and SVD problems wait in Unit 5. Try each one on paper first. Then open the solution: every step is shown.
Problem 1Medium
Consider
A=411141114.
(a) Find the characteristic polynomial and all eigenvalues with their algebraic multiplicities. (b) For every eigenvalue find a basis of its eigenspace and state the geometric multiplicity. (c) Hence decide, with reason, whether A has a full basis of eigenvectors.
What this tests. Computing a 3×3 characteristic polynomial cleanly, then comparing algebraic and geometric multiplicity eigenvalue by eigenvalue.
Show the worked solution — every step
Step 1 · Spot the structure.A=3I+J, where J is the all-ones matrix — every row sums to 6, a strong hint that (1,1,1)⊤ will be an eigenvector with eigenvalue 6.
Step 2 · Characteristic polynomial by row reduction. Start from
det(A−λI)=det4−λ1114−λ1114−λ.
Subtract row 1 from rows 2 and 3 (determinant unchanged). Entry by entry, the new row 2 is (1−(4−λ),(4−λ)−1,1−1)=(λ−3,3−λ,0) and the new row 3 is (λ−3,0,3−λ). Factor (λ−3) out of each of those rows:
det(A−λI)=(λ−3)2det4−λ111−1010−1.
Expand the remaining determinant along row 3: 1⋅det[1−110]+(−1)⋅det[4−λ11−1]=1⋅(0+1)+(−1)(−(4−λ)−1)=1+(5−λ)=6−λ. Hence
det(A−λI)=(λ−3)2(6−λ)=−(λ−6)(λ−3)2.
So λ=6 with algebraic multiplicity am(6)=1, and λ=3 with am(3)=2.
Step 3 · Eigenspace of λ=6.(A−6I)v=0 reads −2x+y+z=0,x−2y+z=0,x+y−2z=0. Subtracting the second equation from the first gives −3x+3y=0⇒x=y; subtracting the third from the second gives −3y+3z=0⇒y=z. So x=y=z: basis {(1,1,1)⊤}, geometric multiplicity gm(6)=1.
Step 4 · Eigenspace of λ=3.A−3I=J (all ones), so all three equations collapse to the single condition x+y+z=0. Two free variables give
v=−110,−101,gm(3)=2.
Step 5 · Compare multiplicities.gm(6)=1=am(6) and gm(3)=2=am(3): the three eigenvectors together form a basis of R3. (In fact A is symmetric, so the spectral theorem already guaranteed a full — even orthogonal — eigenbasis.)
Answer. det(A−λI)=−(λ−6)(λ−3)2. λ=6: multiplicity 1, eigenvector (1,1,1)⊤; λ=3: multiplicity 2, eigenspace {x+y+z=0} with basis (−1,1,0)⊤,(−1,0,1)⊤. A has a full eigenbasis.
Watch out
A repeated eigenvalue is a question, not a verdict: you must actually solve (A−3I)v=0 and count independent solutions. And keep the leading minus sign — for a 3×3, det(A−λI) starts with −λ3, which is why the factorization reads −(λ−6)(λ−3)2.
Key takeaway
Sanity-check eigenvalues instantly: tr(A)=4+4+4=12=6+3+3 and the row-sum trick hands you (1,1,1)⊤↦6 for free. For symmetric matrices, gm=am always holds — the spectral theorem forbids "missing" eigenvectors.
Wait — really?
All three rows of A−3I collapse into the single equation x+y+z=0 — a whole plane of eigenvectors. And the λ=6 eigenvector (1,1,1)⊤ is exactly the normal of that plane: orthogonality between eigenspaces showed up before anyone asked for it.
Problem 2Medium
Find all eigenvalues and corresponding eigenvectors of
A=[34−2−1],
and explain geometrically why no real eigenvector exists.
What this tests. Handling complex roots of the characteristic polynomial of a real 2×2 — and reading the geometry behind them.
Step 2 · Solve the quadratic.λ=22±4−20=22±−16=1±2i.
The discriminant is negative, so the eigenvalues are a complex-conjugate pair.
Step 3 · Eigenvectors. For λ=1+2i, the first row of (A−λI)v=0 gives (3−λ)x−2y=0, i.e. (2−2i)x−2y=0⇒y=(1−i)x. Taking x=1,
v1=[11−i].
Its conjugate v2=(1,1+i)⊤ belongs to the conjugate eigenvalue λ=1−2i.
Step 4 · Verify the pair. Entry by entry: Av1=(3⋅1−2(1−i),4⋅1−(1−i))⊤=(1+2i,3+i)⊤, while λ1v1=(1+2i)(1,1−i)⊤=(1+2i,(1+2i)(1−i))⊤ and (1+2i)(1−i)=1−i+2i−2i2=3+i. Both sides match. ✓
Step 5 · Geometric reason. A real 2×2 matrix with complex eigenvalues acts as a rotation combined with a scaling. A genuine rotation maps no nonzero real vector onto a multiple of itself — so no real eigenvector can exist.
Answer. λ=1±2i with eigenvectors v=(1,1∓i)⊤. No real eigenvector exists because the eigenvalues are non-real: the map rotates the plane.
Watch out
The classic slip is expanding (3−λ)(−1−λ) into λ2−2λ−3 and then forgetting the −(−2)(4)=+8 from the off-diagonal — the constant term must be detA=−3+8=5. Also: use one row of A−λI to find the eigenvector; the other row is automatically dependent, and checking that it is doubles as a free error check.
Key takeaway
For real matrices, complex eigenvalues always arrive in conjugate pairs, and so do their eigenvectors: compute one eigenvector, conjugate every entry to get the other. One computation, two eigenpairs.
Wait — really?
∣λ∣=12+22=5 and detA=5=∣λ∣2: this matrix is secretly "rotate, then stretch by 5". The determinant knew the stretch factor all along — even though no direction in the real plane is left pointing where it started.
Problem 3Easy
Consider
A=211−10−1134,whose characteristic polynomial is (λ−1)(λ−2)(λ−3).
Without forming any matrix power explicitly, compute (a) det(A8), (b) tr(A6), and (c) tr(A6−7A2).
What this tests. The scalar shortcuts det(Ak)=(detA)k and tr(Ak)=∑iλik — handling huge powers with three numbers.
Show the worked solution — every step
Step 0 · Read off the eigenvalues. The characteristic polynomial factors as (λ−1)(λ−2)(λ−3), so the eigenvalues are λ1=1,λ2=2,λ3=3. Quick sanity check against the matrix: trA=2+0+4=6=1+2+3 and detA=6=1⋅2⋅3. ✓
Part (a) · Determinant of a power.Ak has eigenvalues λik, and the determinant is their product — which is (detA)k:
det(A8)=(detA)8=68.
Compute it in two squarings: 62=36,64=362=1296,68=12962=1679616.
Part (b) · Trace of a power. Trace is the sum of eigenvalues, taken after powering:
tr(A6)=i∑λi6=16+26+36=1+64+729=794.
Part (c) · Trace of a polynomial in A. Trace is linear, and A6,A2 have eigenvalues λi6,λi2, so
tr(A6−7A2)=i∑(λi6−7λi2)=794−7(1+4+9)=794−98=696.
Every answer used only the three scalars λi — not a single 3×3 multiplication.
tr(A6)=(trA)6 — the trace of a power is the sum of powered eigenvalues, ∑λi6, not the power of the sum. The determinant is the multiplicative one: det(Ak)=(detA)k really does hold.
Key takeaway
tr(A)=∑iλi and det(A)=∏iλi, and powers or polynomials of A simply apply themselves to each λi. To handle a high power, find the eigenvalues first — then work entirely with scalars.
Wait — really?
A8 is a 3×3 matrix of six-to-seven-digit entries that we never wrote down — yet its determinant, 1679616, came from the single number detA=6. The eigenvalues compress everything the power will ever do to volume and trace.
Problem 4Medium
Let A be a 3×3 matrix whose eigenvalues are 1,2,4, and define
B=A2−5A+6I.
(a) Show that if λ is an eigenvalue of A (with eigenvector v), then λ2−5λ+6 is an eigenvalue of B (with the same eigenvector). (b) Hence find the eigenvalues of B, then det(B) and tr(B), and state whether B is invertible. (c) For which eigenvalues of A would B fail to be invertible?
What this tests. The spectral mapping idea λ↦p(λ): polynomials in A keep the eigenvectors and transform only the eigenvalues.
Show the worked solution — every step
Part (a) · Spectral mapping. Suppose Av=λv. Then A2v=A(λv)=λ2v, and so
Bv=(A2−5A+6I)v=λ2v−5λv+6v=(λ2−5λ+6)v.
Thus v is still an eigenvector — now with eigenvalue p(λ)=λ2−5λ+6.
Part (b) · Apply p to each eigenvalue.p(1)=1−5+6=2,p(2)=4−10+6=0,p(4)=16−20+6=2.
So B has eigenvalues {2,0,2}, and therefore
det(B)=2⋅0⋅2=0,tr(B)=2+0+2=4.
Because 0 is an eigenvalue (equivalently detB=0), B is not invertible — even though A itself is (none of 1,2,4 is zero).
Part (c) · When is B singular?B is singular exactly when p(λ)=0 for some eigenvalue λ of A. Factoring, p(λ)=(λ−2)(λ−3): this vanishes iff A has 2 or 3 as an eigenvalue. Here λ=2 occurs — which is precisely why B is singular.
Remark · Cayley–Hamilton. If A's characteristic polynomial were itself λ2−5λ+const, then p(A) collapses to a multiple of I. E.g. A=[4051] has eigenvalues 4,1 and characteristic polynomial λ2−5λ+4; Cayley–Hamilton gives A2−5A+4I=0, hence A2−5A+6I=2I.
Answer. p(λ)=λ2−5λ+6 maps each eigenvalue; B has eigenvalues 2,0,2. det(B)=0, tr(B)=4, so B is not invertible. B is singular iff A has eigenvalue 2 or 3 (the roots of p).
Watch out
The eigenvectors do not change — only the eigenvalues pass through p. And invertibility does not transfer: an invertible A can easily produce a singular p(A), as it just did.
Key takeaway
Eigenvalues of p(A) are p(eigenvalues of A), with the same eigenvectors. So p(A) is singular ⟺ some eigenvalue of A is a root of p.
Wait — really?
A is perfectly invertible, yet the innocent-looking combination A2−5A+6I is singular — because p(t)=(t−2)(t−3) happens to have a root sitting exactly on one of A's eigenvalues. Matrix polynomials can create zero out of nonzero ingredients.
Problem 5Hard
For the symmetric tridiagonal matrix
A=210121012,
find its eigenvalues, an orthonormal set of eigenvectors, and hence write A=PDP⊤ with P orthogonal.
What this tests. The spectral theorem in action: a symmetric matrix with irrational eigenvalues still yields an exact orthonormal eigenbasis and A=PDP⊤.
Show the worked solution — every step
Step 1 · Eigenvalues. Expanding det(A−λI) along the first row:
det(A−λI)=(2−λ)[(2−λ)2−1]−1⋅(2−λ)=(2−λ)[(2−λ)2−2]=0.
Hence λ=2, or (2−λ)2=2⇒λ=2±2. The eigenvalues are
λ1=2+2,λ2=2,λ3=2−2.
Step 2 · Eigenvector for λ=2.(A−2I)v=0 reads y=0 (rows 1 and 3) and x+z=0 (row 2), so v2=(1,0,−1)⊤.
Step 3 · Eigenvectors for λ=2±2. For λ=2+2: row 1 gives −2x+y=0⇒y=2x, and row 3 gives y−2z=0⇒y=2z, so x=z. (Row 2 checks out: x−2y+z=x−2x+x=0. ✓) Thus v1=(1,2,1)⊤.
For λ=2−2: the same computation with −2 gives y=−2x and x=z, so v3=(1,−2,1)⊤.
Step 4 · Orthogonality check.v1⋅v2=1+0−1=0, v1⋅v3=1−2+1=0, v2⋅v3=1−0−1=0 — mutually orthogonal, exactly as the spectral theorem guarantees for distinct eigenvalues of a symmetric matrix.
Step 5 · Normalise and assemble.∥v2∥=2 and ∥v1∥=∥v3∥=1+2+1=2, so
P=212221210−2121−2221,D=2+200020002−2,A=PDP⊤.
Since the columns are orthonormal, P⊤P=I, i.e. P−1=P⊤ — no matrix inversion needed.
Answer. Eigenvalues 2+2,2,2−2 with orthonormal eigenvectors 21(1,2,1)⊤, 21(1,0,−1)⊤, 21(1,−2,1)⊤; A=PDP⊤ with P orthogonal and D=diag(2+2,2,2−2).
Watch out
Normalise each eigenvector by its own length: here ∥v2∥=2 but ∥v1∥=∥v3∥=2 — one common scale factor will not do. Orthogonality comes free from symmetry; orthonormality is your job.
Key takeaway
Symmetric matrix ⇒ real eigenvalues, orthogonal eigenvectors, and A=PDP⊤ with P−1=P⊤. The transpose replaces the inverse — the single biggest computational gift of the spectral theorem.
Wait — really?
An integer matrix produced irrational eigenvalues 2±2 — and the eigenvector (1,2,1)⊤ carries its own eigenvalue's 2 inside its entries. Yet the factorization PDP⊤ reproduces every integer entry of A exactly: the irrationals conspire and cancel.
Eigenvalues work beautifully — right up until a matrix is not square, or lacks enough eigenvectors. Unit 5 climbs the ladder from the spectral theorem to the SVD, the decomposition that never fails, and ends with you compressing a real photograph with it, live.