Linear Algebra

Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure

Matrix decompositions open a linear map into directions and scales: eigendecomposition works when one space has enough eigenvectors, while SVD always gives input directions, output directions, and low-rank channels.

status: publishedimportance: criticaldifficulty 3/5math: undergraduateread: 20mlive demo

Concept Structure

Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure

01Intuition

Start with the picture, metaphor, or geometric mechanism.

02Math

Make the objects explicit and connect them with notation.

03Code

Mirror the equations with runnable implementation details.

04Interactive Demo

Manipulate the mechanism and watch the idea respond.

5prerequisites
3next concepts
1related links

Learning map

Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure
BeforeDot ProductNow4/4 sections readyTryManipulate one control and predict the visible change.NextLinear Regression & Least Squares

Object flow

4/4 sections readyAsk about thisResearch room
ConceptMatrix Decompositions: Eigendecomposition, SVD, and Spectral StructureLinear Algebra
4 sources attachedLocal snapshot ready
concept:linear-algebra/matrix-decompositions-eigendecomposition-svd-spectral

Conceptual Bridge

What should feel connected as you move through this page.

Carry inDot Product

Bring the mental model from Dot Product; this page will reuse it instead of restarting from zero.

Work hereMatrix Decompositions: Eigendecomposition, SVD, and Spectral Structure

Matrix decompositions open a linear map into directions and scales: eigendecomposition works when one space has enough eigenvectors, while SVD always gives input directions, output directions, and low-rank channels.

Carry outLinear Regression & Least Squares

The next edge should feel earned: use the demo prediction here before following Linear Regression & Least Squares.

Test the linkManipulate one control and predict the visible change.Then continue to Linear Regression & Least Squares
01

01

Intuition

Build the mental picture first so the rest of the page has something to attach to.

Section prompt

A matrix can feel like a box of unrelated numbers. A decomposition tries to open the box.

The useful question is:

Can we find directions where the matrix acts simply?

For some square matrices, an input direction comes out pointing in the same direction, only rescaled. That is an eigenvector. Eigendecomposition uses those special directions as a coordinate system. In that coordinate system, the matrix is just independent stretching by eigenvalues.

For symmetric matrices, the story is especially clean. The spectral theorem says a real symmetric matrix has an orthonormal basis of eigenvectors. Geometrically, a symmetric matrix is like rotating into a perfectly aligned set of axes, scaling those axes, and rotating back.

SVD is the version that works for every real matrix, including rectangular matrices. It does not ask for an input direction to come out in the same direction. Instead, it asks:

  • Which orthogonal input directions does the matrix listen to?
  • How strongly does it stretch each one?
  • Which orthogonal output directions do those stretches land on?

That gives

A=UΣVT.A = U\Sigma V^{\mathsf T}.

Read it from right to left:

  1. VTV^{\mathsf T} rotates or reflects the input into right singular coordinates.
  2. Σ\Sigma keeps, stretches, shrinks, or removes independent channels.
  3. UU rotates or reflects those channels into output coordinates.

The same picture explains low-rank approximation. If a few singular values are much larger than the rest, most of the matrix's action passes through a few strong channels. Keeping only those channels gives a compressed matrix that often preserves the important structure.

One sentence to carry through the page:

A spectral decomposition is a way to replace a complicated matrix by directions, independent scales, and the caveats that tell us when that story is legal.

02

02

Math

Translate the story into symbols, assumptions, and a derivation you can inspect.

Section prompt

Let

ARn×n.A \in \mathbb R^{n\times n}.

A nonzero vector piRnp_i\in\mathbb R^n is an eigenvector of AA with eigenvalue λi\lambda_i when

Api=λipi.Ap_i = \lambda_i p_i.

If AA has nn linearly independent eigenvectors, stack them as columns of

P=[p1,,pn].P = [p_1,\ldots,p_n].

Then PP is invertible, and

A=PΛP1,A = P\Lambda P^{-1},

where

Λ=diag(λ1,,λn).\Lambda = \operatorname{diag}(\lambda_1,\ldots,\lambda_n).

