A Primer on Linear Algebra

“It is by logic that we prove, but by intuition that we discover.” - Henri Poincaré

Provide Context

Todo:

1. Vectors and coordinates

An arrow describes a movement

Suppose we walk three units right and one unit up. The vector x = (3, 1) is a record of that trip. Start at the origin, and you can draw it as an arrow ending at the point (3, 1).

Here’s the slightly sneaky part: we can draw the same movement starting anywhere. As long as the arrow still goes three right and one up, it’s still (3, 1). A vector’s entries describe changes in coordinates, not a fixed starting point.

Order matters: (1, 3) means one right and three up, which is a different trip. In the ordinary coordinate pictures, the first entry is always the horizontal movement and the second is the vertical one.

Make the arrow longer or shorter

Multiply both entries by two and we get 2x = (6, 2): the same direction, twice as far. Multiply by ½ and it’s half as long.

A negative multiplier also flips the arrow around: −x goes three units left and one unit down. A number we multiply a vector by is called a scalar, and we apply the same number to every entry.

Doubling a vector keeps its directionOn ordinary Cartesian coordinates, x=(3,1) and 2x=(6,2) start at the origin and point in the same direction. Equal axis scales show that 2x has twice the length of x. Dashed guides identify the coordinates of both endpoints. Same direction, twice the length 0 3 6 1 2 x1​ x2​ x = (3, 1) 2x = (6, 2)
Doubling both coordinates doubles the length. Same axes, same scale, same direction. Just more arrow.

Follow one arrow, then another

We can also reach (3, 1) in two steps: first move by (1, −1), then by (2, 2). Adding the vectors records the whole journey:

(1, −1) + (2, 2) = (3, 1)
Adding two arrows tip to tailOrdinary coordinates. The blue arrow (1, -1) starts at the origin. The orange arrow (2, 2) starts at the blue arrow's tip and ends at (3, 1). The teal arrow x = (3, 1) runs from the origin straight to that endpoint. A faint copy of the two arrows in the other order, (2, 2) first and then (1, -1), reaches the same point. To the right, the sum is written out entry by entry: 1 + 2 = 3 and -1 + 2 = 1. Follow one arrow, then the next Ordinary coordinates; the sum goes straight from start to finish 0 1 2 3 1 x1​ x2​ (1, −1) then (2, 2) x = (3, 1) the other order lands in the same place Add matching entries (1, −1) + (2, 2) = (3, 1) first entries: 1 + 2 = 3 second entries: −1 + 2 = 1 Scaling first is allowed too: 2a + b means two copies of a, then one copy of b. Order doesn't matter: both routes end at (3, 1).
Tip to tail. Draw the second arrow starting where the first one ends. The sum runs straight from the very start to the very end, and it lands in the same place whichever arrow you take first. Entry by entry, you just add the matching numbers.

Keep this split in mind. The two pieces are perpendicular, and we’ll use them next. We can scale arrows before adding them, too. If a and b are two vectors, 2a + b means “two copies of a, then one copy of b.” That’s a linear combination, and the numbers 2 and 1 are its coefficients: how much of each ingredient to use.

2. A matrix as an operation

Give the input two rules to follow

How do we turn one vector into another? We’ll use a simple rule throughout this primer: each output is twice its matching input entry, plus the other input entry.

Call the input entries x₁ and x₂. We record the rule as a matrix called M, with one row for each output:

M =

The notation Mx means “the output you get by feeding x to M”:

Mx = (2x₁ + x₂,  x₁ + 2x₂)
Comic: the arrow machineA box labeled M has an IN funnel on top and an OUT chute on the side. Panel 1: B drops the arrow (3, 1) into the funnel and says: I put in (3, 1)... A, catching what comes out of the chute, says: ...and out comes (7, 5). Panel 2: B asks: What if I put in two arrows, tip to tail? A says: Same as putting them in one at a time and adding what comes out. Panel 3: B asks: What if I put in nothing? A says: You get nothing. It's a very fair machine. M IN OUT (3, 1) (7, 5) I put in (3, 1)... ...and out comes (7, 5). M IN OUT What if I put in two arrows, tip to tail? Same as putting them in one at a time and adding what comes out. M IN OUT What if I put in nothing? You get nothing. It's a very fair machine.
Comic: the arrow machineA box labeled M has an IN funnel on top and an OUT chute on the side. Panel 1: B drops the arrow (3, 1) into the funnel and says: I put in (3, 1)... A, catching what comes out of the chute, says: ...and out comes (7, 5). Panel 2: B asks: What if I put in two arrows, tip to tail? A says: Same as putting them in one at a time and adding what comes out. Panel 3: B asks: What if I put in nothing? A says: You get nothing. It's a very fair machine. M IN OUT (3, 1) (7, 5) I put in (3, 1)... ...and out comes (7, 5). M IN OUT What if I put in two arrows, tip to tail? Same as putting them in one at a time and adding what comes out. M IN OUT What if I put in nothing? You get nothing. It's a very fair machine.
the arrow machine
alt-text

That fairness has a name: linearity. Officially it's two rules: adding inputs adds the outputs, and scaling an input scales its output. Nothing in, nothing out comes free. Real vending machines are only linear until you feed them a crumpled dollar bill.

Read the rows to find the output

For our input (3, 1), the first row gives 2 × 3 + 1 × 1 = 7. The second gives 1 × 3 + 2 × 1 = 5. So the output is Mx = (7, 5).

Applying M changes this arrow's length and directionFor M with rows (2,1) and (1,2), the vector x=(3,1) maps to Mx=(7,5). Both arrows are drawn from the origin on the same Cartesian coordinate plane with equal axis scales. Their different directions show that no single scalar multiplies x into Mx. For this input, M changes length and direction 0 3 7 1 5 x1​ x2​ x = (3, 1) Mx = (7, 5)
M changes this arrow's length and its direction. No single scalar could do this: 3 became 7 while 1 became 5, and those aren't the same multiplier.

Keep the matrix fixed and change the input

Two habits of M make it predictable, and the next picture shows both. On the left, double the input from (3, 1) to (6, 2): the output becomes (14, 10), which is exactly (7, 5) doubled. On the right, split the input into two pieces and push each piece through on its own: the two outputs, placed tip to tail, land exactly on Mx.

Two rules that make M linearTwo panels in ordinary coordinates. Left: the input x = (3, 1) has output (7, 5); the doubled input 2x = (6, 2) has output (14, 10), exactly twice (7, 5). Right: the input (3, 1) is split into a = (3, 0) and b = (0, 1). Their outputs Ma = (6, 3) and Mb = (1, 2), placed tip to tail, add to Mx = (7, 5). Pieces in, pieces out Ordinary coordinates; both panels use the same M Double the input The output doubles too. 0 3 6 7 14 1 2 5 10 x 2x Mx = (7, 5) M(2x) = (14, 10) = 2Mx Split the input Each piece goes through on its own. 0 3 6 7 1 3 5 a = (3, 0) b = (0, 1) x = a + b Ma = (6, 3) Mb = (1, 2) Ma + Mb = (7, 5) = Mx Scale the input and the output scales. Add inputs and the outputs add.
Two rules that make M linearTwo panels in ordinary coordinates. Left: the input x = (3, 1) has output (7, 5); the doubled input 2x = (6, 2) has output (14, 10), exactly twice (7, 5). Right: the input (3, 1) is split into a = (3, 0) and b = (0, 1). Their outputs Ma = (6, 3) and Mb = (1, 2), placed tip to tail, add to Mx = (7, 5). Pieces in, pieces out Ordinary coordinates; both panels use the same M Double the input The output doubles too. 0 3 6 7 14 1 2 5 10 x 2x Mx = (7, 5) M(2x) = (14, 10) = 2Mx Split the input Each piece goes through on its own. 0 3 6 7 1 3 5 a = (3, 0) b = (0, 1) x = a + b Ma = (6, 3) Mb = (1, 2) Ma + Mb = (7, 5) = Mx Scale the input and the output scales. Add inputs and the outputs add.
Pieces in, pieces out. Left: multiplying the input by a factor multiplies its output by the same factor. Right: adding inputs adds their outputs, M(a + b) = Ma + Mb. Here a = (3, 0) and b = (0, 1); their outputs (6, 3) and (1, 2) add to (7, 5).

Together, these two properties make M linear. They let us chop an input into pieces, push each piece through separately, and glue the results back together. We’ll do that constantly. They also mean zero in gives zero out: M never moves the origin.

Read the columns to see where the unit steps go

What happens to a single horizontal step, e₁ = (1, 0)? M sends it to (2, 1), which is the first column of the matrix. A single vertical step, e₂ = (0, 1), goes to (1, 2), the second column.

Matrix columns are the transformed coordinate unit vectorsTwo coordinate planes use the same scale. Before applying M, the blue unit vector e1=(1,0) points right and the orange unit vector e2=(0,1) points up. After applying M with rows (2,1) and (1,2), they land at Me1=(2,1) and Me2=(1,2). These endpoints are the first and second columns of M, respectively. The columns tell us where the unit steps go One unit along each axis After applying M 0 1 2 1 2 x1​ x2​ 0 1 2 1 2 x1​ x2​ e1​ = (1, 0) e2​ = (0, 1) Me1​ = (2, 1) Me2​ = (1, 2) First column: where e1​ lands. Second column: where e2​ lands.
Each column is where one unit step lands. Follow the blue horizontal step and the orange vertical step from input to output. Both panels use the same scale.

Our input (3, 1) is three horizontal unit steps plus one vertical unit step. Since M is linear, its output is three copies of the first column plus one copy of the second:

Mx = 3(2, 1) + (1, 2) = (7, 5)

Rows are for computing the output one coordinate at a time. Columns show how the transformed unit steps build the output. Same answer, two ways of looking at it.

3. The dot product

A test for right angles

Take two vectors a and b, with entries (a₁, a₂) and (b₁, b₂). Multiply matching entries and add the products. The result is a single number called their dot product:

a · b = a₁b₁ + a₂b₂

For the arrows a = (2, 1) and b = (1, −2), the products are 2 and −2, and they cancel. The dot product is zero, and these arrows meet at a right angle.

The sign tells you about the angle

For two nonzero vectors, a positive dot product means the angle between them is less than 90°. A negative one means it’s more than 90°. Exactly zero means exactly 90°.

The dot product distinguishes three kinds of alignmentThe reference vector a=(2,1) is blue in every panel. With b=(1,1), the dot product is 3 and the angle is acute. With b=(1,-2), the dot product is zero and the vectors are perpendicular. With b=(-2,1), the dot product is -3 and the angle is obtuse. What does the sign tell us about the angle? Same reference in every panel: a = (2, 1) b = (1, 1) a b a · b = 3 Less than 90° b = (1, −2) a b a · b = 0 Right angle: 90° b = (−2, 1) a b a · b = −3 More than 90°
Watch the angle as the second arrow moves. The first arrow stays put in all three panels. The middle pair is perpendicular, and its dot product is zero.

If two vectors are perpendicular, their dot product is zero. We’ll use this rule constantly, starting with finding a perpendicular remainder. Vectors with a zero dot product are called orthogonal, which is “perpendicular” wearing a lab coat.

Comic: we're orthogonalPanel 1: Two stick figures stand apart, and between them two arrows meet at a right angle. B says: I think we're orthogonal. A asks: What does that mean? Panel 2: B explains: Our dot product is zero. Neither of us has any component along the other. A says: Oh. Panel 3: A, hand on chin, says: Is it my length? I can normalize. B says: That won't change the angle. I think we're orthogonal. What does that mean? Our dot product is zero. Neither of us has any component along the other. Oh. Is it my length? I can normalize. That won't change the angle.
Comic: we're orthogonalPanel 1: Two stick figures stand apart, and between them two arrows meet at a right angle. B says: I think we're orthogonal. A asks: What does that mean? Panel 2: B explains: Our dot product is zero. Neither of us has any component along the other. A says: Oh. Panel 3: A, hand on chin, says: Is it my length? I can normalize. B says: That won't change the angle. I think we're orthogonal. What does that mean? Our dot product is zero. Neither of us has any component along the other. Oh. Is it my length? I can normalize. That won't change the angle.
we're orthogonal
alt-text

In fairness, a dot product isn't a pure compatibility score: its size grows with both lengths. Its sign, for nonzero arrows, depends only on the angle.

Our earlier pair passes the test: (1, −1) and (2, 2) give 1 × 2 + (−1) × 2 = 0. The arithmetic confirms the right angle without trusting anybody’s drawing skills. With more entries, the rule is the same: multiply matching entries and add.

The number also depends on length

Double either arrow and the dot product doubles too, even though the angle hasn’t changed. So the dot product mixes alignment and length together. It isn’t a pure angle meter.

We can at least remove one of the two lengths. Measure against a reference arrow of length one. Then the dot product measures the other arrow along that direction, with a sign that says which way it points. That arrow’s own length still counts, as it should. First we’ll build a unit arrow; then we’ll see why the measurement works.

The same calculation in matrix notation

So far we’ve written coordinates as pairs. In matrix notation, a vector’s entries are usually stacked in a column. The transpose, written aᵀ, tips that column over into a row. Multiplying the row aᵀ by the column b does exactly the matching-entries calculation above, so aᵀb and a · b are the same dot product in different outfits.

4. Length and unit vectors

Length and squared length describe the same arrow

Before we can build a one-unit arrow, we need to know how long our arrow is right now. Length is how long it is. Squared length is that number multiplied by itself.

For a small example, take any arrow of length 3. (We’ll get to the length of (3, 1) in a moment.) Its squared length is 3 × 3 = 9. Now double every coordinate, which makes it twice as long:

Measurement Original arrow Twice as long
Length 3 6
Squared length 3 × 3 = 9 6 × 6 = 36

The length doubles, but the squared length quadruples, because both factors in the multiplication doubled. To get back from squared length to length, take the square root: a squared length of 9 means a length of √9 = 3.

Comic: the pizza problemPanel 1: At a pizza counter holding two 12-inch pizzas and one 18-inch pizza, C asks: Two 12-inch pizzas, or one 18-inch? B points at the big one: The 18. It's more pizza than both 12s together. Panel 2: C says: No way. B says: 18 squared is 324. 12 squared plus 12 squared is 288. Area grows with the square of the size. 12 in 12 in 18 in Two 12-inch pizzas, or one 18-inch? The 18. It's more pizza than both 12s together. No way. 182​ = 324. 122​ + 122​ = 288. Area grows with the square of the size.
Comic: the pizza problemPanel 1: At a pizza counter holding two 12-inch pizzas and one 18-inch pizza, C asks: Two 12-inch pizzas, or one 18-inch? B points at the big one: The 18. It's more pizza than both 12s together. Panel 2: C says: No way. B says: 18 squared is 324. 12 squared plus 12 squared is 288. Area grows with the square of the size. 12 in 12 in 18 in Two 12-inch pizzas, or one 18-inch? The 18. It's more pizza than both 12s together. No way. 182​ = 324. 122​ + 122​ = 288. Area grows with the square of the size.
the pizza problem
alt-text

Double a pizza's diameter and you get four times the pizza. Doubling an arrow does the same thing to its squared length.

Find length from the coordinates

For our arrow (3, 1), the horizontal and vertical steps make a right triangle, so Pythagoras gives squared length 3² + 1² = 10. Its length is √10, about 3.16.

