skip to content

Eigendecomposition and SVD

Factorizing a matrix into the directions it merely stretches: eigenvalues and eigenvectors, the spectral theorem for symmetric matrices, and the SVD every matrix has. It is the math under PCA.

on this pageshow

explore

questions

11

What does it mean for a vector to be an eigenvector of a matrix A?

level: juniorimportance: must knowfreq 84%

answer

  1. A only rescales this vector
  2. direction survives, length may not
  3. one scalar does the matrix's whole job
  4. Av = lambda v, with v nonzero
  5. value may be zero, vector may not

basics

~20 s

A nonzero vector v is an eigenvector of A when Av = lambda v. Multiplying by A leaves v on its own line through the origin, only stretching, shrinking or flipping it; the scalar lambda is that scale factor.

solid answer

~40 s

For a square matrix `A`, a nonzero vector `v` is an eigenvector if `Av = lambda v`, where the scalar `lambda` is the matching eigenvalue. Geometrically, a matrix usually both rotates and rescales the vectors it acts on; along an eigenvector it does no rotation at all, only scaling. For example `[[2,1],[1,2]]` sends `(1,1)` to `(3,3)`, so `(1,1)` is an eigenvector with eigenvalue `3`. Two details matter. First, `v` must be nonzero, because `A0 = lambda 0` holds for every scalar and would make the definition vacuous; the eigen*value* is allowed to be zero, and a zero eigenvalue means `A` collapses that direction and is singular. Second, eigenvectors are not unique: any nonzero multiple of `v` works, so what really exists is an eigenspace, and implementations report a unit-length representative.

go deeper

for a junior

Be ready to state Av = lambda v out loud, say that v must be nonzero, and sketch the picture of a vector that only gets stretched or flipped. Being able to verify a given pair by one multiplication is enough here.

for a middle

Expect to explain why the definition forces v to be nonzero while allowing lambda to be zero, and to describe the eigenspace so you can say why scalar multiples and sign flips are all valid answers.

for a senior

Show you know where this bites in practice: a zero eigenvalue means a singular matrix, and reported eigenvectors carry an arbitrary sign, so downstream code and plots must not depend on which sign came back.

for a principal

Own the framing question of when an eigen-view is the right lens at all. It buys you an interpretable set of intrinsic axes for symmetric operators, but for non-symmetric or nearly defective matrices the decomposition can be unstable and a different factorization serves the team better.

## The definition Let `A` be a square `n x n` matrix. A nonzero vector `v` in R^n is an **eigenvector** of `A` with **eigenvalue** `lambda` if ``` A v = lambda v ``` The left side applies a whole matrix; the right side just multiplies by one number. So the defining property is: *on this particular vector, the matrix behaves like a scalar*. ## The geometric picture Think of `A` as a transformation of the plane. Feed it a generic vector and the output points somewhere else entirely: the direction changed. Eigenvectors are the special directions that survive. The arrow may get longer, shorter, or flip to point the opposite way, but it stays on the same line through the origin. The eigenvalue records exactly what happened on that line: - `lambda > 1` — stretched. - `0 < lambda < 1` — shrunk toward the origin. - `lambda = 1` — completely unchanged; that whole direction is fixed by `A`. - `lambda < 0` — flipped through the origin, and scaled by `|lambda|`. - `lambda = 0` — flattened onto the origin. `Av = 0` with `v` nonzero means `A` has a nontrivial null space, so `A` is singular and has no inverse. A concrete case: `A = [[2,1],[1,2]]` maps `(1,1)` to `(2+1, 1+2) = (3,3) = 3*(1,1)`, so `(1,1)` is an eigenvector with `lambda = 3`. The same matrix maps `(1,-1)` to `(2-1, 1-2) = (1,-1)`, so `(1,-1)` is an eigenvector with `lambda = 1`. ## Why the zero vector is excluded `A0 = 0 = lambda 0` for *every* scalar `lambda`. If the zero vector counted, every number would be an eigenvalue of every matrix and the concept would carry no information. So the definition requires `v != 0`. Note the asymmetry that trips people up: the eigen**vector** may not be zero, but the eigen**value** may be, and a zero eigenvalue is informative — it is exactly the statement that `A` is singular. ## Eigenvectors come in whole lines If `Av = lambda v` and `c` is any nonzero scalar, then `A(cv) = c(Av) = c(lambda v) = lambda(cv)`. Every nonzero multiple of an eigenvector is an eigenvector with the same eigenvalue. More generally, the set of all `v` satisfying `Av = lambda v` (now including `0`) is a subspace called the **eigenspace** of `lambda`. Its dimension is the *geometric multiplicity* of `lambda`, and it can be larger than one: for the identity matrix, `Iv = 1*v` for every `v`, so the eigenspace of `lambda = 1` is the entire space. Because of this scale freedom, any reported eigenvector is just a representative direction, conventionally normalized to unit length. Its sign is also arbitrary: if `v` is an eigenvector, so is `-v`, which is why two correct computations of the same eigenvector can differ by a sign flip. ## Eigenvalues need not be real Over the real numbers, some matrices have no eigenvectors at all. The rotation `[[0,-1],[1,0]]` turns every vector by 90 degrees, so no real direction is preserved; its eigenvalues are `+i` and `-i`. Allowed complex values, an `n x n` matrix always has `n` eigenvalues counted with multiplicity. There is an important special case: a **real symmetric** matrix (one with `A = A^T`) always has real eigenvalues and can always be given a full orthonormal set of real eigenvectors. Since covariance matrices and Gram matrices are symmetric, most eigen-structure met in statistics and machine learning is real and orthogonal. ## Why practitioners care Eigenvectors identify the intrinsic axes of a linear map — the coordinate system in which the map is nothing but independent scalings. That makes repeated application easy to reason about (`A^k` scales each eigen-direction by `lambda^k`, so the largest `|lambda|` eventually dominates), it turns coupled systems into uncoupled ones, and for a covariance matrix it exposes the orthogonal directions along which data actually spreads. Every one of those payoffs rests on the one-line definition `Av = lambda v`.

  • Why is the zero vector explicitly excluded from being an eigenvector?
    Because `A0 = 0 = lambda 0` for every scalar, so admitting it would make every number an eigenvalue of every matrix and the definition meaningless. The exclusion is on the vector only: an eigen*value* of zero is perfectly legal and means `A` collapses that direction, which is the same as saying `A` is singular.
  • If v is an eigenvector of A, is 2v also one?
    Yes. `A(2v) = 2(Av) = 2(lambda v) = lambda(2v)`, so every nonzero multiple is an eigenvector with the same eigenvalue. The full solution set of `Av = lambda v` is a subspace, the eigenspace. That is why reported eigenvectors are normalized to unit length and why the sign is arbitrary.
  • Can a real matrix have no real eigenvectors at all?
    Yes. The 90-degree rotation `[[0,-1],[1,0]]` moves every real direction, and its characteristic equation `lambda^2 + 1 = 0` has roots `+i` and `-i`. Over the complex numbers eigenvalues always exist; over the reals they may not. Real symmetric matrices are the safe case — their eigenvalues are always real.