This is eigendecomposition. It says: change into the eigenvector basis, scale each coordinate by its eigenvalue, then change back.

The important caveat is that not every square matrix has enough independent eigenvectors. When it does not, this diagonalization story is not available in this simple form.

For a real symmetric matrix

S=STRn×n,S = S^{\mathsf T}\in\mathbb R^{n\times n},

the spectral theorem gives a stronger guarantee. There is an orthogonal matrix QQ, whose columns are orthonormal eigenvectors, and a real diagonal matrix Λ\Lambda such that

S=QΛQT.S = Q\Lambda Q^{\mathsf T}.

Because Q1=QTQ^{-1}=Q^{\mathsf T}, the geometry is clean: orthonormal basis change, independent scaling, orthonormal basis change back.

Now let

ARm×n.A\in\mathbb R^{m\times n}.

The singular value decomposition is

A=UΣVT,A = U\Sigma V^{\mathsf T},

where URm×mU\in\mathbb R^{m\times m} and VRn×nV\in\mathbb R^{n\times n} are orthogonal in the full SVD, and ΣRm×n\Sigma\in\mathbb R^{m\times n} is rectangular diagonal. Its diagonal entries are singular values

σ1σ2σr>0,\sigma_1\ge \sigma_2\ge \cdots \ge \sigma_r>0,

where r=rank(A)r=\operatorname{rank}(A). In reduced form, we keep only the rr nonzero channels:

A=i=1rσiuiviT.A = \sum_{i=1}^{r}\sigma_i u_i v_i^{\mathsf T}.

Each term is one rank-1 channel. The right singular vector viv_i is an input direction, the scalar σi\sigma_i is the gain, and the left singular vector uiu_i is the output direction:

Avi=σiui.Av_i = \sigma_i u_i.

The link back to eigenvalues is:

ATAvi=σi2vi,A^{\mathsf T}A v_i = \sigma_i^2 v_i,

and

AATui=σi2ui.AA^{\mathsf T}u_i = \sigma_i^2 u_i.

So right singular vectors are eigenvectors of ATAA^{\mathsf T}A, left singular vectors are eigenvectors of AATAA^{\mathsf T}, and singular values are square roots of the corresponding nonzero eigenvalues.

The singular values themselves are fixed, but the displayed singular vectors are not always unique. Flipping the signs of both uiu_i and viv_i leaves σiuiviT\sigma_i u_i v_i^{\mathsf T} unchanged. If singular values are tied, any orthonormal basis inside that tied subspace is valid. The basis chosen for zero singular directions is also non-unique.

If σi=0\sigma_i=0, that channel vanishes. The zero right-singular directions span the null space. A tiny nonzero singular value means the channel exists in exact algebra but is numerically fragile.

The rank-kk truncated SVD keeps only the kk strongest channels:

Ak=i=1kσiuiviT.A_k = \sum_{i=1}^{k}\sigma_i u_i v_i^{\mathsf T}.

Eckart-Young says this is the best rank-kk approximation to AA in spectral norm:

AAk2=σk+1.\|A-A_k\|_2 = \sigma_{k+1}.

This theorem is powerful, but it should be read with scope. It optimizes a matrix approximation norm. A real learning task may care about labels, fairness, robustness, interpretability, or downstream loss, so the largest singular values are not automatically the only values that matter.

03

03

Code

Keep the implementation aligned with the notation so the algorithm is legible.

Section prompt
import numpy as np

A = np.array([[3.0, 1.0, 1.0],
              [1.0, 3.0, 1.0],
              [0.0, 0.0, 0.4],
              [0.0, 0.0, 0.0]])

U, s, Vt = np.linalg.svd(A, full_matrices=False)
rank = np.count_nonzero(s > 1e-10)
total = np.linalg.norm(A, "fro")

print("singular values:", np.round(s, 4))
print("rank:", rank)