Dotting x with itself adds up those same squared coordinates. We write the length of x as ‖x‖, with double bars. It’s also called the Euclidean norm:

‖x‖² = x · x = x₁² + x₂²

Make a one-unit measuring step

To measure along a direction, we want a standard step. An arrow of length exactly one does the job. It’s called a unit vector.

Our x has length √10, so dividing every coordinate by √10 makes its length one. Both entries shrink by the same factor, so the direction doesn’t change. Call the new arrow x̂, read “x-hat”:

x̂ = x/‖x‖ = (3, 1)/√10
Normalize x to make an arrow one unit longIn ordinary coordinates, the blue vector x=(3,1) and its shorter teal version x-hat point in exactly the same direction. The unit circle marks a distance of one from the origin. Dividing x by its length, square root ten, puts the tip of x-hat on that circle. Both axes use the same scale. Same direction, one unit long Ordinary coordinates x1​ x2​ 3 1 x = (3, 1) x̂ Circle radius = 1 Original arrow: x Original length: √10 x̂ = x / √10 New length: 1 The direction stays the same. Divide every coordinate by the arrow’s length.
Normalize x to make an arrow one unit longIn ordinary coordinates, the blue vector x=(3,1) and its shorter teal version x-hat point in exactly the same direction. The unit circle marks a distance of one from the origin. Dividing x by its length, square root ten, puts the tip of x-hat on that circle. Both axes use the same scale. Same direction, one unit long Ordinary coordinates x1​ x2​ 3 1 x = (3, 1) x̂ Circle radius = 1 Original arrow: x Original length: √10 x̂ = x / √10 New length: 1 The direction stays the same.
Same direction, length one. The tip of x̂ lands on the circle of radius one. We shortened the arrow without turning it, which gives us a one-unit step along x's direction.

As a check, x̂ has squared length 9/10 + 1/10 = 1. Dividing a nonzero vector by its length is called normalization. Keep that word in mind. In Chapter 8 we’ll normalize something else, and the difference will matter.

How the dot product includes both length and angle

Let θ be the angle between two nonzero arrows a and b. Then a · b = ‖a‖ ‖b‖ cos θ. The lengths explain why scaling either arrow changes the dot product. The cosine explains the sign: at 90°, it is zero. If b has length one, only a’s length and its alignment with b remain in the measurement.

5. Projection

Split one arrow into two useful pieces

Start with x = (3, 1). We want the part along the diagonal through d = (1, 1).

Imagine dropping a perpendicular from the tip of x onto that diagonal. The arrow from the origin to the landing point is the projection, or shadow, of x on the line. Call it p. The remaining step from p’s tip to x’s tip is r.

Comic: projection is a shadowPanel 1: The sun is directly overhead and its rays come straight down. An arrow labeled x leans out of the ground; its shadow, labeled p, lies on the ground directly beneath it, and a dashed drop from the tip of x meets the ground at a right angle. A says: Projection is a shadow, when the light hits the line at a right angle. Panel 2: Beside a whiteboard sketch of a low sun casting a long, slanted shadow, B asks: And if the light comes in at an angle? A says: Then it's a different kind of projection, and I will not be taking questions. x p (the shadow) Projection is a shadow, when the light hits the line at a right angle. And if the light comes in at an angle? Then it's a different kind of projection, and I will not be taking questions.
Comic: projection is a shadowPanel 1: The sun is directly overhead and its rays come straight down. An arrow labeled x leans out of the ground; its shadow, labeled p, lies on the ground directly beneath it, and a dashed drop from the tip of x meets the ground at a right angle. A says: Projection is a shadow, when the light hits the line at a right angle. Panel 2: Beside a whiteboard sketch of a low sun casting a long, slanted shadow, B asks: And if the light comes in at an angle? A says: Then it's a different kind of projection, and I will not be taking questions. x p (the shadow) Projection is a shadow, when the light hits the line at a right angle. And if the light comes in at an angle? Then it's a different kind of projection, and I will not be taking questions.
projection is a shadow
alt-text

When the sun is directly overhead, your shadow is roughly the orthogonal projection of you onto the ground, which is mostly your feet. Near sunset it's an oblique projection, which is why your shadow is suddenly ten meters long.

For our example, the two pieces are:

x = p + r = (2, 2) + (1, −1)
Find the closest point on the diagonalIn ordinary coordinates, the diagonal through the origin has direction d=(1,1). The closest point to the tip of x=(3,1) is (2,2). The teal projection p runs from the origin to that point. The orange remainder r runs from the tip of p to the tip of x and meets the diagonal at a right angle. It moves one step right and one step down, so r=(1,-1), even though it starts at (2,2). A faint alternate point at (1,1) has a longer connection to x. Following p then r reaches the same point as x. Which point on the line is closest to the tip of x? Ordinary coordinates x1​ x2​ Chosen line d = (1, 1) Longer Another point Closest point p x r Follow p, then r, to reach x. x: the original arrow From (0, 0) to (3, 1) p: component along the line Ends at the closest point r: perpendicular remainder Starts at the tip of p Ends at the tip of x The shortest connection meets the line at a right angle.
Find the closest point on the diagonalIn ordinary coordinates, the diagonal through the origin has direction d=(1,1). The closest point to the tip of x=(3,1) is (2,2). The teal projection p runs from the origin to that point. The orange remainder r runs from the tip of p to the tip of x and meets the diagonal at a right angle. It moves one step right and one step down, so r=(1,-1), even though it starts at (2,2). A faint alternate point at (1,1) has a longer connection to x. Following p then r reaches the same point as x. Which point on the line is closest to the tip of x? Ordinary coordinates x1​ x2​ Chosen line d = (1, 1) Longer Another point Closest point p x r Follow p, then r, to reach x. x: the original arrow From (0, 0) to (3, 1) p: component along the line Ends at the closest point r: perpendicular remainder Starts at the tip of p Ends at the tip of x The shortest connection is perpendicular.
Follow p along the line, then r to the tip of x. The faint alternative connection is longer than the perpendicular one. The coordinates of r describe its movement from p's tip, even though it doesn't start at the origin.

The piece p = (2, 2) follows the diagonal. The remainder r = (1, −1) is perpendicular to it: its dot product with d = (1, 1) is 1 − 1 = 0. These are the two checks that make this the projection split.

Optional: how do we find (2, 2)?

A point on this diagonal has equal coordinates, so write the unknown projection as p = (a, a). The remaining step is then r = (3 − a, 1 − a).

Choose a so that r has dot product zero with the diagonal direction:

(3 − a) + (1 − a) = 0

This gives 4 − 2a = 0, so a = 2. A perpendicular connection is also the shortest connection from x’s tip to the line.

A unit arrow gives us a shortcut

Let u be a length-one arrow along the chosen line. The dot product x · u tells us the signed amount of x along that line. Multiplying that number by u turns it into the projection arrow:

p = (x · u)u

The number x · u is a coefficient: it tells us how many u steps to take. The whole arrow p is the component. A negative coefficient means taking those steps in the opposite direction.

Optional: the same component with two measuring steps

Our diagonal arrow d has length √2. Make it unit length by dividing by √2: u = (1, 1)/√2. Now x · u = (3 + 1)/√2 = 2√2.

p = 2d = 2√2 u = (2, 2)
The component stays fixed when its reference arrow changesBoth panels use ordinary coordinates at the same scale. They show the same teal component p=(2,2). The dashed dark reference d=(1,1) has length square root two, so p=2d. The shorter dashed reference u=(1,1)/sqrt(2) has length one, so p=2sqrt(2)u. Shortening the reference arrow means needing more copies to reach the same point. The teal component does not change. A shorter reference needs more copies to reach p Ordinary coordinates; both panels use the same scale Original reference Length √2 p (2, 2) d 2 × d = p d = (1, 1) Unit reference Length 1 p (2, 2) u 2√2 × u = p u = (1, 1) / √2 The reference changes. The teal component stays the same.
The component stays fixed when its reference arrow changesBoth panels use ordinary coordinates at the same scale. They show the same teal component p=(2,2). The dashed dark reference d=(1,1) has length square root two, so p=2d. The shorter dashed reference u=(1,1)/sqrt(2) has length one, so p=2sqrt(2)u. Shortening the reference arrow means needing more copies to reach the same point. The teal component does not change. Shorter reference arrow, more copies to reach p Ordinary coordinates; same scale Original reference Length √2 p (2, 2) d 2 × d = p d = (1, 1) Unit reference Length 1 p (2, 2) u 2√2 × u = p u = (1, 1) / √2 The teal component stays the same.
The reference arrow gets shorter; the component stays put. Both drawings use the same coordinate scale. The bigger coefficient makes up for the shorter step.

The coefficient changes because the measuring step changes. The component itself stays the same.

The squared lengths add

Because p and r meet at a right angle, Pythagoras applies. Their squared lengths add to x’s squared length:

‖x‖² = ‖p‖² + ‖r‖² = 8 + 2 = 10

This will help us measure how much of an input lies in each of two perpendicular directions.

6. Eigenvectors and eigenvalues

Watch three arrows go through the same matrix

We are still using the matrix with these two rules: double the first entry and add the second; then add the first entry to twice the second.

M =

Compare our input x = (3, 1) with two diagonal arrows, q₁ = (1, −1) and q₂ = (1, 1). Press Play transformation or drag from Before to After. This shows one application of M. The frames in between are animation steps, not repeated matrix multiplications.

Apply the same matrix to three arrowsThe final state of the matrix transformation with rows (2,1) and (1,2), drawn by hand. The grid has been stretched along the upward diagonal. The teal vector x=(3,1) changes to Mx=(7,5), changing its direction. The blue vector q1=(1,-1) is unchanged. The orange vector q2=(1,1) becomes (3,3), three times its original length on the same line. Dashed arrows mark the starting positions of x and q2. The ordinary coordinate axes stay fixed, with equal scales. The animation moves from each input to its output under one application of M. Almost everybody moves. Two directions stay on their lines. The teal arrow turns. Blue and orange stay on their dashed lines. x1​ x2​ -2 2 4 6 8 10 2 4 6 0 Mx Mq2​ = 3q2​ Mq1​ = q1​ Output Mx: (7, 5) q1​: unchanged q2​: length × 3 Dashed arrows: where x and q2​ started. The axes stay put.
100%
BeforeAfter M

Follow the arrows from where they start to where M sends them. This is one application of M.

The same M transforms the whole grid. The ordinary axes stay fixed so we can compare before and after. Dashed arrows mark where x and q₂ began; q₁ doesn't move at all.
Input Output What happened?
x = (3, 1) Mx = (7, 5) It grew and turned.
q₁ = (1, −1) Mq₁ = (1, −1) It stayed exactly the same: multiply by 1.
q₂ = (1, 1) Mq₂ = (3, 3) It stayed on its line and grew: multiply by 3.

Name the arrow and the number

A nonzero arrow that the matrix multiplies by one number is an eigenvector. That number is its eigenvalue. In symbols:

Mv = λv

Read this as: “applying M to v has the same effect as multiplying v by λ.” The eigenvector tells us the direction; the eigenvalue tells us the multiplier. For M, λ₁ = 1 and λ₂ = 3.

Comic: the eigenvector job interviewM, a character whose head is the matrix with rows 2 1 and 1 2, interviews candidates from behind a desk. Panel 1: M asks: What happens when I'm applied to you? A candidate named q2 = (1, 1) says: I stay on my line and get three times longer. M says: Hired. Panel 2: A candidate named x = (3, 1) says: I get longer, and I turn a little toward the... M says: Next! Panel 3: A tiny candidate named 0 cheers: I stay on every line! M, head in hand, says: That's the problem. 2 1 1 2 q2​ = (1, 1) What happens when I'm applied to you? I stay on my line and get three times longer. Hired. 2 1 1 2 x = (3, 1) I get longer, and I turn a little toward the— Next! 2 1 1 2 0 I stay on every line! That's the problem.
Comic: the eigenvector job interviewM, a character whose head is the matrix with rows 2 1 and 1 2, interviews candidates from behind a desk. Panel 1: M asks: What happens when I'm applied to you? A candidate named q2 = (1, 1) says: I stay on my line and get three times longer. M says: Hired. Panel 2: A candidate named x = (3, 1) says: I get longer, and I turn a little toward the... M says: Next! Panel 3: A tiny candidate named 0 cheers: I stay on every line! M, head in hand, says: That's the problem. 2 1 1 2 q2​ = (1, 1) What happens when I'm applied to you? I stay on my line and get three times longer. Hired. 2 1 1 2 x = (3, 1) I get longer, and I turn a little toward the— Next! 2 1 1 2 0 I stay on every line! That's the problem.
the eigenvector job interview
alt-text

Eigenvectors have to be nonzero: M0 = λ0 for every number λ, so the zero vector can't tell you which multiplier belongs to M. It lies on every line through the origin, which is exactly why it says nothing about any particular one.

The direction matters more than the length

Any nonzero multiple of q₁ is still an eigenvector with eigenvalue 1. Any nonzero multiple of q₂ still has eigenvalue 3. Making an arrow longer does not change which eigenvector line it lies on.

For other matrices, a negative eigenvalue reverses the arrow along the same line. A zero eigenvalue sends a nonzero arrow to the origin. The zero arrow itself is excluded: multiplying it by any number gives zero, so it cannot identify a particular multiplier.

Optional: check every direction, and apply M more than once

The chart shows how much M turns an arrow for each starting direction. The two eigenvector lines are the only lines it leaves unturned.

Chart: how far M turns an arrow, by directionA hand-drawn chart. The horizontal axis is the direction an arrow starts in, from 0 to 180 degrees measured from the x1-axis. The vertical axis is how many degrees M turns it, counterclockwise positive. The curve starts at about 27 degrees at 0, falls to zero at 45 degrees (the direction of q2, which is only stretched by 3), reaches minus 30 degrees at 105, returns to zero at 135 degrees (the direction of minus q1, on the q1 line, which M leaves unchanged), and climbs to plus 30 degrees at 165. The point for x = (3, 1), at about 18 degrees, shows a turn of about 17 degrees. Dashed lines at plus and minus 30 degrees mark the largest turn of any direction. Every other direction is turned toward the q2 line. How far does M turn an arrow? −30° −15° 0° +15° +30° 0° 45° 90° 135° 180° direction the arrow starts in how much M turns it +30°: the most M turns anything −30°: the most, the other way q2​'s direction: no turn, just × 3 q1​'s line: no turn at all x = (3, 1) gets turned about 17° Every other direction gets turned toward the q2​ line, from one side or the other.
Every starting direction, computed from M
alt-text

Directions 180° apart get turned by exactly the same amount, because M(−x) = −Mx. That's why the chart can stop at 180°.

Other arrows turn toward the q₂ line, by at most 30° in one application. Repeated applications move them closer to that line unless they started exactly on q₁.

Along q₂, each application multiplies by 3. Two applications multiply by 3 × 3 = 9. An eigenvector direction is sometimes called a mode, and the list of eigenvalues, including repeats, is called the spectrum.

The moving-grid approach is inspired by 3Blue1Brown’s lesson on eigenvectors and eigenvalues.

7. A different set of coordinates

Describe the same arrow using different steps

In ordinary coordinates, x = (3, 1) means three horizontal steps and one vertical step. We can reach exactly the same point using the eigenvector steps q₁ = (1, −1) and q₂ = (1, 1):

