Advanced Linear Algebra


Advanced Linear Algebra

Corey
We’ve reached the advanced topics in linear algebra, so let’s zoom out before diving in. Early in the course, we approached the subject from different angles: numerical methods, solving equations algebraically, geometric interpretations, and eventually linear regression. You can picture those as separate corner pieces of a puzzle.

Simon
And now the picture is becoming more three-dimensional. Each advanced topic can be a corner piece in its own right, revealing more of linear algebra’s internal structure and giving us better tools for applications—including computer science and algorithms.

Corey
Today’s topic is eigenvalue decomposition. It opens a door to ideas used in mathematics and physical sciences, from quantum mechanics to vibration modes in a guitar. It also connects to algorithms and, in the broader course, to topics such as large language models.

Simon
Let’s build the basic idea from the way a matrix acts. An m-by-n matrix maps an input vector in R to the n into an output vector in R to the m. If the matrix is square, n-by-n, then input and output have the same number of coordinates, so we can view it as a map from a space to itself.

Corey
That lets us ask a special question: are there any nonzero vectors whose direction is unchanged by the map? Their length might grow, shrink, or even reverse, but they stay on the same line. Those vectors are eigenvectors, and the scale factor is the eigenvalue.

Simon
Formally, for a square matrix A, a nonzero vector s is an eigenvector if A times s equals lambda times s. Here lambda is a scalar, the eigenvalue. One subtlety is that even when A has real entries, its eigenvectors and eigenvalues are not guaranteed to be real; they may be complex.

Corey
And an eigenvector really identifies a direction, not one particular length. If s is an eigenvector, then any nonzero scaled version r times s is also an eigenvector with the same eigenvalue, because A times r s equals r times A s, which equals lambda times r s. That’s why applications often report normalized eigenvectors.

Simon
An n-by-n matrix has at most n distinct eigendirections that are linearly independent, though an eigenvalue can repeat. The zero vector is excluded from the definition: it would satisfy A s equals lambda s for every matrix and every lambda, so it wouldn’t tell us anything useful. The eigenvalue itself, however, can be zero.

Corey
A few familiar transformations make the idea concrete. A permutation matrix shuffles coordinates; a projection sends a vector to a subspace; a shear changes one coordinate in proportion to another; and a rotation turns vectors. Each acts within the same-dimensional space when represented by a square matrix, but their eigenvectors behave quite differently.

Simon
Start with the two-dimensional permutation that swaps the coordinates: it sends [x, y] to [y, x]. If x and y are equal, swapping changes nothing, so [1, 1] is an eigenvector with eigenvalue 1. If the coordinates are opposites, like [1, -1], swapping reverses the vector, so the eigenvalue is -1.

Corey
For a projection in three dimensions onto the xy-plane, the matrix leaves x and y alone and sets z to zero. Every vector already in the xy-plane stays exactly where it is, giving eigenvalue 1. That whole plane is an eigenspace, although we only need two linearly independent vectors to form a basis for it.

Simon
And any nonzero vector along the z-axis gets sent to zero. It is still an eigenvector, now with eigenvalue 0. That illustrates the distinction nicely: the output can be the zero vector, but the eigenvector we start with must not be zero.

Corey
For the shear, the matrix has columns [1, 0] and [0.5, 1]. Applying it to [x, y] gives [x plus 0.5y, y]. The x-coordinate shifts according to the y-coordinate, while the y-coordinate stays fixed. The vector [1, 0] lies on the x-axis, where there is no y-component to cause a shift, so it stays unchanged and has eigenvalue 1.

Simon
There’s only one independent eigenvector direction for that shear. Looking at the coordinate basis vectors explains the name: [1, 0] stays put, while [0, 1] becomes [0.5, 1]. So the unit square is carried into a parallelogram—a shear.

Corey
A two-dimensional rotation seems like it should have no unchanged real direction. With the course’s convention, the rotation matrix has columns [cos theta, sin theta] and [-sin theta, cos theta]. At a quarter turn, those columns become [0, 1] and [-1, 0], so every nonzero real vector changes direction.

Simon
That means a 90-degree rotation has no real eigenvectors. But it does have complex eigenvalues and eigenvectors, as we’ll calculate shortly. So ‘no eigenvectors’ needs care: here, we mean no real eigenvectors.

Corey
The same idea can extend beyond ordinary finite-dimensional vectors. Differentiating e to the a x gives a times e to the a x, so that function behaves like an eigenvector of differentiation, with eigenvalue a. And differentiating sin x twice gives minus sin x, so sin x behaves like an eigenvector of the second-derivative operation with eigenvalue -1.

Simon
A function can be thought of as a vector whose entries are its values at points along the input axis. There are infinitely many such points, so this is an infinite-dimensional way of thinking. That viewpoint helps motivate ideas used in Fourier transforms and quantum mechanics.

Corey
There’s also a visual test: draw a candidate vector, then draw its transformed version. If the two lie on the same line, the candidate is an eigenvector; the eigenvalue tells you the scaling, including whether the direction reverses. For the coordinate swap, you see the equal-coordinate direction stay put and the opposite-coordinate direction reverse.