A matrix is a wind that pushes most kites sideways. Eigenvectors are the strings already lined up with the wind: they get pulled tighter or slacker, but never swing off their line.

saying these in an interview costs you the question

  • Calls the zero vector an eigenvector
  • Claims eigenvalues must be positive
  • Says an eigenvector's length cannot change under A
  • Swaps the words eigenvalue and eigenvector
  • Assumes every real matrix has real eigenvectors
  • Thinks an eigenvector is a single unique vector, not a whole line

context

open as a page

What does the singular value decomposition A = U S V^T tell you about a matrix A?

level: juniorimportance: must knowfreq 70%

basics

~20 s

Every real matrix factors as A = U S V^T. U and V hold orthonormal directions in the output and input spaces, S is diagonal with non-negative singular values in descending order, and the number of nonzero ones equals the rank.

open as a page

How do you find the eigenvalues of the matrix [[2,1],[1,2]] by hand?

level: middleimportance: must knowfreq 68%

basics

~20 s

Solve det(A - lambda I) = 0. For [[2,1],[1,2]] that is (2 - lambda)^2 - 1 = 0, giving lambda = 3 and 1. Substituting each back into (A - lambda I)v = 0 yields eigenvectors (1,1) and (1,-1).

open as a page

Why is the truncated SVD the best rank-k approximation of a matrix?

level: middleimportance: must knowfreq 62%

basics

~20 s

The Eckart-Young theorem guarantees it: keeping the k largest singular values and their vectors minimizes the approximation error over all matrices of rank at most k, in both Frobenius and spectral norm. The discarded singular values fix the error exactly.

open as a page

What do the eigenvectors of a 2x2 covariance matrix represent geometrically?

level: middleimportance: should knowfreq 56%

basics

~20 s

They are the principal axes of the data's elliptical cloud: orthogonal directions along which the data spreads independently. Each eigenvalue is the variance measured along its own eigenvector, and the eigenvalues sum to the total variance, the matrix trace.

open as a page

Why is the shear matrix [[1,1],[0,1]] not diagonalizable as A = P D P^-1?

level: middleimportance: should knowfreq 50%

basics

~20 s

Its characteristic equation (1 - lambda)^2 = 0 repeats lambda = 1, but the eigenspace is only the line through (1,0). One independent eigenvector instead of two means no eigenbasis, so no invertible P exists: the matrix is defective.

open as a page

How do the singular values of a matrix A relate to the eigenvalues of A^T A?

level: middleimportance: should knowfreq 52%

basics

~20 s

The singular values of A are the square roots of the eigenvalues of A^T A, which are always real and non-negative. The eigenvectors of A^T A are the right singular vectors, the columns of V.

open as a page

How do eigenvalues distinguish a positive-definite matrix from a merely PSD one?

level: seniorimportance: should knowfreq 46%

basics

~20 s

For a symmetric matrix, positive definite means every eigenvalue is strictly greater than zero; positive semidefinite means every eigenvalue is greater than or equal to zero. A zero eigenvalue is exactly what separates them, and it makes the matrix singular.

open as a page

How does the Moore-Penrose pseudoinverse solve a rank-deficient least-squares problem?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Build A^+ = V S^+ U^T from the SVD by inverting each nonzero singular value and leaving zeros as zeros. Then x = A^+ b minimizes ||Ax - b|| and, among the infinitely many minimizers, is the one with smallest norm.

open as a page

How does power iteration find the dominant eigenvector of a large matrix?

level: seniorimportance: nice to knowfreq 30%

basics

~20 s

Start from a random nonzero vector, repeatedly multiply by the matrix, and renormalize each step. Components along smaller eigenvalues shrink relative to the largest one, so the vector converges to the dominant eigenvector at rate |lambda2 / lambda1| per iteration.

open as a page

How do you pick the truncated-SVD rank k for a users-by-items ratings matrix?

level: principalimportance: nice to knowfreq 28%

basics

~20 s

Treat k as a budgeted tradeoff, not a formula. Let the flattening of the singular-value spectrum bracket a range, then choose inside it by held-out reconstruction error and the downstream metric, subject to storage and serving limits.

open as a page