x = q₁ + 2q₂ = (1, −1) + (2, 2) = (3, 1)

So x has coordinates (1, 2) in this new system: one q₁ step and two q₂ steps. Changing coordinates changes the description of x. It does not move x.

Comic: two sets of directionsPanel 1: B, holding a map, asks: How do I get to (3, 1)? A points and says: Three blocks east, one block north. Panel 2: C stands beside a signpost with two diagonal signs, q1 St and q2 Ave, and says: Or one block down q1 Street and two blocks up q2 Avenue. B asks: Are you both right? C says: Yes. How do I get to (3, 1)? Three blocks east, one block north. q1​ St q2​ Ave Or one block down q1​ St and two blocks up q2​ Ave. ...Are you both right? Yes.
Comic: two sets of directionsPanel 1: B, holding a map, asks: How do I get to (3, 1)? A points and says: Three blocks east, one block north. Panel 2: C stands beside a signpost with two diagonal signs, q1 St and q2 Ave, and says: Or one block down q1 Street and two blocks up q2 Avenue. B asks: Are you both right? C says: Yes. How do I get to (3, 1)? Three blocks east, one block north. q1​ St q2​ Ave Or one block down q1​ St and two blocks up q2​ Ave. ...Are you both right? Yes.
two sets of directions
alt-text

Manhattan's street grid is tilted about 29° from true north, so New Yorkers and mapmakers have been using different bases for more than two hundred years. (Compasses use a third one: magnetic north.)

Now let M act on the pieces

M leaves the q₁ piece alone and triples the q₂ piece. The new coordinates therefore change from (1, 2) to (1, 6). Add the output pieces to return to ordinary coordinates:

Mx = q₁ + 6q₂ = (1, −1) + (6, 6) = (7, 5)
Reference steps Input coordinates Output coordinates
Horizontal and vertical (3, 1) (7, 5)
q₁ and q₂ (1, 2) (1, 6)
Change the description first, then apply the matrixThree stages use ordinary coordinate axes and the same scale. First, the input x=(3,1) is shown as the horizontal component (3,0) plus the vertical component (0,1). Second, exactly the same input is shown as q1=(1,-1) plus 2q2=(2,2), with eigenvector coordinates (1,2). Third, M keeps the q1 component and triples the q2 component, giving Mx=q1+6q2=(7,5), with eigenvector coordinates (1,6). A faint copy of the original x remains in the last stage. Changing coordinates leaves x unchanged; applying M changes it. Change the description first. Then apply M. Ordinary axes in every panel; the drawing scale stays the same. 1. Use horizontal and vertical Ordinary coordinates: (3, 1) x1​ x2​ 0 3e1​ e2​ x = (3, 1) Each coordinate counts steps along a horizontal or vertical arrow. 2. Use eigenvector directions Eigenvector coordinates: (1, 2) x1​ x2​ 0 q1​ 2q2​ x = (3, 1) The same x is 1 copy of q1​ plus 2 copies of q2​. 3. Apply M to the components Eigenvector coordinates: (1, 6) x1​ x2​ 0 original x q1​ 6q2​ Mx Keep q1​ and triple 2q2​. Their sum is Mx = (7, 5). In eigenvector coordinates: (1, 2) → (1, 6) Keep the first coordinate. Triple the second. The ordinary-coordinate output is the same vector: Mx = (7, 5). Changing coordinates changes the description. Applying M changes the vector.
Change the description first, then apply the matrixThree stages use ordinary coordinate axes and the same scale. First, the input x=(3,1) is shown as the horizontal component (3,0) plus the vertical component (0,1). Second, exactly the same input is shown as q1=(1,-1) plus 2q2=(2,2), with eigenvector coordinates (1,2). Third, M keeps the q1 component and triples the q2 component, giving Mx=q1+6q2=(7,5), with eigenvector coordinates (1,6). A faint copy of the original x remains in the last stage. Changing coordinates leaves x unchanged; applying M changes it. Describe x. Then apply M. Ordinary axes in every panel. The drawing scale stays the same. 1. Use horizontal and vertical Ordinary coordinates: (3, 1) x1​ x2​ 0 3e1​ e2​ x = (3, 1) Each coordinate counts steps along a horizontal or vertical arrow. 2. Use eigenvector directions Eigenvector coordinates: (1, 2) x1​ x2​ 0 q1​ 2q2​ x = (3, 1) The same x is 1 copy of q1​ plus 2 copies of q2​. 3. Apply M to the components Eigenvector coordinates: (1, 6) x1​ x2​ 0 original x q1​ 6q2​ Mx Keep q1​ and triple 2q2​. Their sum is Mx = (7, 5). Only the third stage changes the vector.
Changing coordinates keeps x fixed. Applying M produces Mx. All three stages use the same ordinary scale. The first two split the same input into different pieces. In the third, the q₁ piece stays put and the q₂ piece triples. The faint original x shows how much it changed.

This works because M is linear: we can transform the pieces separately and then add the results. Eigenvector coordinates make each separate transformation a simple multiplication.

What makes a valid coordinate system?

A set of reference arrows is called a basis when it can describe every vector, and each vector has exactly one description.

In the plane, any two nonparallel arrows form a basis. Our q₁ and q₂ qualify. Two arrows pointing along the same line do not: they cannot reach points away from that line.

Optional: “span” and “linearly independent”
What makes two arrows a coordinate systemTwo panels in ordinary coordinates. Left: the references e1 = (1, 0) and 2e1 = (2, 0) both lie on the horizontal axis. Every combination of them stays on that line, shown as a shaded band with dots at the reachable points. The target x = (3, 1), above the line, is marked as out of reach, and the point (2, 0) is noted as having two descriptions: 2 copies of e1 or 1 copy of 2e1. Right: q1 = (1, -1) and q2 = (1, 1) point in different directions. A faint grid of lines parallel to each shows that their combinations cover the plane, and x = (3, 1) is reached by one copy of q1 followed by two copies of q2. Enough directions, and only one recipe per point Ordinary coordinates Two parallel references “East” and “more east.” 0 e1​ 2e1​ x = (3, 1) can't get here Every combination stays on the line. And (2, 0) is 2e1​ or 1 × 2e1​: two recipes. Two different directions q1​ and q2​ form a basis. 0 q1​ q2​ x = q1​ + 2q2​ Two directions reach every point of the plane, each in exactly one way. A basis reaches every point, and gives each point exactly one description.
What makes two arrows a coordinate systemTwo panels in ordinary coordinates. Left: the references e1 = (1, 0) and 2e1 = (2, 0) both lie on the horizontal axis. Every combination of them stays on that line, shown as a shaded band with dots at the reachable points. The target x = (3, 1), above the line, is marked as out of reach, and the point (2, 0) is noted as having two descriptions: 2 copies of e1 or 1 copy of 2e1. Right: q1 = (1, -1) and q2 = (1, 1) point in different directions. A faint grid of lines parallel to each shows that their combinations cover the plane, and x = (3, 1) is reached by one copy of q1 followed by two copies of q2. Enough directions, and only one recipe per point Ordinary coordinates Two parallel references “East” and “more east.” 0 e1​ 2e1​ x = (3, 1) can't get here Every combination stays on the line. And (2, 0) is 2e1​ or 1 × 2e1​: two recipes. Two different directions q1​ and q2​ form a basis. 0 q1​ q2​ x = q1​ + 2q2​ Two directions reach every point of the plane, each in exactly one way. A basis reaches every point, and gives each point exactly one description.
Enough directions, and only one recipe per point. Left: with e₁ and 2e₁, every combination stays on the horizontal line, and even points on the line have two descriptions. Right: q₁ and q₂ point in different directions, so their combinations tile the whole plane, and each point gets exactly one recipe.

Reference arrows span the plane if their combinations reach every point. They are linearly independent if none is a combination of the others. Together, these properties give enough directions and a unique recipe.

The arrows e₁ and 2e₁ fail both tests. They only reach the horizontal line, and even there a point can have different recipes: (2, 0) is two copies of e₁ or one copy of 2e₁.

We can now understand every input from the matrix’s responses along its eigenvector lines. Next, we will see why perpendicular reference directions are especially useful.

8. Why perpendicular unit directions help

Perpendicular pieces have squared lengths that add

Our split is x = (1, −1) + (2, 2). The pieces are perpendicular, so each one is the projection of x onto its line. Their squared lengths are 2 and 8, giving x a squared length of 10.

This lets us say exactly how x’s squared length is shared: 20% along the first eigenvector line and 80% along the second. These percentages describe squared length, not ordinary length.

Use reference arrows of length one

Our original reference arrows q₁ and q₂ each have length √2. Divide each by √2 to get unit reference arrows:

u₁ = (1, −1)/√2    u₂ = (1, 1)/√2

This changes the size of a reference step. It does not change x or its pieces. The same pieces now need √2 steps along u₁ and 2√2 steps along u₂.

Change the reference steps while keeping the whole input fixedTwo complete decompositions use ordinary coordinates and the same scale. In each, the teal input x=(3,1), blue component (1,-1), and orange component (2,2) have the same endpoints. Ticks on the components mark equal reference steps. With the original references q1 and q2, a step has length square root two; the coefficients are 1 and 2. With unit references u1 and u2, a step has length one; the coefficients become square root two and twice square root two. Only the measuring steps and coefficients change. The input and its two components stay fixed. Shorter reference steps; the whole input stays fixed Ordinary coordinates; both panels use the same scale Use references q1​, q2​ One tick step has length √2. x1​ x2​ 0 (1, −1) (2, 2) x (3, 1) Blue component: 1 × q1​ Orange component: 2 × q2​ Use unit references u1​, u2​ One tick step has length 1. x1​ x2​ 0 (1, −1) (2, 2) x (3, 1) Blue component: √2 × u1​ Orange component: 2√2 × u2​ The references get shorter. The coefficients grow. The arrow tips do not move.
Change the reference steps while keeping the whole input fixedTwo complete decompositions use ordinary coordinates and the same scale. In each, the teal input x=(3,1), blue component (1,-1), and orange component (2,2) have the same endpoints. Ticks on the components mark equal reference steps. With the original references q1 and q2, a step has length square root two; the coefficients are 1 and 2. With unit references u1 and u2, a step has length one; the coefficients become square root two and twice square root two. Only the measuring steps and coefficients change. The input and its two components stay fixed. Change the measuring steps. Keep the whole x fixed. Ordinary coordinates; same scale Use references q1​, q2​ One tick step has length √2. x1​ x2​ 0 (1, −1) (2, 2) x (3, 1) Blue component: 1 × q1​ Orange component: 2 × q2​ Use unit references u1​, u2​ One tick step has length 1. x1​ x2​ 0 (1, −1) (2, 2) x (3, 1) Blue component: √2 × u1​ Orange component: 2√2 × u2​ The arrow tips have not moved.
The whole input and its two pieces stay fixed. The reference steps get shorter, so we need more of them: √2 copies of u₁ and 2√2 copies of u₂. Both drawings use the same scale.

Because the references are unit length, a coefficient’s absolute value is the length of its piece. Squaring the coefficient gives that piece’s squared length. Projection finds the coefficients with a dot product:

Reference Coefficient Squared length of the piece
u₁ c₁ = x · u₁ = √2 c₁² = 2
u₂ c₂ = x · u₂ = 2√2 c₂² = 8

A basis with perpendicular, length-one arrows is called orthonormal. The word packages the two properties we just used.

Why does our matrix allow this?

M has matching entries across its main diagonal: the upper-right and lower-left entries are both 1. A matrix with this mirror property is called symmetric. Swapping its rows and columns leaves it unchanged, written Mᵀ = M.

Comic: M admires its reflectionM, the matrix-headed character, stands beside a big drawing of itself: the entries 2 1 over 1 2 in brackets, with a dashed main diagonal through both 2s and curved arrows swapping the two 1s across it. M says: Flip me across my main diagonal and I look exactly the same. B says: Show-off. Lettering at the top right reads: Symmetric: M transpose equals M. 2 1 1 2 2 1 1 2 Flip me across my main diagonal and I look exactly the same. Symmetric: MT​ = M Show-off.
M admires its reflection
alt-text

Symmetry pays off: the spectral theorem guarantees a real symmetric matrix real eigenvalues and a full set of perpendicular eigenvectors. It's the 'batteries included' theorem.

The spectral theorem says that every real symmetric matrix has an orthonormal basis of eigenvectors, with real eigenvalues. We can choose enough perpendicular unit eigenvectors to describe every input.

For M, the recipe is now simple: project the input onto the two eigenvector lines, multiply each piece by its eigenvalue, then add the results.

What the spectral theorem says about MTwo panels in ordinary coordinates. Left: the dashed unit circle of all length-one inputs and, in teal, the ellipse their outputs land on after applying M. The ellipse's axes lie along the two eigenlines: it reaches 1 along u1, where M multiplies by 1, and 3 along u2, where M multiplies by 3. The unit input x-hat and its output M x-hat on the ellipse are drawn as a sample. Right: the recipe for x = (3, 1). Dashed drops give its shadows on the eigenlines, (1, -1) and (2, 2). The first is multiplied by 1 and stays put; the second is multiplied by 3 to give (6, 6). Added tip to tail, 1 times (1, -1) plus 3 times (2, 2) equals (7, 5), which is M x. The spectral theorem in a picture M scales two perpendicular pieces by 1 and 3 Every unit input, before and after ×1 along u1​, ×3 along u2​ 0 u1​ stays: ×1 u2​ → 3u2​: ×3 Mx̂ x̂ unit inputs their outputs Circle in, ellipse out. The ellipse's axes are the eigenlines. The recipe, on x = (3, 1) shadows → stretch each → add 0 shadow (1, −1) ×1: stays shadow (2, 2) ×3 → (6, 6) Mx x 1 × (1, −1) + 3 × (2, 2) = (7, 5) = Mx. Shadow, stretch, add. Scale the perpendicular eigenvector pieces, then add them. That's the theorem.
What the spectral theorem says about MTwo panels in ordinary coordinates. Left: the dashed unit circle of all length-one inputs and, in teal, the ellipse their outputs land on after applying M. The ellipse's axes lie along the two eigenlines: it reaches 1 along u1, where M multiplies by 1, and 3 along u2, where M multiplies by 3. The unit input x-hat and its output M x-hat on the ellipse are drawn as a sample. Right: the recipe for x = (3, 1). Dashed drops give its shadows on the eigenlines, (1, -1) and (2, 2). The first is multiplied by 1 and stays put; the second is multiplied by 3 to give (6, 6). Added tip to tail, 1 times (1, -1) plus 3 times (2, 2) equals (7, 5), which is M x. The spectral theorem in a picture M scales two perpendicular pieces by 1 and 3 Every unit input, before and after ×1 along u1​, ×3 along u2​ 0 u1​ stays: ×1 u2​ → 3u2​: ×3 Mx̂ x̂ unit inputs their outputs Circle in, ellipse out. The ellipse's axes are the eigenlines. The recipe, on x = (3, 1) shadows → stretch each → add 0 shadow (1, −1) ×1: stays shadow (2, 2) ×3 → (6, 6) Mx x 1 × (1, −1) + 3 × (2, 2) = (7, 5) = Mx. Shadow, stretch, add. Scale perpendicular eigenvector pieces, then add them. That's the theorem.
For M, scale each piece and add. The first piece stays the same; the second triples. Their sum is (7, 5). The left panel shows all unit inputs forming a circle and their outputs forming an ellipse. The whole arrow can turn because its two pieces grow by different amounts.