Simon
For a projection onto the line y equals x, vectors on that line are unchanged, so their eigenvalue is 1. A vector perpendicular to that line projects to zero, giving eigenvalue 0. With a shear, the x-axis is the only eigenvector line; with a quarter-turn rotation, the real transformed vector keeps turning away from the candidate.

Corey
Now let’s derive a way to compute eigenvalues and eigenvectors instead of spotting them visually. Begin with A s equals lambda s, and move everything to one side: A s minus lambda s equals zero. To factor out s, write lambda s as lambda I s, where I is the identity matrix.

Simon
That gives the equation (A minus lambda I) times s equals the zero vector. Since s must be nonzero, the matrix A minus lambda I must have a nontrivial null space. Its columns are linearly dependent, so the matrix is singular, and its determinant must equal zero.

Corey
So we first solve det(A minus lambda I) equals zero. Expanding that determinant gives a polynomial in lambda called the characteristic polynomial; setting it equal to zero gives the characteristic equation. For an n-by-n matrix, its degree is n, with a leading term of the form negative one to the n times lambda to the n.

Simon
Once we find the roots—the eigenvalues—we substitute each one into A minus lambda I and find its null space. The nonzero vectors in that null space are the eigenvectors for that eigenvalue. In other words, eigenvalues come from the characteristic polynomial, and eigenvectors come from solving the associated homogeneous system.

Corey
Let’s do the coordinate-swap matrix. A minus lambda I has rows [-lambda, 1] and [1, -lambda]. Its determinant is lambda squared minus one, so the eigenvalues are 1 and -1. For lambda equal to 1, the null-space equation gives [1, 1]; for lambda equal to -1, it gives [1, -1].

Simon
Those two eigenvectors are orthogonal: their dot product is one times one plus one times negative one, which is zero. That’s part of a powerful result: a real symmetric matrix has a full set of orthogonal eigenvectors. A full set means n independent eigenvectors for an n-by-n matrix.

Corey
That’s one reason symmetric matrices matter in data science. The Gram matrix A-transpose-A is square and symmetric, so it has a full set of orthogonal eigenvectors. It appears in data analysis and machine learning, including in the setting of linear regression.

Simon
Now return to the projection onto the xy-plane, whose matrix is diagonal with entries 1, 1, and 0. Its characteristic polynomial factors as lambda times (1 minus lambda) squared. So the eigenvalues are 0, 1, and 1, with 1 repeated twice.

Corey
That repetition is called algebraic multiplicity: the number of times an eigenvalue appears as a root of the characteristic polynomial. The eigenvalue 1 has algebraic multiplicity two. Its eigenvectors fill the xy-plane, so we can choose [1, 0, 0] and [0, 1, 0] as a basis for that eigenspace.

Simon
The dimension of an eigenspace—the number of independent eigenvectors for that eigenvalue—is its geometric multiplicity. Here, eigenvalue 1 has geometric multiplicity two, matching its algebraic multiplicity. Eigenvalue 0 has the z-axis as its eigenspace, so its geometric multiplicity is one.

Corey
For the shear, the characteristic polynomial is (1 minus lambda) squared, so eigenvalue 1 has algebraic multiplicity two. But when we put lambda equal to 1 into A minus lambda I, the null space has dimension only one: it contains the x-axis direction [1, 0]. Thus the geometric multiplicity is one, smaller than the algebraic multiplicity.

Simon
That’s a case where the repeated root doesn’t give us two independent eigenvectors. The geometric multiplicity can’t exceed the algebraic multiplicity, but it can be less. Compare that with the projection, where the repeated eigenvalue had a two-dimensional eigenspace.

Corey
Finally, consider the 90-degree rotation matrix. It is skew-symmetric, and A minus lambda I has determinant lambda squared plus one. Setting that to zero gives lambda equal to i or negative i, so the eigenvalues are complex rather than real.

Simon
For lambda equal to i, an eigenvector is [1, -i]; for lambda equal to negative i, an eigenvector is [1, i]. You can check the first by multiplying [1, -i] by the columns of A minus i I: the result is the zero vector. This confirms the eigenvector equation even though the vectors are in complex two-dimensional space.

Corey
So we’ve seen a broad contrast: real symmetric matrices have a full set of orthogonal eigenvectors, while this real skew-symmetric rotation has purely imaginary eigenvalues. The shear sits in a different kind of special case, where a repeated eigenvalue has fewer independent eigenvectors than its algebraic multiplicity.

Simon
That gives us the fundamentals: what eigenvectors and eigenvalues mean, how to find them using the determinant and null space, and how multiplicity and symmetry shape the answer. It also shows why the topic reaches from geometry and differential operators into science, data methods, and algorithms. Next, the course can build on these foundations to explore further mathematical properties of eigenvalue decomposition.

Ask anything
We've read this whole study set, so questions about it get the best answers.