for k in range(1, len(s) + 1):
    Ak = (U[:, :k] * s[:k]) @ Vt[:k]
    theorem_spectral = s[k] if k < len(s) else 0.0
    actual_spectral = np.linalg.norm(A - Ak, 2)
    fro_error = np.linalg.norm(A - Ak, "fro") / total
    print(f"rank-{k} spectral error:", round(actual_spectral, 4),
          "next singular value:", round(theorem_spectral, 4),
          "relative Frobenius error:", round(fro_error, 4))

A_rebuilt = (U * s) @ Vt
print("SVD rebuilds A:", np.allclose(A, A_rebuilt))

S = np.array([[2.0, 1.0],
              [1.0, 2.0]])
eigenvalues, Q = np.linalg.eigh(S)
order = eigenvalues.argsort()[::-1]
eigenvalues, Q = eigenvalues[order], Q[:, order]
S_rebuilt = Q @ np.diag(eigenvalues) @ Q.T

print("symmetric eigenvalues:", np.round(eigenvalues, 4))
print("Q^T Q:", np.round(Q.T @ Q, 4))
print("spectral rebuilds S:", np.allclose(S, S_rebuilt))

The SVD loop reconstructs AA one rank-1 channel at a time. The spectral-error lines check the theorem numerically: after keeping kk channels, the measured operator-norm error matches the next singular value. The symmetric example shows the special eigendecomposition case where the basis matrix is orthogonal.

04

04

Interactive Demo

Use direct manipulation to connect the explanation to a moving system.

Section prompt

The matrix below is built from three exact orthonormal rank-1 channels. Before revealing the singular values, predict the smallest kk that gets the rank-kk reconstruction to at most 20 percent relative Frobenius error.

The reveal shows the singular spectrum, the rank-1, rank-2, and rank-3 reconstructions, and the leftover relative Frobenius error after each choice. The point is not that 20 percent is universal. It is that singular values give a precise way to ask which independent channels carry most of a matrix.

Live Concept Demo

Explore Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure

The stage is code-native and interactive. Use it to test the explanation against the mechanism.

difficulty 3/5undergraduatecode-aligned
Demo Prediction Checkpoint

Manipulate one control and predict the visible change.

Commit to what Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure should make visible before reading the result.

After The First Pass

Turn the concept into an inspected object.

Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.

Mechanism Storyboard

See the idea move before the page explains it

Matrix decompositions open a linear map into directions and scales: eigendecomposition works when one space has enough eigenvectors, while SVD always gives input directions, output directions, and low-rank channels.

Prediction open01 / Intuition
Prediction lens

Start with the picture, metaphor, or geometric mechanism.

Commit first

Before reading further, choose the kind of change Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure should make visible.

Visual Inquiry

Make the image answer a mathematical question

Matrix decompositions open a linear map into directions and scales: eigendecomposition works when one space has enough eigenvectors, while SVD always gives input directions, output directions, and low-rank channels.

4/4 stages readyLive demo connected
Prediction

Which visible object should carry the first intuition?

Commit first

Pick the cue that should make Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure easier to reason about before the page gives the answer.

Source Grounding

Canonical references for the mechanism on this page.

book · 2020Mathematics for Machine LearningDeisenroth, Faisal, and Ong

Primary learner source for diagonalization, the spectral theorem for symmetric matrices, SVD geometry, singular vectors, rank-k approximation, and Eckart-Young.

Open source
book · 2016Deep Learning, Chapter 2: Linear AlgebraGoodfellow, Bengio, and Courville

Curriculum source for eigendecomposition of real symmetric matrices, quadratic-form eigenvalue intuition, positive definiteness, and why SVD applies more generally.

Open source
book · 2004Convex Optimization, Appendix A.5Boyd and Vandenberghe

Reference source for symmetric eigenvalue decomposition, SVD, singular values as operator norms, condition number, and pseudoinverse facts.

Open source
documentation · 2026NumPy linear algebra reference: svd and eighNumPy Developers

Documentation source for the runnable witness helpers used to compute SVD and symmetric eigendecomposition.

Open source

Claim Review

Matrix decompositions open a linear map into directions and scales: eigendecomposition works when one space has enough eigenvectors, while SVD always gives input directions, output directions, and low-rank channels.