Each eigenvector piece stays on its own line. The complete input can still turn. For a different symmetric matrix, a multiplier can also be negative, reversing a piece, or zero, removing it.

Optional: what can go wrong without symmetry?

Consider A with rows (1, 1) and (0, 2). Its eigenvector lines, through (1, 0) and (1, 1), meet at 45° rather than 90°.

Perpendicular eigenvectors are a symmetric matrix's privilegeTwo panels. Left: for the symmetric matrix M, with rows (2, 1) and (1, 2), the eigenvector lines through q1 = (1, -1) and q2 = (1, 1) meet at a right angle, marked 90 degrees. Right: for the matrix A with rows (1, 1) and (0, 2), which is not symmetric, the eigenvector lines run through (1, 0), with eigenvalue 1, and (1, 1), with eigenvalue 2. They meet at 45 degrees. Was our matrix just lucky? Eigenvector lines for two different matrices Our M: eigenlines at 90° M has rows (2, 1) and (1, 2). 0 q1​ (λ = 1) q2​ (λ = 3) 90° Matching off-diagonal entries: symmetric. Another matrix: eigenlines at 45° A has rows (1, 1) and (0, 2). 0 (1, 0), λ = 1 (1, 1), λ = 2 45° The 1 and the 0 don't match: not symmetric. Symmetry guarantees perpendicular eigenlines: the spectral theorem.
Perpendicular eigenvectors are a symmetric matrix's privilegeTwo panels. Left: for the symmetric matrix M, with rows (2, 1) and (1, 2), the eigenvector lines through q1 = (1, -1) and q2 = (1, 1) meet at a right angle, marked 90 degrees. Right: for the matrix A with rows (1, 1) and (0, 2), which is not symmetric, the eigenvector lines run through (1, 0), with eigenvalue 1, and (1, 1), with eigenvalue 2. They meet at 45 degrees. Was our matrix just lucky? Eigenvector lines for two different matrices Our M: eigenlines at 90° M has rows (2, 1) and (1, 2). 0 q1​ (λ = 1) q2​ (λ = 3) 90° Matching off-diagonal entries: symmetric. Another matrix: eigenlines at 45° A has rows (1, 1) and (0, 2). 0 (1, 0), λ = 1 (1, 1), λ = 2 45° The 1 and the 0 don't match: not symmetric. Symmetry guarantees perpendicular eigenlines: the spectral theorem.
Not every matrix gives perpendicular eigenlines. Left: M's two eigenlines meet at 90°. Right: the matrix A with rows (1, 1) and (0, 2) has eigenlines through (1, 0) and (1, 1), only 45° apart. Rotation by 90° is worse still: it knocks every arrow off its line, so it has no real eigenvectors at all.

We can still use these two directions as coordinates: x = 2(1, 0) + (1, 1). But projecting x onto either line does not recover the corresponding piece, because the other piece also has a component along that line.

What perpendicular eigenlines buy usTwo panels in ordinary coordinates, both splitting x = (3, 1) along a matrix's eigenlines. Left, M's eigenlines, which are perpendicular: the pieces (1, -1) and (2, 2) are drawn from the origin. Dashed perpendiculars dropped from the tip of x onto each eigenline land exactly on the tips of the pieces, and the squared lengths 2 and 8 add to 10, the squared length of x. Right, A's eigenlines, 45 degrees apart: the pieces are (2, 0) and (1, 1). The perpendicular from x onto the horizontal line lands at (3, 0), one unit past the piece's tip, and the one onto the diagonal lands at (2, 2), past the piece (1, 1). The squared lengths 4 and 2 add to 6, not 10. What do perpendicular pieces buy us? The same x = (3, 1), split along each matrix's eigenlines M's eigenlines, 90° apart x = (1, −1) + (2, 2) 0 piece (1, −1) = its shadow piece (2, 2) = its shadow x drops Squared lengths: 2 + 8 = 10 = ||x||2​. The dashed drops land on the piece tips. A's eigenlines, 45° apart x = 2 (1, 0) + 1 (1, 1) 0 piece (2, 0) shadow (3, 0) piece (1, 1) shadow (2, 2) x Squared lengths: 4 + 2 = 6, not 10. Each shadow overshoots its piece. Perpendicular pieces don't overlap: a shadow finds each piece, and squared lengths add.
What perpendicular eigenlines buy usTwo panels in ordinary coordinates, both splitting x = (3, 1) along a matrix's eigenlines. Left, M's eigenlines, which are perpendicular: the pieces (1, -1) and (2, 2) are drawn from the origin. Dashed perpendiculars dropped from the tip of x onto each eigenline land exactly on the tips of the pieces, and the squared lengths 2 and 8 add to 10, the squared length of x. Right, A's eigenlines, 45 degrees apart: the pieces are (2, 0) and (1, 1). The perpendicular from x onto the horizontal line lands at (3, 0), one unit past the piece's tip, and the one onto the diagonal lands at (2, 2), past the piece (1, 1). The squared lengths 4 and 2 add to 6, not 10. What do perpendicular pieces buy us? The same x = (3, 1), split along each matrix's eigenlines M's eigenlines, 90° apart x = (1, −1) + (2, 2) 0 piece (1, −1) = its shadow piece (2, 2) = its shadow x drops Squared lengths: 2 + 8 = 10 = ||x||2​. The dashed drops land on the piece tips. A's eigenlines, 45° apart x = 2 (1, 0) + 1 (1, 1) 0 piece (2, 0) shadow (3, 0) piece (1, 1) shadow (2, 2) x Squared lengths: 4 + 2 = 6, not 10. Each shadow overshoots its piece. Perpendicular pieces don't overlap: a shadow finds each piece, and squared lengths add.
Perpendicular pieces make two calculations easy. On the left, each projection finds the corresponding piece, and squared lengths add: 2 + 8 = 10. On the right, the reference lines are slanted. Projections no longer recover the pieces, and 4 + 2 is not the whole input's squared length, 10.

The squared lengths of the pieces are 4 and 2. They add to 6, not 10. The full formula has an extra term: ‖a + b‖² = ‖a‖² + 2a · b + ‖b‖². Here that extra term is 4. Perpendicular pieces make it zero.

So eigenvector coordinates alone do not give all our shortcuts. We need perpendicular eigenvectors. Some matrices, such as a 90° rotation, do not even have real eigenvectors.

Optional: why different eigenvalues give perpendicular eigenvectors

Let v and w be eigenvectors of a real symmetric matrix M, with eigenvalues α and β. Symmetry lets us move M from one side of the dot product to the other: vᵀMw = (Mv)ᵀw. Substituting Mw = βw and Mv = αv gives β(v · w) = α(v · w). If α and β are different, this can hold only when v · w = 0. So the vectors are perpendicular. The full spectral theorem also guarantees enough eigenvectors to form a basis, including when eigenvalues repeat; within a repeated eigenvalue’s space we simply choose perpendicular ones.

Optional: two different things can be normalized

Normalize the references: make the measuring steps unit length. The input stays fixed, and its coefficients change.

Normalize the input: resize x itself to length one. The reference steps stay fixed, and all of x’s pieces resize together.

Two different things can be normalizedTwo panels in ordinary coordinates at the same scale, each showing the eigenvector split of the input. Left, normalizing the references: x = (3, 1) and its components (1, -1) and (2, 2) stay exactly where they were; short dark unit arrows u1 and u2 mark the new one-unit measuring steps, so the coefficients change from 1 and 2 to root 2 and 2 root 2. Right, normalizing the input: the unit references stay fixed while x shrinks to x-hat = (3, 1) divided by root 10, whose tip sits on the dashed unit circle; both components shrink with it, to 0.447 along u1 and 0.894 along u2. A faint copy of the original x remains for comparison. Which thing shrank? Same two directions in both panels; same drawing scale Normalize the references New one-unit steps u1​ and u2​. 0 u1​ u2​ (1, −1) = √2 u1​ (2, 2) = 2√2 u2​ x x and its pieces don't move. Coefficients: 1, 2 → √2, 2√2 Normalize the input Shrink x to length one. 0 u1​ u2​ 0.447 u1​ 0.894 u2​ x̂ original x length 1 Everything shrinks by √10, together. Coefficients: √2, 2√2 → 0.447, 0.894 Left: shorter measuring sticks, same arrow. Right: same sticks, shorter arrow.
Two different things can be normalizedTwo panels in ordinary coordinates at the same scale, each showing the eigenvector split of the input. Left, normalizing the references: x = (3, 1) and its components (1, -1) and (2, 2) stay exactly where they were; short dark unit arrows u1 and u2 mark the new one-unit measuring steps, so the coefficients change from 1 and 2 to root 2 and 2 root 2. Right, normalizing the input: the unit references stay fixed while x shrinks to x-hat = (3, 1) divided by root 10, whose tip sits on the dashed unit circle; both components shrink with it, to 0.447 along u1 and 0.894 along u2. A faint copy of the original x remains for comparison. Which thing shrank? Same two directions in both panels; same drawing scale Normalize the references New one-unit steps u1​ and u2​. 0 u1​ u2​ (1, −1) = √2 u1​ (2, 2) = 2√2 u2​ x x and its pieces don't move. Coefficients: 1, 2 → √2, 2√2 Normalize the input Shrink x to length one. 0 u1​ u2​ 0.447 u1​ 0.894 u2​ x̂ original x length 1 Everything shrinks by √10, together. Coefficients: √2, 2√2 → 0.447, 0.894 Left: shorter measuring sticks, same arrow. Right: same sticks, shorter arrow.
Which thing shrank? Left: normalizing the references shortens the measuring sticks; x and its pieces stay put and the coefficients grow. Right: normalizing the input, as we did with x̂ in Chapter 4, shrinks x and both of its pieces together, by the same factor, while the sticks stay fixed.

For x, normalizing the input gives x̂ = (3, 1)/√10. Its two squared-length shares are still 20% and 80%.

9. A score from the input and output

First calculate the score at the original size

Our input is x = (3, 1), and its output is Mx = (7, 5). Dot the two together:

Q(x) = x · Mx = 3 × 7 + 1 × 5 = 26

The letter Q names the score. Another way to write the same dot product is xᵀMx. Do not confuse this score with the output arrow or its squared length:

Calculation Answer What it measures
Mx (7, 5) The output arrow.
Q(x) = x · Mx 26 The dot product of input and output.
‖Mx‖² 74 The output’s squared length.

The raw score changes when the input changes size

Double x and Mx also doubles. Both arrows in the dot product are now twice as large, so the score becomes four times as large. This “size squared” behavior is why Q is called a quadratic form.

To compare directions fairly, first give every input length one. Our x has length √10, so its unit version is x̂ = (3, 1)/√10. Dividing the input by √10 also divides the output by √10. Their dot product is therefore divided by 10:

Q(x̂) = 26/10 = 2.6

For a unit input, the score is the signed amount of the output along the input’s direction. It measures the output’s projection onto that line. Any sideways part contributes zero to the dot product.

Compare the along-input output for three unit inputsThree ordinary-coordinate plots have the same coordinate scale and inputs of length one. The teal arrow is the input, orange its output, and blue the output component along the input line. The gray dashed arrow runs from that component’s tip to the output’s tip. Along u1 the score is 1 and the output equals the input. Along x-hat=(3,1)/sqrt(10), the score is 2.6, and the output has a nonzero perpendicular remainder. Along u2 the score is 3 and the output is three times the input. In both eigenvector directions, the output and its along-input component coincide. Same input length, different along-input output Ordinary coordinates; all three plots use the same scale First eigenvector 0 u1​ Mu1​ = u1​ Score 1 Input length 1 The running direction 0 x̂ Mx̂ 2.6x̂ Perpendicular remainder Score 2.6 Input length 1 Second eigenvector 0 u2​ Mu2​ = 3u2​ Score 3 Input length 1 Input Output Output along input Perpendicular remainder The blue arrow is the output’s component along the teal input.
Compare the along-input output for three unit inputsThree ordinary-coordinate plots have the same coordinate scale and inputs of length one. The teal arrow is the input, orange its output, and blue the output component along the input line. The gray dashed arrow runs from that component’s tip to the output’s tip. Along u1 the score is 1 and the output equals the input. Along x-hat=(3,1)/sqrt(10), the score is 2.6, and the output has a nonzero perpendicular remainder. Along u2 the score is 3 and the output is three times the input. In both eigenvector directions, the output and its along-input component coincide. Same input length, different along-input output Ordinary coordinates; same scale The running direction 0 Input x̂ Mx̂ 2.6x̂ Perpendicular remainder Score 2.6 Input length 1 Along the first eigenvector 0 Input u1​ Mu1​ = u1​ Score 1 Input length 1 No perpendicular remainder Along the second eigenvector 0 Input u2​ Mu2​ = 3u2​ Score 3 Input length 1 No perpendicular remainder Blue: output along the input line
Same input length, different amounts of output along it. All three inputs have length one. Along u₁ the amount is 1, along x̂ it is 2.6, along u₂ it is 3. The mixed input's output has a sideways part; the eigenvector inputs' outputs don't.

For x̂, that amount is 2.6. For the unit eigenvectors u₁ and u₂, it is 1 and 3. Along an eigenvector, the whole output stays on the input’s line, so the unit-input score is exactly the eigenvalue.

Why does our direction score 2.6?

Chapter 8 split x’s squared length into 20% along u₁ and 80% along u₂. Resizing x to length one keeps these same shares. M multiplies the first piece by 1 and the second by 3, so:

Q(x̂) = 20% × 1 + 80% × 3 = 2.6

The score is a weighted average of the eigenvalues. The weights are shares of squared length. They cannot be negative, and they add to 100%.

Every unit input's score is a blend of the two eigenvaluesFour unit inputs, one per row: u1, x-hat, the horizontal axis direction (1, 0), and u2. For each, a bar shows its split of squared length between u1 (blue) and u2 (orange): 100 and 0, 20 and 80, 50 and 50, 0 and 100. Beside each bar a dot marks the input's score on a scale from 1, the eigenvalue of u1, to 3, the eigenvalue of u2: the scores are 1, 2.6, 2 and 3. Each dot sits the u2 share of the way from 1 to 3. Every unit input's score is a blend of 1 and 3 The input's shares of squared length are the weights unit input share along u1​ | share along u2​ score, between λ1​ = 1 and λ2​ = 3 1 (λ1​) 2 3 (λ2​) u1​ all along u1​ 100% 1 x̂ x̂ = (3, 1)/√10 20% 80% 2.6 (1, 0) the horizontal axis 50% 50% 2 u2​ all along u2​ 100% 3 Each dot sits exactly the u2​ share of the way from 1 to 3.
Every unit input's score is a blend of the two eigenvaluesFour unit inputs, one per row: u1, x-hat, the horizontal axis direction (1, 0), and u2. For each, a bar shows its split of squared length between u1 (blue) and u2 (orange): 100 and 0, 20 and 80, 50 and 50, 0 and 100. Beside each bar a dot marks the input's score on a scale from 1, the eigenvalue of u1, to 3, the eigenvalue of u2: the scores are 1, 2.6, 2 and 3. Each dot sits the u2 share of the way from 1 to 3. Every unit input's score is a blend of 1 and 3 The shares of squared length are the weights 1 (λ1​) 2 3 (λ2​) u1​ all along u1​ 100% 1 x̂ x̂ = (3, 1)/√10 20% 80% 2.6 (1, 0) the horizontal axis 50% 50% 2 u2​ all along u2​ 100% 3 The dot sits the u2​ share of the way from 1 to 3.
Every unit input's score sits between 1 and 3. The bar is the input's split of squared length between u₁ and u₂; the dot is its score, placed that same fraction of the way from λ₁ = 1 to λ₂ = 3. u₁ and u₂ sit at the two ends, the horizontal axis direction (1, 0) is a 50/50 mix and scores 2, and x̂ is 80% of the way toward 3.

More share along u₁ moves the score toward 1. More share along u₂ moves it toward 3. Every unit input’s score stays between those two values.

Optional: why each piece contributes its eigenvalue times its squared amount

Let c be the input’s signed coefficient along one unit eigenvector. Its output coefficient is λc. That piece’s contribution to the dot product is therefore c × λc = λc².

Why the unit input x-hat scores 2.6Left: ordinary coordinates with the dashed unit circle. The unit input x-hat is split into a blue piece 0.447 u1 and an orange piece 0.894 u2, drawn tip to tail. Their outputs, drawn faintly, are the blue piece unchanged (multiplier 1) and the orange piece tripled to 2.683 u2 (multiplier 3); tip to tail they reach the output M x-hat = (7, 5) divided by root 10. Right: a ledger. The u1 piece contributes input amount 0.447 times output amount 1 times 0.447, which is 0.2. The u2 piece contributes 0.894 times 3 times 0.894, which is 2.4. The total score is 2.6, the same as 1 times the 20 percent share plus 3 times the 80 percent share. Why does x̂ score 2.6? Each eigenvector piece is scored on its own line; then the pieces add Where each piece goes Ordinary coordinates; dashed circle = length 1 0 0.447 u1​ (× 1: stays put) 0.894 u2​ × 3: 2.683 u2​ x̂ Mx̂ Faint arrow: where M sends the orange piece. Score, piece by piece input amount × output amount piece input amount × output amount = u1​ 0.447 1 × 0.447 0.2 u2​ 0.894 3 × 0.894 2.4 Q(x̂) = 0.2 + 2.4 = 2.6 The same sum, read as shares: Q(x̂) = 1 × 0.2 + 3 × 0.8 eigenvalue × share of squared length 0.4472​ = 0.2 and 0.8942​ = 0.8: the shares are the squared coefficients. Score each piece on its own line, then add: 0.2 + 2.4 = 2.6.
Why the unit input x-hat scores 2.6Left: ordinary coordinates with the dashed unit circle. The unit input x-hat is split into a blue piece 0.447 u1 and an orange piece 0.894 u2, drawn tip to tail. Their outputs, drawn faintly, are the blue piece unchanged (multiplier 1) and the orange piece tripled to 2.683 u2 (multiplier 3); tip to tail they reach the output M x-hat = (7, 5) divided by root 10. Right: a ledger. The u1 piece contributes input amount 0.447 times output amount 1 times 0.447, which is 0.2. The u2 piece contributes 0.894 times 3 times 0.894, which is 2.4. The total score is 2.6, the same as 1 times the 20 percent share plus 3 times the 80 percent share. Why does x̂ score 2.6? Each eigenvector piece is scored on its own line; then the pieces add Where each piece goes Ordinary coordinates; dashed circle = length 1 0 0.447 u1​ (× 1: stays put) 0.894 u2​ × 3: 2.683 u2​ x̂ Mx̂ Faint arrow: where M sends the orange piece. Score, piece by piece input amount × output amount piece input amount × output amount = u1​ 0.447 1 × 0.447 0.2 u2​ 0.894 3 × 0.894 2.4 Q(x̂) = 0.2 + 2.4 = 2.6 The same sum, read as shares: Q(x̂) = 1 × 0.2 + 3 × 0.8 eigenvalue × share of squared length 0.4472​ = 0.2 and 0.8942​ = 0.8: the shares are the squared coefficients. Score each piece on its own line, then add: 0.2 + 2.4 = 2.6.
Two pieces, two multipliers, one score. The u₁ piece of x̂ has squared length 0.2 and multiplier 1; the u₂ piece has squared length 0.8 and multiplier 3. Their input-times-output products, 0.2 and 2.4, add to 2.6.

For a unit input, the squared coefficients add to one, so they are already shares. For the original x, they add to 10. Its score is 1 × 2 + 3 × 8 = 26.

The matrix scales the two eigenvector coordinates separatelyThe orthonormal eigenvectors u1 and u2 form perpendicular coordinate axes. The input x has coordinates square root two and twice square root two. Applying M preserves the first coordinate and triples the second. Their squared lengths are 2 and 8. Multiplying by the eigenvalues 1 and 3 gives quadratic-form contributions 2 and 24. The squared norm is 10 and the quadratic form is 26. Each eigenvector component has its own score These axes follow the unit eigenvectors u1​ and u2​. u1​ u2​ 0 2 4 6 8 2 4 6 Mx x c1​ stays fixed; c2​ triples. Direction Squared length ci​2​ Score λi​ci​2​ u1​ 2 2 u2​ 8 24 Total 10 26 ||x||2​ = 10; xT​Mx = 26 Same input, two measurements.
Size and score use the same pieces differently. Squared length counts each squared coefficient once. The score gives the u₂ piece a multiplier of 3.

Written in ordinary coordinates, this same score is Q(x) = 2x₁² + 2x₁x₂ + 2x₂².

Optional: why we cannot score just any pieces and add

The shortcut works for perpendicular eigenvector pieces. Here is why both conditions matter. Split the original input along the ordinary axes: a = (3, 0) and b = (0, 1). Their scores are 18 and 2, adding to 20. But the whole input scores 26. Where are the other 6?

Comic: the case of the missing sixPanel 1: B, in a detective's hat, studies a board through a magnifying glass. The board reads Q(a) + Q(b) = 20 and Q(x) = 26. B says: Six points of score. Gone. Panel 2: B points at two cards reading a · Mb = 3 and b · Ma = 3, and says: The cross terms. It's always the cross terms. Panel 3: A asks: And in the eigenvector split? B says: Airtight alibis. Both zero. Q(a) + Q(b) = 20 Q(x) = 26 Six points of score. Gone. a · Mb = 3 b · Ma = 3 The cross terms. It's always the cross terms. And in the eigenvector split? Airtight alibis. Both zero.
Comic: the case of the missing sixPanel 1: B, in a detective's hat, studies a board through a magnifying glass. The board reads Q(a) + Q(b) = 20 and Q(x) = 26. B says: Six points of score. Gone. Panel 2: B points at two cards reading a · Mb = 3 and b · Ma = 3, and says: The cross terms. It's always the cross terms. Panel 3: A asks: And in the eigenvector split? B says: Airtight alibis. Both zero. Q(a) + Q(b) = 20 Q(x) = 26 Six points of score. Gone. a · Mb = 3 b · Ma = 3 The cross terms. It's always the cross terms. And in the eigenvector split? Airtight alibis. Both zero.
the case of the missing six
alt-text

In fairness to the cross terms, they never took anything. They were part of Q(x) all along; adding Q(a) and Q(b) just leaves them out.

The full score pairs each input piece with each output piece. There are four dot products:

Q(a + b) = Q(a) + Q(b) + a · Mb + b · Ma

The last two are called cross terms. Here each equals 3, so the full total is 18 + 2 + 3 + 3 = 26.

The score as a two-by-two table of dot productsTwo panels, each a two-by-two table whose rows are the input pieces of x = (3, 1) and whose columns are the output pieces. Each cell is one dot product and all four cells add to Q(x) = 26. Left, the ordinary split x = a + b with a = (3, 0) and b = (0, 1): the diagonal cells a dot Ma = 18 and b dot Mb = 2 are the piece scores, and the off-diagonal cross terms a dot Mb and b dot Ma are 3 each, the missing six. Right, the eigenvector split x = q1 + 2 q2: the diagonal cells are 2 and 24, and both cross terms are 0. The score is a 2 × 2 table Every input piece, dotted with every output piece; the four cells add to Q(x) Ordinary split: x = a + b Perpendicular pieces, but not eigenvectors output pieces → Ma = (6, 3) Mb = (1, 2) input ↓ a = (3, 0) b = (0, 1) a · Ma 18 a · Mb 3 b · Ma 3 b · Mb 2 Piece scores (diagonal): 18 + 2 = 20. Cross terms: 3 + 3 = 6, the missing six. All four cells: 26 = Q(x). Eigenvector split: x = q1​ + 2q2​ Perpendicular pieces that are eigenvectors output pieces → Mq1​ = (1, −1) M(2q2​) = (6, 6) input ↓ q1​ = (1, −1) 2q2​ = (2, 2) q1​ · Mq1​ 2 q1​ · M(2q2​) 0 2q2​ · Mq1​ 0 2q2​ · M(2q2​) 24 Piece scores (diagonal): 2 + 24 = 26. Cross terms: 0 + 0. Nothing missing. All four cells: 26 = Q(x). Eigenvector pieces empty the cross-term cells, so the piece scores are the whole score.
The score as a two-by-two table of dot productsTwo panels, each a two-by-two table whose rows are the input pieces of x = (3, 1) and whose columns are the output pieces. Each cell is one dot product and all four cells add to Q(x) = 26. Left, the ordinary split x = a + b with a = (3, 0) and b = (0, 1): the diagonal cells a dot Ma = 18 and b dot Mb = 2 are the piece scores, and the off-diagonal cross terms a dot Mb and b dot Ma are 3 each, the missing six. Right, the eigenvector split x = q1 + 2 q2: the diagonal cells are 2 and 24, and both cross terms are 0. The score is a 2 × 2 table Every input piece, dotted with every output piece; the four cells add to Q(x) Ordinary split: x = a + b Perpendicular pieces, but not eigenvectors output pieces → Ma = (6, 3) Mb = (1, 2) input ↓ a = (3, 0) b = (0, 1) a · Ma 18 a · Mb 3 b · Ma 3 b · Mb 2 Piece scores (diagonal): 18 + 2 = 20. Cross terms: 3 + 3 = 6, the missing six. All four cells: 26 = Q(x). Eigenvector split: x = q1​ + 2q2​ Perpendicular pieces that are eigenvectors output pieces → Mq1​ = (1, −1) M(2q2​) = (6, 6) input ↓ q1​ = (1, −1) 2q2​ = (2, 2) q1​ · Mq1​ 2 q1​ · M(2q2​) 0 2q2​ · Mq1​ 0 2q2​ · M(2q2​) 24 Piece scores (diagonal): 2 + 24 = 26. Cross terms: 0 + 0. Nothing missing. All four cells: 26 = Q(x). Eigenvector pieces empty the cross-term cells, so the piece scores are the whole score.
The score is a two-by-two table. Rows are input pieces, columns are output pieces, each cell is one dot product, and all four cells add up to Q(x) = 26. Left, the ordinary split: the diagonal holds the piece scores 18 and 2, and the cross terms hold the missing 3 + 3. Right, the eigenvector split x = q₁ + 2q₂: the cross terms are zero, so the piece scores 2 + 24 are the whole story.

Why does the eigenvector split avoid this? Each output piece stays on its own eigenvector line. Those lines are perpendicular, so an input piece dotted with the other piece’s output gives zero.

Perpendicular components need not have additive quadratic scoresBoth panels use x=(3,1) and M with rows (2,1) and (1,2), on identical coordinate scales. In the ordinary-coordinate split, a=(3,0) and b=(0,1) are perpendicular, but Mb=(1,2) turns toward a. The separate scores are 18 and 2; cross terms of 3 each bring their sum to 26. In the eigenvector split, a=(1,-1) and b=(2,2) are perpendicular. Mb=(6,6) stays on the line of b and remains perpendicular to a. The separate scores are 2 and 24, and both cross terms are zero. A right angle between the input pieces is not enough Same x = (3, 1), same M. Start with perpendicular a and b. Ordinary coordinate split a = (3, 0), b = (0, 1) x1​ x2​ 0 2 4 6 x a b Mb Mb turns toward a Q(a) + Q(b) = 18 + 2 = 20 Q(x) = 20 + 3 + 3 = 26 Eigenvector split a = (1, −1), b = (2, 2) x1​ x2​ 0 2 4 6 x a b Mb Mb stays perpendicular to a Q(a) + Q(b) = 2 + 24 = 26 Q(x) = 26 + 0 + 0 = 26 The extra terms are a · Mb and b · Ma.
Perpendicular components need not have additive quadratic scoresBoth panels use x=(3,1) and M with rows (2,1) and (1,2), on identical coordinate scales. In the ordinary-coordinate split, a=(3,0) and b=(0,1) are perpendicular, but Mb=(1,2) turns toward a. The separate scores are 18 and 2; cross terms of 3 each bring their sum to 26. In the eigenvector split, a=(1,-1) and b=(2,2) are perpendicular. Mb=(6,6) stays on the line of b and remains perpendicular to a. The separate scores are 2 and 24, and both cross terms are zero. A right angle between the input pieces is not enough Same x = (3, 1), same M. Start with perpendicular a and b. Ordinary coordinate split a = (3, 0), b = (0, 1) x1​ x2​ 0 2 4 6 x a b Mb Mb turns toward a Q(a) + Q(b) = 18 + 2 = 20 Q(x) = 20 + 3 + 3 = 26 Eigenvector split a = (1, −1), b = (2, 2) x1​ x2​ 0 2 4 6 x a b Mb Mb stays perpendicular to a Q(a) + Q(b) = 2 + 24 = 26 Q(x) = 26 + 0 + 0 = 26 The extra terms are a · Mb and b · Ma.
Compare the blue input a with the orange output Mb. In the ordinary-axis split, M turns b toward a, so a · Mb isn't zero. In the eigenvector split, b only gets stretched, so Mb stays perpendicular to a. Both panels start with perpendicular input pieces.

Perpendicular inputs alone are not enough: M can turn their outputs. Eigenvector inputs alone are not enough either: their lines also need to be perpendicular.

A practical example: how bumpy is a list?

Take the list (3, 1, 2). To measure its bumpiness, subtract neighboring entries, square each difference, and add:

(3 − 1)² + (1 − 2)² = 4 + 1 = 5

A step up and a step down of the same size cost the same. Larger steps cost more. A flat list costs zero because every neighboring difference is zero.

A score you could invent: how bumpy is a list of numbers?Three lists of three numbers, each drawn as three bars. The step between neighbouring bars is marked in orange, squared and added. Jagged list 3, 1, 2: steps 2 and 1, score 2 squared plus 1 squared = 5. Smooth list 1, 2, 3: steps 1 and 1, score 2. Flat list 2, 2, 2: steps 0 and 0, score 0. A score you could invent yourself Three numbers in a row. Square each step between neighbours, then add. jagged: 3, 1, 2 3 1 2 2 1 score = 22​ + 12​ = 5 smooth: 1, 2, 3 1 2 3 1 1 score = 12​ + 12​ = 2 flat: 2, 2, 2 2 2 2 0 0 score = 02​ + 02​ = 0 Big steps cost the most. A flat list scores zero, which is Chapter 13's problem.
A score you could invent: how bumpy is a list of numbers?Three lists of three numbers, each drawn as three bars. The step between neighbouring bars is marked in orange, squared and added. Jagged list 3, 1, 2: steps 2 and 1, score 2 squared plus 1 squared = 5. Smooth list 1, 2, 3: steps 1 and 1, score 2. Flat list 2, 2, 2: steps 0 and 0, score 0. A score you could invent yourself Three numbers in a row. Square each step between neighbours, then add. jagged: 3, 1, 2 3 1 2 2 1 score = 22​ + 12​ = 5 smooth: 1, 2, 3 1 2 3 1 1 score = 12​ + 12​ = 2 flat: 2, 2, 2 2 2 2 0 0 score = 02​ + 02​ = 0 Big steps cost the most. A flat list scores zero, which is Chapter 13's problem.
A score you could invent yourself. Three lists of three numbers, drawn as bars. Each step between neighbors is squared, and the squares are added. The jagged list scores 5, the smooth one 2, and the flat one 0. Chapter 13 deals with that zero.