Status1 substantive review recorded

Claims without a substantive review badge still need exact source-support review.

Sources4 references

deisenroth-2020-mml-eigendecomposition-svd, goodfellow-2016-deep-learning-linear-algebra, boyd-vandenberghe-2004-spectral-svd, numpy-linalg-svd-eigh-docs

Witnesses4 local objects

Use equation, code, and demo objects to check whether the source support is operational.

Substantively reviewedSuitable square matrices diagonalize in an eigenbasis; real symmetric matrices have orthonormal spectral decompositions; every real matrix has an SVD, and rank-k truncation is spectral-norm optimal.Claim metadata: source checked

The page teaches the shared invariant across the cited sources: change basis, scale along independent directions, change basis back or into the output space.

Sources: Mathematics for Machine Learning, Deep Learning, Chapter 2: Linear Algebra, Convex Optimization, Appendix A.5, NumPy linear algebra reference: svd and eighNot every square matrix is diagonalizable over real eigenvectors. Repeated values and vector signs are non-unique, and spectral-norm rank-k optimality does not mean every ML task should keep only the largest k channels.A bounded review summary is present; still check caveats and exact source scope.

MML supports diagonalizability, the spectral theorem, SVD geometry, singular-vector equations, zero singular directions, rank-k expansion, and Eckart-Young. Deep Learning Book supports symmetric EVD and SVD generality. Boyd supports spectral/SVD facts, operator norm, condition number, and pseudoinverse links.

Reviewer: codex-source-excerpt-audit; reviewed 2026-06-28

Practice Loop

Try the idea before it explains itself

Matrix decompositions open a linear map into directions and scales: eigendecomposition works when one space has enough eigenvectors, while SVD always gives input directions, output directions, and low-rank channels.

Readiness0/3 checks ready
Predict

Before touching the demo, predict one visible change that should happen in Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure.

Hint 1

Reveal when your model needs a nudge.

Hint 2

Reveal when your model needs a nudge.

Hint 3

Reveal when your model needs a nudge.

Object research drawerClose
ConceptMatrix Decompositions: Eigendecomposition, SVD, and Spectral StructureLinear Algebra

Research Room

Attach the question to an exact object

Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.
Next local actionNo local draft saved yet

Open the draft below to save one note and next action in this browser.

conceptLinear Algebra

Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure

Anchored question

What is the smallest example that makes Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure click without losing the math?

Local action draftNo local draft saved yetExpand only when ready to capture one local next action
Local action draft

This draft stays locally in this browser for concept:linear-algebra/matrix-decompositions-eigendecomposition-svd-spectral.

No local draft saved.
Evidence to inspect
  • Source ids to inspect: deisenroth-2020-mml-eigendecomposition-svd, goodfellow-2016-deep-learning-linear-algebra, boyd-vandenberghe-2004-spectral-svd, numpy-linalg-svd-eigh-docs
  • Definition, prerequisite, and contrast concept links
  • The equation or code witness that makes the concept operational
  • One demo state that shows the invariant instead of a slogan
What would resolve this
  • The learner can state the mechanism in their own words
  • The learner can name the prerequisite that would repair confusion
  • The learner can predict how the mechanism changes under one perturbation
Grounded AI handoff

I am working in Continuous Function's research reading room. Object: concept - Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure Object key: concept:linear-algebra/matrix-decompositions-eigendecomposition-svd-spectral Context: Linear Algebra Anchor id: concept/concept-notebook/linear-algebra/matrix-decompositions-eigendecomposition-svd-spectral Open question: What is the smallest example that makes Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure click without losing the math? Evidence to inspect: - Source ids to inspect: deisenroth-2020-mml-eigendecomposition-svd, goodfellow-2016-deep-learning-linear-algebra, boyd-vandenberghe-2004-spectral-svd, numpy-linalg-svd-eigh-docs - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.

Open source object
concept/concept-notebook/linear-algebra/matrix-decompositions-eigendecomposition-svd-spectral concept:linear-algebra/matrix-decompositions-eigendecomposition-svd-spectral