This is another quadratic form. It can be written zᵀBz, using a three-entry input z and a new symmetric matrix B. B is different from our two-by-two M, but the same reasoning applies: perpendicular eigenvector pieces explain its score.

Chapter 11 will show how to remove the effect of input size without first drawing a unit arrow. Chapter 13 will use that fair comparison to find a smooth pattern in the three-entry list.

10. Can a nonzero input have score zero?

Our matrix M always gives a positive score

M’s eigenvalues are 1 and 3. Each eigenvector piece contributes a positive multiplier times its squared length. A nonzero input has at least one nonzero piece, so its total score is positive.

A real symmetric matrix whose score is positive for every nonzero input is called positive definite.

A different matrix can ignore a direction

Consider N, which keeps the horizontal coordinate and removes the vertical one:

N(a, b) = (a, 0)

The unit vertical input (0, 1) goes to (0, 0). Its score is zero, even though the input has length one. It is an eigenvector of N with eigenvalue zero.

A nonzero input can have zero output and zero scoreThis is a separate hypothetical transformation N, not the running matrix M. N sends (a,b) to (a,0). The nonzero vertical vector v=(0,1) is sent to the zero vector at the origin. Thus v is an eigenvector with eigenvalue zero and its quadratic score is zero. N is positive semidefinite, since the score of any input (a,b) is a squared. A zero eigenvalue collapses a nonzero direction Separate example: N sends (a, b) to (a, 0). v = (0, 1) Nonzero input Apply N Nv = 0 Zero output The input still has length 1. Its score is v · Nv = 0.
A length-one input scores zero. N sends the vertical arrow v to the origin, so v has eigenvalue zero. We got a zero score by picking a direction N ignores, not by shrinking the input. (N is a separate example, not M.)

For any input (a, b), N’s raw score is (a, b) · (a, 0) = a². It can be positive or zero, but never negative.

Comic: N's blind spotN, a character whose head is the matrix with rows 1 0 and 0 0, sits behind a desk handing out scores. Panel 1: B, in a beanie, points at a vertical arrow labeled v = (0, 1). N says: Score: zero. B says: Zero? I'm a whole arrow! Panel 2: The vertical arrow is now twice as tall, labeled (0, 2). B asks: Okay, how about now? N says: Still zero. Vertical is not my department. Panel 3: Away from the desk, B asks A: So am I... nothing? A says: Nope. A zero from N means "nothing N counts," not "nothing there." 1 0 0 0 N v = (0, 1) Score: zero. Zero? I'm a whole arrow! 1 0 0 0 N (0, 2) Okay. How about now? Still zero. Vertical is not my department. So am I... nothing? Nope. A zero from N means "nothing N counts," not "nothing there."
Comic: N's blind spotN, a character whose head is the matrix with rows 1 0 and 0 0, sits behind a desk handing out scores. Panel 1: B, in a beanie, points at a vertical arrow labeled v = (0, 1). N says: Score: zero. B says: Zero? I'm a whole arrow! Panel 2: The vertical arrow is now twice as tall, labeled (0, 2). B asks: Okay, how about now? N says: Still zero. Vertical is not my department. Panel 3: Away from the desk, B asks A: So am I... nothing? A says: Nope. A zero from N means "nothing N counts," not "nothing there." 1 0 0 0 N v = (0, 1) Score: zero. Zero? I'm a whole arrow! 1 0 0 0 N (0, 2) Okay. How about now? Still zero. Vertical is not my department. So am I... nothing? Nope. A zero from N means "nothing N counts," not "nothing there."
N's blind spot
alt-text

For a second opinion, ask M: it gives v = (0, 1) a score of 2. M is positive definite, so it has no blind spot: every nonzero arrow gets a positive score.

A real symmetric matrix whose scores are never negative is called positive semidefinite. It allows zero scores for nonzero inputs, but does not require them. Positive definite matrices are included in this broader group.

If we search for N’s lowest-scoring unit input, a vertical arrow wins with zero. That tells us which direction N ignores. To study its other directions, we would need to exclude that direction from the search.

The bumpiness score has a similar issue: a nonzero flat list scores zero because none of its entries differ. Chapter 13 removes that shared, flat component before comparing the remaining patterns.

Optional: compare all directions for M and N
Chart: the unit-input score of every direction, for M and for NA hand-drawn chart with two computed curves over directions from 0 to 180 degrees. The teal curve is M's unit-input score, 2 plus sine of twice the angle: it stays between 1 and 3, touching its floor of 1 at 135 degrees, on the q1 line. The red curve is N's unit-input score, cosine squared: it equals 1 at 0 and 180 degrees and drops to exactly zero at 90 degrees, the vertical direction that N ignores. A dashed blue line marks M's floor at 1. Two matrices, every direction's score 0 1 2 3 0° 45° 90° 135° 180° direction of the unit input score of a unit input M: positive everywhere, never below 1 q1​'s line: M's floor, 1 N: zero at 90°, the direction it ignores x scores 2.6 N's score is a2​, so a vertical arrow hands it nothing to count. M has no such direction.
Every direction's score, for M and for N
alt-text

N's curve is cos² of the angle. It touches zero at 90°, the vertical direction, and never goes below it. M's curve never dips under 1: every direction gets a positive score.

M’s unit-input scores stay between 1 and 3. N’s stay between 0 and 1: its score is simply the share of squared length along the horizontal direction.

Optional: what eigenvalues and sums of squares tell us

For a real symmetric matrix, all positive eigenvalues mean the matrix is positive definite. Eigenvalues that are all zero or positive mean it is positive semidefinite. A negative eigenvalue gives a negative score along its eigenvector.

For a positive semidefinite matrix, a zero score means the input lies entirely in directions that the matrix sends to zero. This conclusion needs the nonnegative eigenvalues. Otherwise, positive and negative contributions can cancel even when the output is not zero.

Sometimes a sum of squares proves the sign directly. For M:

Q(x) = x₁² + x₂² + (x₁ + x₂)²

If x is nonzero, at least one of the first two squares is positive. So the sum is positive. Bumpiness is also a sum of squares, which explains why it can never be negative.

11. Compare directions at the same size

Why the raw score needs a size correction

Our input x scores 26. Half of x scores only 6.5. It points in exactly the same direction, so the smaller score has not found a better direction. It has only made the input smaller.

Comic: the shrink rayPanel 1: B points a ray gun at the arrow x = (3, 1). ZAP. B says: Watch me get the smallest score ever. Panel 2: The arrow is now tiny. B cheers: Score 0.26! New record! A, holding a clipboard, says: You shrank it to a tenth of its length. Divide by squared length: 0.26 / 0.1 = 2.6. x ZAP Watch me get the smallest score ever. Score: 0.26! New record! You shrank it to a tenth of its length. Divide by squared length: 0.26 / 0.1 = 2.6.
Comic: the shrink rayPanel 1: B points a ray gun at the arrow x = (3, 1). ZAP. B says: Watch me get the smallest score ever. Panel 2: The arrow is now tiny. B cheers: Score 0.26! New record! A, holding a clipboard, says: You shrank it to a tenth of its length. Divide by squared length: 0.26 / 0.1 = 2.6. x ZAP Watch me get the smallest score ever. Score: 0.26! New record! You shrank it to a tenth of its length. Divide by squared length: 0.26 / 0.1 = 2.6.
the shrink ray
alt-text

Shrink rays are banned in competitive linear algebra for exactly this reason. The Rayleigh quotient is the rule that bans them.

When an input’s length doubles, both its raw score and its squared length multiply by four. Their ratio stays the same. This ratio is called the Rayleigh quotient, written R(x). “Quotient” simply means the result of a division.

R(x) = Q(x)‖x‖² = xᵀMxxᵀx

For x, it is 26/10 = 2.6. For half of x, it is 6.5/2.5 = 2.6. The quotient is the score the same direction would get at length one. The input must be nonzero, so the denominator is not zero.

Input Squared length Raw score Quotient
x̂ = (3, 1)/√10 1 2.6 2.6
x/2 = (1.5, 0.5) 2.5 6.5 2.6
x = (3, 1) 10 26 2.6
2x = (6, 2) 40 104 2.6
Optional: see why dividing by squared length works

A unit version of x is x/‖x‖. Its output is Mx/‖x‖. Dotting them divides the original score by ‖x‖ × ‖x‖ = ‖x‖². That is exactly the Rayleigh quotient.

Halving a vector preserves its direction and its Rayleigh quotientThe vectors x=(3,1) and x/2=(1.5,0.5) share an origin in the x1/x2 coordinate plane, with equal scale on both axes. The shorter arrow lies halfway along the longer arrow. Using M with rows (2,1) and (1,2), their squared norms are 10 and 2.5, and their quadratic scores are 26 and 6.5. Both quantities fall by a factor of four, while the quotient remains 2.6. A smaller score can come from a shorter input x1​ x2​ 0 1.5 0.5 3 1 x / 2 x One direction, two lengths x x / 2 Squared length 10 2.5 Quadratic score 26 6.5 Their ratio 2.6 2.6 Both fall to ¼; the ratio stays 2.6 Same direction. Half the length. The same Rayleigh quotient.
Resizing can't change the ratio. Both arrows point in the running example's direction. Their raw scores differ only because their sizes differ, and dividing by squared length removes exactly that.

Turn the input and watch the score change

Every input in the next experiment has length one. Drag to turn it, or use the buttons to select our running direction and the two eigenvector directions.

Turn a unit input and watch its score changeOrdinary coordinates show a teal unit input v, its orange output Mv, the blue output component Q(v)v along the input, and a dashed perpendicular remainder. The dashed circle is the set of all unit inputs. Initially v=(3,1)/sqrt(10), so its score is 2.6. A closer view of the same unit input shows its two perpendicular eigenvector components. Their signed coefficients are about 0.447 and 0.894, and their shares of squared length are 20 percent and 80 percent. Turning the input changes its score between 1 and 3. A chart at the bottom plots the score of every direction from -180 to 180 degrees, a wave between 1 and 3 that touches 3 at 45 and -135 degrees (the u2 line) and 1 at -45 and 135 degrees (the u1 line); a dot on the curve marks the current input. The optional resized copy does not change the unit input shown in these plots. Turn the input. Keep its length at 1. Ordinary coordinates in both pictures Input Output Output along input Perpendicular remainder Apply M and project its output Split the same input into pieces Closer view of the input -1 1 v Mv Q(v)v Dashed circle: all unit inputs c1​u1​ c2​u2​ v Signed amount Squared-length share c1​ = 0.447 20% c2​ = 0.894 80% 1 (λ1​) 2 3 (λ2​) Unit-input score: 2.6 The score for every direction at once The dot is the current input; the small dots at ±45° and ±135° are the eigenvector directions λ1​ = 1 λ2​ = 3 −180° −90° 0° 90° 180° 0 1 2 3
Turn a unit input and watch its score changeOrdinary coordinates show a teal unit input v, its orange output Mv, the blue output component Q(v)v along the input, and a dashed perpendicular remainder. The dashed circle is the set of all unit inputs. Initially v=(3,1)/sqrt(10), so its score is 2.6. A closer view of the same unit input shows its two perpendicular eigenvector components. Their signed coefficients are about 0.447 and 0.894, and their shares of squared length are 20 percent and 80 percent. Turning the input changes its score between 1 and 3. A chart at the bottom plots the score of every direction from -180 to 180 degrees, a wave between 1 and 3 that touches 3 at 45 and -135 degrees (the u2 line) and 1 at -45 and 135 degrees (the u1 line); a dot on the curve marks the current input. The optional resized copy does not change the unit input shown in these plots. Turn the input. Keep its length at 1. Ordinary coordinates in both pictures Input Output Output along input Perpendicular remainder -1 1 v Mv Q(v)v Dashed circle: all unit inputs The same input, split into pieces Closer view; ordinary coordinates c1​u1​ c2​u2​ v Signed amount Squared-length share c1​ = 0.447 20% c2​ = 0.894 80% 1 (λ1​) 2 3 (λ2​) Unit-input score: 2.6 The score for every direction The dot is the current input λ1​ = 1 λ2​ = 3 −180° −90° 0° 90° 180° 0 1 2 3
18.4°

Score for this unit input: 2.6

20% of squared length along u₁; 80% along u₂.

Drag to turn the arrow around the circle; the angle is measured from the positive horizontal axis. Watch the dashed remainder vanish at the eigenvectors, the pieces trade shares, and the dot ride the curve.

Every direction gets the same input length. Ordinary coordinates, as in Chapter 9. Left: apply M to the unit input and drop the output's shadow back onto it. Right: split the same input into its eigenvector pieces; their shares and the score update as the arrow turns. Bottom: the same score for every direction at once, with a dot marking the current input.

Along u₁, the quotient is 1. Along u₂, it is 3. Along x̂, it is 2.6. At an eigenvector, the dashed sideways remainder disappears because the whole output stays on the input’s line.

What if we resize a copy of the input?

Keep the circle experiment at length one. Here we resize a separate copy of its current input. The copy and all its pieces change length together; the unit reference arrows stay fixed.

1
Copy's squared length1
Copy's raw score2.6
Copy's quotient2.6

Changing the copy's length changes its raw score and its squared length by the same factor, so their ratio doesn't budge. The circle picture above keeps showing the unit input.

For the original x, halving its length lowers the score from 26 to 6.5 and the squared length from 10 to 2.5. Both ratios are still 2.6. The shrink ray strikes out.

Read the quotient from the shares

For our symmetric M, the quotient is a weighted average of the eigenvalues. Find the fraction of squared length in each eigenvector direction, multiply each fraction by its eigenvalue, and add.

Our x has squared-length shares 2/10 = 0.2 and 8/10 = 0.8:

R(x) = 0.2 × 1 + 0.8 × 3 = 2.6

The shares are never negative and always add to one. Turning the input changes the shares. Resizing it leaves them unchanged. This explains why the quotient compares directions fairly.

Optional: why the graph has a wave shape

As the unit input turns, its projections on the eigenvector lines change smoothly. Squaring their lengths gives the changing shares. If s is the share along u₂, the other share is 1 − s, so the score is 1 × (1 − s) + 3 × s = 1 + 2s.

Why the score curve is a waveThree parts. First, the unit circle with the eigenlines of u1 and u2 drawn through it and the unit input x-hat at about 18 degrees. Its shadow on the u2 line has length 0.894 and its shadow on the u1 line has length 0.447; the angle between x-hat and u2 is about 26.6 degrees, and 0.894 is the cosine of that angle. The shares are the squares, 0.8 and 0.2, which add to 1. Second, a chart of the share along u2 for every direction from 0 to 180 degrees: a cosine-squared wave that equals 1 at 45 degrees, the direction of u2, and 0 at 135 degrees, on the u1 line; the share along u1 is the mirror-image wave. Third, a chart of the score, 1 times the u1 share plus 3 times the u2 share: the same wave stretched to run from 1 to 3, with x-hat at 2.6. Why the score curve is a wave A share is a shadow squared, and the score blends the eigenvalues with the shares 0 φ = 26.6° v = x̂ c2​ = cos φ = 0.894 c1​ = 0.447 u2​ line u1​ line shares: 0.8942​ = 0.8 along u2​, 0.4472​ = 0.2 along u1​ they add to 1 because v has length 1 share along u2​ (orange) and along u1​ (blue) 0 0.5 1 0° 45° 90° 135° 180° u2​ u1​ line x̂: 0.8 x̂: 0.2 1 0 score = 1 × (u1​ share) + 3 × (u2​ share) 1 2 3 0° 45° 90° 135° 180° u2​ u1​ line x̂: 2.6 λ2​ = 3 λ1​ = 1 direction of the unit input same wave, stretched from 0…1 to 1…3 The score curve is the u2​ share curve, relabeled: 0 becomes λ1​ = 1 and 1 becomes λ2​ = 3.
Why the score curve is a waveThree parts. First, the unit circle with the eigenlines of u1 and u2 drawn through it and the unit input x-hat at about 18 degrees. Its shadow on the u2 line has length 0.894 and its shadow on the u1 line has length 0.447; the angle between x-hat and u2 is about 26.6 degrees, and 0.894 is the cosine of that angle. The shares are the squares, 0.8 and 0.2, which add to 1. Second, a chart of the share along u2 for every direction from 0 to 180 degrees: a cosine-squared wave that equals 1 at 45 degrees, the direction of u2, and 0 at 135 degrees, on the u1 line; the share along u1 is the mirror-image wave. Third, a chart of the score, 1 times the u1 share plus 3 times the u2 share: the same wave stretched to run from 1 to 3, with x-hat at 2.6. Why the score curve is a wave Shadow, square, then blend 0 φ = 26.6° v = x̂ c2​ = cos φ = 0.894 c1​ = 0.447 u2​ line u1​ line shares: 0.8942​ = 0.8 along u2​, 0.4472​ = 0.2 along u1​ they add to 1 because v has length 1 share along u2​ (orange) and along u1​ (blue) 0 0.5 1 0° 45° 90° 135° 180° u2​ u1​ line x̂: 0.8 x̂: 0.2 1 0 score = 1 × (u1​ share) + 3 × (u2​ share) 1 2 3 0° 45° 90° 135° 180° u2​ u1​ line x̂: 2.6 λ2​ = 3 λ1​ = 1 direction of the unit input same wave, stretched from 0…1 to 1…3 The score curve is the u2​ share curve, relabeled: 0 becomes λ1​ = 1 and 1 becomes λ2​ = 3.
Shadow, then square, then blend. Left: the unit input's shadows on the two eigenlines are its coefficients; their squares are its shares, and they add to 1 because the input has length one. Top right: the share along u₂ as the input turns, a cos² wave that peaks at u₂ (45°) and vanishes on u₁'s line (135°); the u₁ share is its mirror image. Bottom right: the score is the u₂ share stretched to run from 1 to 3. Same wave, new labels on the vertical axis.

If θ is the input’s angle from the horizontal axis, its u₂ share is cos²(θ − 45°). The score is therefore 2 + sin(2θ). You do not need this trigonometry to use the weighted-average rule.

Optional: what the quotient measures in the output picture

The output’s projection onto the input line is R(x)x. For our example this is 2.6x = (7.8, 2.6). The remaining step to Mx = (7, 5) is (−0.8, 2.4), perpendicular to x.

To check the formula, call the projection multiplier k. Its remainder Mx − kx must have dot product zero with x. Thus x · Mx = k(x · x), giving k = R(x).

The quotient measures the output along the input’s line. It is generally different from the ratio of the full output length to the input length, because the full output can also have a sideways part.

Optional: the same weighted average in more dimensions

For a real symmetric matrix, choose perpendicular unit eigenvectors uᵢ. Let cᵢ be the input’s coefficient along uᵢ, and λᵢ its eigenvalue. The index i identifies a direction; Σ means to add over all directions.

The squared length is Σᵢ cᵢ², and the raw score is Σᵢ λᵢcᵢ². Each share is wᵢ = cᵢ² / Σⱼ cⱼ². Therefore R(x) = Σᵢ wᵢλᵢ: the same weighted-average rule.

The experiment suggests where the smallest and largest scores occur. Next, the weighted-average rule will prove it for every direction.

12. Finding the minimum and maximum

Every score stays between 1 and 3

Chapter 11 showed that each quotient for M is a weighted average of its eigenvalues, 1 and 3. The weights are nonnegative and add to one. Such an average cannot fall below 1 or rise above 3.

Comic: you can't average your way outPanel 1: B raises a hand. A stands by a board that reads: lambda: 1, 3. B asks: My eigenvalues are 1 and 3. Can my weighted average be 0.5? A says: No. Panel 2: B asks: 3.5? A says: No. Panel 3: B asks: What if I pick the weights really cleverly? A says: They're nonnegative and add up to one. You're stuck between 1 and 3. B says: Rigged. λ: 1, 3 My eigenvalues are 1 and 3. Can my weighted average be 0.5? No. λ: 1, 3 3.5? No. What if I pick the weights really cleverly? They're nonnegative and add up to one. You're stuck between 1 and 3. Rigged.
Comic: you can't average your way outPanel 1: B raises a hand. A stands by a board that reads: lambda: 1, 3. B asks: My eigenvalues are 1 and 3. Can my weighted average be 0.5? A says: No. Panel 2: B asks: 3.5? A says: No. Panel 3: B asks: What if I pick the weights really cleverly? A says: They're nonnegative and add up to one. You're stuck between 1 and 3. B says: Rigged. λ: 1, 3 My eigenvalues are 1 and 3. Can my weighted average be 0.5? No. λ: 1, 3 3.5? No. What if I pick the weights really cleverly? They're nonnegative and add up to one. You're stuck between 1 and 3. Rigged.
you can't average your way out
alt-text

Negative weights would get you out, which is why averages don't allow them. The Rayleigh quotient's weights are squares divided by a sum of squares, so they can't go negative.

So 1 is a floor for every possible direction. We do not need to test directions one at a time to know this.

The eigenvectors reach both limits

Choose q₁ = (1, −1). All its squared length lies along the eigenvector with eigenvalue 1, so R(q₁) = 1. That proves the minimum is exactly 1: no direction goes lower, and this direction reaches it.

Choose q₂ = (1, 1) for the other end. Its quotient is 3, so the maximum is exactly 3.

Chart: the Rayleigh quotient of every directionA hand-drawn chart of the Rayleigh quotient of M for every direction from 0 to 180 degrees. The curve is 2 plus sine of twice the angle. It touches its ceiling of 3, the eigenvalue lambda-2, at 45 degrees, the direction of q2, and its floor of 1, the eigenvalue lambda-1, at 135 degrees, the direction of minus q1, on the q1 line. The ordinary axis directions at 0 and 90 degrees both score 2, matching the diagonal entries of M. The direction of x = (3, 1), at about 18 degrees, scores 2.6. Every direction's Rayleigh quotient ceiling: λ2​ = 3 floor: λ1​ = 1 1 1.5 2 2.5 3 3.5 0° 45° 90° 135° 180° direction of the arrow Rayleigh quotient R q2​ hits the ceiling q1​'s line hits the floor x = (3, 1) scores 2.6 the axis directions score 2: the diagonal entries of M
Every direction's score, computed from M
alt-text

R(cx) = R(x) for every nonzero number c, negative ones included. That's why half a turn of directions covers every possible input.

Question Direction that achieves it Score
Lowest quotient for M q₁ = (1, −1) 1
Highest quotient for M q₂ = (1, 1) 3

The arrows can be resized or reversed without changing their quotients. We are finding directions, not one particular arrow length.

Why one trial is not a proof of the minimum

Our trial x gives 2.6. That tells us the minimum is at most 2.6: a direction with that score exists. It does not tell us that every other direction scores more.

To prove a minimum, we need both parts of the argument: a floor that applies to every candidate, and a candidate that reaches the floor.

The same rule works in more dimensions

For any real symmetric matrix, the smallest eigenvalue is the smallest Rayleigh quotient, and an eigenvector with that eigenvalue achieves it. The largest eigenvalue gives the maximum in the same way.

This gives the extreme eigenvalues two meanings: they are multipliers along special directions, and they are the best and worst values of this fair score. If an extreme eigenvalue repeats, more than one independent direction can achieve the same extreme score.

We can therefore search for a minimum by finding the smallest eigenvalue and a corresponding eigenvector. The weighted-average argument still works when there are too many dimensions to draw. Spielman, Chapter 2.

Optional: why the symmetry condition matters

The nonsymmetric matrix A from Chapter 8 has rows (1, 1) and (0, 2). Its eigenvalues are 1 and 2, but its quotients range from about 0.79 to 2.21.

Chart: the unit-input score of every direction for A, a matrix with slanted eigenlinesA hand-drawn chart of the unit-input score of A, with rows (1, 1) and (0, 2), for every direction from 0 to 180 degrees. Dashed lines mark A's eigenvalues 1 and 2. The curve passes through 1 at 0 degrees, the eigenvector (1, 0), and through 2 at 45 degrees, the eigenvector (1, 1), but it is not fenced in by them: it rises to 2.21 at 67.5 degrees and falls to 0.79 at 157.5 degrees, directions that are not eigenvectors of A. What slanted eigenlines cost: no fence eigenvalue 1 eigenvalue 2 0.5 1 1.5 2 2.5 0° 45° 90° 135° 180° direction of the unit input score of a unit input (1, 0) scores 1: its eigenvalue (1, 1) scores 2: its eigenvalue highest: 2.21, at 67.5°. Not an eigenvector. lowest: 0.79, at 157.5°. Not an eigenvector either. A's eigenvalues sit on the curve, but not at its ends. For M, the eigenvalues are the ends.
The same chart for A, whose eigenlines are 45° apart
alt-text

A's eigenvectors still score exactly their eigenvalues, 1 and 2. They just aren't the ends of the range: the real extremes, 0.79 and 2.21, belong to directions that A turns. With slanted pieces the score isn't a blend of the eigenvalues, so the eigenvalues fence nothing in.

Its eigenvectors still score their eigenvalues. They simply do not achieve the extremes. Because the eigenvector lines are not perpendicular, the squared-length shares do not give the weighted-average formula we used for M. The spectral theorem supplies that formula for real symmetric matrices.

13. Remove the average to reveal the pattern

Separate the shared level from the pattern

Return to the three-entry list z = (3, 1, 2). Its average is 2. Subtract 2 from every entry:

(3, 1, 2) = (2, 2, 2) + (1, −1, 0)

The first part is the shared level. The second tells us how far each entry is above or below the average. Subtracting the average is called centering. The centered entries always add to zero.

Comic: everybody stand on a boxPanel 1: Three stick figures with heights labeled 3, 1 and 2 stand side by side; a dashed line marks their average height, 2. Panel 2: All three stand on identical boxes two units tall; their heights are now 5, 3 and 4, and the dashed average line has risen to 4. Panel 3: Only the differences from the average remain, drawn as arrows from a dashed line: +1, -1 and 0. Lettering reads: Minus the average: +1, -1, 0. Both times. A note says: the box cancels out. 3 1 2 Heights: 3, 1, 2. Average (dashed): 2. 5 3 4 Everyone on a box: 5, 3, 4. Average: 4. +1 −1 0 (the box cancels out) Minus the average: +1, -1, 0. Both times.
Comic: everybody stand on a boxPanel 1: Three stick figures with heights labeled 3, 1 and 2 stand side by side; a dashed line marks their average height, 2. Panel 2: All three stand on identical boxes two units tall; their heights are now 5, 3 and 4, and the dashed average line has risen to 4. Panel 3: Only the differences from the average remain, drawn as arrows from a dashed line: +1, -1 and 0. Lettering reads: Minus the average: +1, -1, 0. Both times. A note says: the box cancels out. 3 1 2 Heights: 3, 1, 2. Average (dashed): 2. 5 3 4 Everyone on a box: 5, 3, 4. Average: 4. +1 −1 0 (the box cancels out) Minus the average: +1, -1, 0. Both times.
everybody stand on a box
alt-text

A constant vector is a group photo where everyone is exactly the same height. Subtract the average and there's nothing left to compare: you get the zero vector.

Centering preserves the differences between neighboring entries. The raw bumpiness is therefore still 5:

(1 − (−1))² + ((−1) − 0)² = 4 + 1 = 5
A shared shift is invisible to the bumpiness scoreFour lists drawn as bars on one shared scale. The list 3, 1, 2 has steps 2 and 1 and scores 5. Everyone plus 5, that is 8, 6, 7: the bars are taller but the steps are still 2 and 1, score 5. Minus the average 2, that is 1, -1, 0: steps 2 and 1 again, score 5. All equal, 2, 2, 2: no steps, score 0. Shift every number, and the score can't tell Add the same amount to every entry: the steps don't change, so the score doesn't either. the list: 3, 1, 2 3 1 2 2 1 score = 22​ + 12​ = 5 everyone + 5: 8, 6, 7 8 6 7 2 1 score = 22​ + 12​ = 5 minus the average 2: 1, −1, 0 1 −1 0 2 1 score = 22​ + 12​ = 5 all equal: 2, 2, 2 2 2 2 0 0 score = 02​ + 02​ = 0 Only the steps count. Subtracting the average loses nothing the score can see.
A shared shift is invisible to the bumpiness scoreFour lists drawn as bars on one shared scale. The list 3, 1, 2 has steps 2 and 1 and scores 5. Everyone plus 5, that is 8, 6, 7: the bars are taller but the steps are still 2 and 1, score 5. Minus the average 2, that is 1, -1, 0: steps 2 and 1 again, score 5. All equal, 2, 2, 2: no steps, score 0. Shift every number, and the score can't tell Add the same amount to every entry: the steps don't change, so the score doesn't either. the list: 3, 1, 2 3 1 2 2 1 score = 22​ + 12​ = 5 everyone + 5: 8, 6, 7 8 6 7 2 1 score = 22​ + 12​ = 5 minus the average 2: 1, −1, 0 1 −1 0 2 1 score = 22​ + 12​ = 5 all equal: 2, 2, 2 2 2 2 0 0 score = 02​ + 02​ = 0 Only the steps count. Subtracting the average loses nothing the score can see.
A shared shift leaves raw bumpiness unchanged. The lists (3, 1, 2), (8, 6, 7), and (1, −1, 0) have the same neighboring differences, so all score 5 before dividing by squared length. A flat list has no neighboring differences and scores zero.

This preserves raw bumpiness, not necessarily the quotient. Subtracting an average changes the input’s squared length. We center first because we want that length to measure only the variation around the mean.

Centering and normalizing do different jobs

Step What we do Why we do it
Center Subtract the average from every entry. Remove the shared level.
Normalize Divide the centered list by its length. Give each remaining pattern the same size.

Our centered list is r = (1, −1, 0), with squared length 2. We could normalize it to r/√2. Or use Chapter 11’s shortcut and divide its raw score by its squared length:

Fair bumpiness = 5/2 = 2.5

A flat list leaves the zero vector after centering. There is then no remaining pattern to normalize, and its quotient is undefined. Our search considers nonzero, centered patterns.

Optional: why subtracting the average is a projection

The all-equal direction is h = (1, 1, 1). The shared part p = (2, 2, 2) lies along it. Our remainder r is perpendicular to h because r · h = 1 − 1 + 0 = 0. This is the same projection split as in Chapter 5.

To find the shared part directly, write it as (a, a, a). Requiring the remainder to be perpendicular to h gives (3 − a) + (1 − a) + (2 − a) = 0, so a = 2. For any list, this calculation gives its average.

Three-entry centered lists satisfy r₁ + r₂ + r₃ = 0. The first two entries can vary freely; the third is then fixed. They form a plane perpendicular to h. Requiring length one selects a circle inside that plane.

Removing the common component leaves a plane; unit length selects a circleThe first panel is an orthographic view of three-dimensional vector space. The vector z=(3,1,2) splits into p=(2,2,2), its projection on the all-equal direction h=(1,1,1), and r=(1,-1,0). The remainder r is perpendicular to h and lies in the plane of vectors whose entries sum to zero. The remainder is shown both from p to z and translated to the origin. In the second panel, the view turns to face that plane. Its unnamed coordinate axes are the orthonormal directions (1,-1,0)/sqrt(2) and (1,1,-2)/sqrt(6). The circle consists of all vectors in that plane with length one. Dividing r by sqrt(2) places it on the circle. Remove the common level, then compare at unit length Remove the common level z = p + r All-equal direction h = (1, 1, 1) p = (2, 2, 2) z = (3, 1, 2) r r = (1, −1, 0) Mean-zero plane The entries sum to zero Mean zero defines a plane. Turn to face that plane r r / √2 The same plane, viewed head-on ||r / √2|| = 1 Every direction, length 1.
Removing the common component leaves a plane; unit length selects a circleThe first panel is an orthographic view of three-dimensional vector space. The vector z=(3,1,2) splits into p=(2,2,2), its projection on the all-equal direction h=(1,1,1), and r=(1,-1,0). The remainder r is perpendicular to h and lies in the plane of vectors whose entries sum to zero. The remainder is shown both from p to z and translated to the origin. In the second panel, the view turns to face that plane. Its unnamed coordinate axes are the orthonormal directions (1,-1,0)/sqrt(2) and (1,1,-2)/sqrt(6). The circle consists of all vectors in that plane with length one. Dividing r by sqrt(2) places it on the circle. Remove the common level, then compare at unit length Remove the common level z = p + r All-equal direction h = (1, 1, 1) p = (2, 2, 2) z = (3, 1, 2) r r = (1, −1, 0) Mean-zero plane The entries sum to zero Mean zero defines a plane. Turn to face that plane r r / √2 The same plane, viewed head-on ||r / √2|| = 1 Every direction, length 1.
Centering leaves a plane; length one picks out a circle within it. Left: p along the all-equal line and r in the plane perpendicular to it. Right: the same plane viewed head-on, with every centered vector of length one on the circle. Our r, divided by its length √2, lands on it.

We now have another circle of candidate directions, just as in Chapter 11, but every point on this circle already has average zero.

Which centered pattern is smoothest?

We are using the three-entry bumpiness matrix B introduced in Chapter 9. Its raw score is the sum of squared neighboring differences. Its fair score divides that sum by the centered input’s squared length.

The ramp (1, 0, −1) has raw bumpiness 2 and squared length 2, so it scores 1. The zigzag (1, −2, 1) has raw bumpiness 18 and squared length 6, so it scores 3.

The search, run inside the mean planeTwo panels. Left: three centred lists drawn as bars. The ramp 1, 0, -1 has bumpiness 2 and squared length 2, quotient 1. Our centred list 1, -1, 0 has bumpiness 5 and squared length 2, quotient 2.5. The zigzag 1, -2, 1 has bumpiness 18 and squared length 6, quotient 3. Right: a chart of the quotient for every point on the circle of centred unit lists, by angle from the ramp. It is a wave from 1 at the ramp (0 and 180 degrees) up to 3 at the zigzag (90 degrees), with our list at 60 degrees scoring 2.5. Dashed lines mark 1 and 3; a red dotted line at 0 marks the flat list, which is not on the circle. Run the search inside the plane Centered patterns only: the flat list is no longer a candidate Three centered patterns quotient = bumpiness ÷ squared length ramp (1, 0, −1) 1 0 −1 bumpiness 2 squared length 2 quotient 1 ours (1, −1, 0) 1 −1 0 bumpiness 5 squared length 2 quotient 2.5 zigzag (1, −2, 1) 1 −2 1 bumpiness 18 squared length 6 quotient 3 Each list has average zero: the shared level is gone. Every centered pattern at once the quotient around the circle 0 1 2 3 0° 45° 90° 135° 180° quotient angle from the ramp, around the circle 3 1 0 ramp ours: 2.5 zigzag ramp flat list: 0, but not on the circle A wave between 1 and 3, like Chapter 11's. Remove the flat direction, and the lowest score is the second-smallest eigenvalue, 1.
The search, run inside the mean planeTwo panels. Left: three centred lists drawn as bars. The ramp 1, 0, -1 has bumpiness 2 and squared length 2, quotient 1. Our centred list 1, -1, 0 has bumpiness 5 and squared length 2, quotient 2.5. The zigzag 1, -2, 1 has bumpiness 18 and squared length 6, quotient 3. Right: a chart of the quotient for every point on the circle of centred unit lists, by angle from the ramp. It is a wave from 1 at the ramp (0 and 180 degrees) up to 3 at the zigzag (90 degrees), with our list at 60 degrees scoring 2.5. Dashed lines mark 1 and 3; a red dotted line at 0 marks the flat list, which is not on the circle. Run the search inside the plane Centered patterns only: the flat list is no longer a candidate Three centered patterns quotient = bumpiness ÷ squared length ramp (1, 0, −1) 1 0 −1 bumpiness 2 squared length 2 quotient 1 ours (1, −1, 0) 1 −1 0 bumpiness 5 squared length 2 quotient 2.5 zigzag (1, −2, 1) 1 −2 1 bumpiness 18 squared length 6 quotient 3 Each list has average zero: the shared level is gone. Every centered pattern at once the quotient around the circle 0 1 2 3 0° 45° 90° 135° 180° quotient angle from the ramp, around the circle 3 1 0 ramp ours: 2.5 zigzag ramp flat list: 0, but not on the circle A wave between 1 and 3, like Chapter 11's. Remove the flat direction, and the lowest score is the second-smallest eigenvalue, 1.
Compare the variation around the mean. Each example has average zero. Divide bumpiness by squared length to compare their directions: the ramp scores 1, our centered list scores 2.5, and the zigzag scores 3. The curve shows all centered directions, whose quotients stay between 1 and 3.

The ramp and zigzag are perpendicular eigenvectors of B, with eigenvalues 1 and 3. Together they describe every centered three-entry pattern. Each such pattern’s quotient is a weighted average of 1 and 3.

Therefore the lowest quotient among centered patterns is 1, achieved by the ramp direction. Its reverse is equally smooth. Our centered list has 25% of its squared length along the ramp and 75% along the zigzag, giving 0.25 × 1 + 0.75 × 3 = 2.5.

Why the second-smallest eigenvalue appears

B has eigenvalues 0, 1, and 3. The flat direction has eigenvalue 0. Centering removes that entire component from every candidate, leaving the directions with eigenvalues 1 and 3.

The smallest remaining eigenvalue is 1, which was the second-smallest eigenvalue of B. We often call it λ₂. Its eigenvector gives the smoothest centered pattern for this score.

This explains the step used in the next primer: remove a known flat component, then find the smoothest remaining pattern. On a network, such patterns help reveal groups of strongly connected points. Spielman, Chapters 1–2.

Keep the two example matrices separate. For this bumpiness matrix B, the flat direction has the smallest eigenvalue, 0. For our earlier matrix M, the all-equal direction has the largest eigenvalue, 3. Centering always removes the average; which eigenvalue it removes depends on the matrix.

Comic: next time, graphsPanel 1: A says: So the smallest eigenvalue is the smallest Rayleigh quotient. B asks: And this helps me how? Panel 2: A points at a drawing of a small network of dots and lines and says: Next time, the matrix comes from a network, and the score adds up squared differences across every link. Panel 3: B says: So a small score means values that barely change across links. A says: And the smoothest of all is 'everything equal.' That's why we remove the shared level. B says: Oh no. It's all connected. So the smallest eigenvalue is the smallest Rayleigh quotient. And this helps me... how? Next time, the matrix comes from a network, and the score adds up squared differences across every link. So a small score means values that barely change across links... And the smoothest of all is "everything equal." That's why we remove the shared level. Oh no. It's all connected.
Comic: next time, graphsPanel 1: A says: So the smallest eigenvalue is the smallest Rayleigh quotient. B asks: And this helps me how? Panel 2: A points at a drawing of a small network of dots and lines and says: Next time, the matrix comes from a network, and the score adds up squared differences across every link. Panel 3: B says: So a small score means values that barely change across links. A says: And the smoothest of all is 'everything equal.' That's why we remove the shared level. B says: Oh no. It's all connected. So the smallest eigenvalue is the smallest Rayleigh quotient. And this helps me... how? Next time, the matrix comes from a network, and the score adds up squared differences across every link. So a small score means values that barely change across links... And the smoothest of all is "everything equal." That's why we remove the shared level. Oh no. It's all connected.
next time, graphs
alt-text

Literally. It's a graph.

Footnotes

  1. The search term is spectral clustering. The same idea ranks web pages, finds communities in social networks, and segments images. All of it starts with the question in this paragraph. ↩
  2. Hi. Footnotes hold the jokes that didn't fit in the main text, plus the occasional “technically…” that keeps everything honest. ↩
  3. Unlike most directions you get from relatives, these work no matter where you start. ↩
  4. William Rowan Hamilton gave “scalar” and “vector” their mathematical meanings in the mid-1840s, while developing his quaternions. Real numbers, he explained, sit on a single scale running from negative to positive infinity. “Vector” comes from the Latin for “carrier.” ↩
  5. This is why the rule “add 1 to every entry” isn't linear in this sense, even though in one dimension f(x) = x + 1 draws a perfectly straight line. It moves the origin. That kind of rule is called affine, and someone will point this out if you get it wrong. ↩
  6. For two nonzero arrows in the plane, “orthogonal” and “perpendicular” mean the same thing. “Orthogonal” also works in more dimensions, and for things like functions, where “perpendicular” starts to sound odd. Technically the zero vector is orthogonal to everything, which is about as meaningful as it sounds. ↩
  7. √10 ≈ 3.162 is close enough to π that Zhang Heng in 2nd-century China and Brahmagupta in 7th-century India both used it as a value for π. We are not doing that here. ↩
  8. The zero vector can't be normalized: its length is zero, and dividing by zero remains, as ever, not allowed. ↩
  9. Without the right angle there would be an extra cross term: ‖p + r‖² = ‖p‖² + 2 p · r + ‖r‖². Here p · r = 0, so it vanishes. Cross terms will be back in Chapter 9, looking suspicious. ↩
  10. The wobble in the hand-drawn grid is drawn on the plane itself, so M transforms the wobbles along with everything else. That's what a linear map does to any drawing you make on the plane. (The arrow tips sit exactly where the math says, though.) ↩
  11. “Eigen” is German for “own,” as in “the matrix's own vectors.” English borrowed half the word and never gave it back. ↩
  12. Keep applying M and almost every arrow swings closer and closer to the q₂ line, because each application triples the q₂ component and leaves the q₁ component alone. Repeating a matrix to find its dominant eigenvector is called the power method; Google's original PageRank was computed this way. (The “almost”: arrows exactly on the q₁ line have no q₂ component to triple, so they stay put.) ↩
  13. Flipping still counts as staying on the line. The arrow is on the same line through the origin, just facing the other way down the hallway. ↩
  14. David Hilbert made “spectrum” the standard word in the early 1900s (Wilhelm Wirtinger had borrowed it from optics a few years before). A couple of decades later, quantum mechanics showed that the lines in atomic spectra really are computed from eigenvalues. Hilbert reportedly said he'd used the name with no idea it would apply to the actual spectra of physics. The word went from optics to math and straight back again. ↩
  15. Of which there are a lot. Uncountably many, in fact. ↩
  16. Rotation by 180° is sneakier: it flips every arrow, which counts as staying on the line, so every nonzero arrow is an eigenvector with eigenvalue −1. ↩
  17. Remember the job interview in Chapter 6? x started explaining that it turns a little, and M said “Next!” The chart there says how little: about 17°. That turn is the sideways part in the picture. ↩
  18. For a three-entry list z, B has rows (1, −1, 0), (−1, 2, −1) and (0, −1, 1). Multiplying gives zᵀBz = z₁² + 2z₂² + z₃² − 2z₁z₂ − 2z₂z₃ = (z₁ − z₂)² + (z₂ − z₃)². The next primer builds this kind of matrix from a network. ↩
  19. One input, three different answers. Linear algebra is like this sometimes. ↩
  20. Positive semidefinite is the matrix version of “no complaints.” Not necessarily any compliments. Just no complaints. ↩
  21. Hold that thought. Chapter 13 removes one direction from a search for exactly this reason. ↩
  22. Without nonnegativity, a zero can be a coincidence. The matrix with rows (1, 0) and (0, −1) gives (1, 1) a score of 1 − 1 = 0, yet sends it to (1, −1), not to zero. ↩
  23. Named after Lord Rayleigh, who also explained why the sky is blue and shared in the discovery of argon, which won him the 1904 Nobel Prize in Physics. He was having a good few decades. ↩
  24. For our x, ‖Mx‖/‖x‖ = √74/√10 ≈ 2.72, which is bigger than R(x) = 2.6. The sideways remainder adds length without adding anything along x. ↩
  25. Mathematicians call this the variational characterization of eigenvalues: “variational” because it comes from varying the direction and looking for the lowest and highest values. Physics is full of these. A soap film settles into a shape that (locally) minimizes its area, and light follows a path whose travel time is stationary, which is usually a minimum. ↩
  26. Check with the matrix B from Chapter 9's footnote. B(1, 0, −1) = (1, 0, −1): eigenvalue 1. B(1, −2, 1) = (3, −6, 3): eigenvalue 3. The flat list is the third eigenvector, B(1, 1, 1) = (0, 0, 0): eigenvalue 0. And (1, 0, −1) · (1, −2, 1) = 1 + 0 − 1 = 0, so the two in the plane are perpendicular, as the spectral theorem promised. ↩

The stick figures, comics and charts are original drawings, made in the general style of xkcd as a tribute. This page is not affiliated with or endorsed by xkcd or Randall Munroe. Every figure from the original primer has been redrawn with the same coordinates, and the figures new to this edition use the same running example; the wobble moves the middle of each line, never its endpoints.

Lettering: Humor Sans by Michael Ciuffo and Playpen Sans by TypeTogether, both under the SIL Open Font License 1.1.

Written on October 20, 2026