Bring the mental model from Dot Product; this page will reuse it instead of restarting from zero.
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.
Concept Structure
Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learning map
Matrix Decompositions: Eigendecomposition, SVD, and Spectral StructureConceptual Bridge
What should feel connected as you move through this page.
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.
The next edge should feel earned: use the demo prediction here before following Linear Regression & Least Squares.
01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
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
Read it from right to left:
- rotates or reflects the input into right singular coordinates.
- keeps, stretches, shrinks, or removes independent channels.
- 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
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let
A nonzero vector is an eigenvector of with eigenvalue when
If has linearly independent eigenvectors, stack them as columns of
Then is invertible, and
where
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
the spectral theorem gives a stronger guarantee. There is an orthogonal matrix , whose columns are orthonormal eigenvectors, and a real diagonal matrix such that
Because , the geometry is clean: orthonormal basis change, independent scaling, orthonormal basis change back.
Now let
The singular value decomposition is
where and are orthogonal in the full SVD, and is rectangular diagonal. Its diagonal entries are singular values
where . In reduced form, we keep only the nonzero channels:
Each term is one rank-1 channel. The right singular vector is an input direction, the scalar is the gain, and the left singular vector is the output direction:
The link back to eigenvalues is:
and
So right singular vectors are eigenvectors of , left singular vectors are eigenvectors of , 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 and leaves 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 , 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- truncated SVD keeps only the strongest channels:
Eckart-Young says this is the best rank- approximation to in spectral norm:
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
Code
Keep the implementation aligned with the notation so the algorithm is legible.
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 one rank-1 channel at a time. The spectral-error lines check the theorem numerically: after keeping 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
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
The matrix below is built from three exact orthonormal rank-1 channels. Before revealing the singular values, predict the smallest that gets the rank- 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.
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.
Start with the picture, metaphor, or geometric mechanism.
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.
Which visible object should carry the first intuition?
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.
Primary learner source for diagonalization, the spectral theorem for symmetric matrices, SVD geometry, singular vectors, rank-k approximation, and Eckart-Young.
Open sourceCurriculum source for eigendecomposition of real symmetric matrices, quadratic-form eigenvalue intuition, positive definiteness, and why SVD applies more generally.
Open sourceReference source for symmetric eigenvalue decomposition, SVD, singular values as operator norms, condition number, and pseudoinverse facts.
Open sourceDocumentation source for the runnable witness helpers used to compute SVD and symmetric eigendecomposition.
Open sourceClaim 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.
Claims without a substantive review badge still need exact source-support review.
deisenroth-2020-mml-eigendecomposition-svd, goodfellow-2016-deep-learning-linear-algebra, boyd-vandenberghe-2004-spectral-svd, numpy-linalg-svd-eigh-docs
Use equation, code, and demo objects to check whether the source support is operational.
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-28Source support candidates
book 2020Mathematics for Machine LearningPrimary learner source for diagonalization, the spectral theorem for symmetric matrices, SVD geometry, singular vectors, rank-k approximation, and Eckart-Young.
book 2016Deep Learning, Chapter 2: Linear AlgebraCurriculum source for eigendecomposition of real symmetric matrices, quadratic-form eigenvalue intuition, positive definiteness, and why SVD applies more generally.
book 2004Convex Optimization, Appendix A.5Reference source for symmetric eigenvalue decomposition, SVD, singular values as operator norms, condition number, and pseudoinverse facts.
documentation 2026NumPy linear algebra reference: svd and eighDocumentation source for the runnable witness helpers used to compute SVD and symmetric eigendecomposition.
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.
Before touching the demo, predict one visible change that should happen in Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
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.Open the draft below to save one note and next action in this browser.
Matrix Decompositions: Eigendecomposition, SVD, and Spectral Structure
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
This draft stays locally in this browser for concept:linear-algebra/matrix-decompositions-eigendecomposition-svd-spectral.
- 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
- 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
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.
concept/concept-notebook/linear-algebra/matrix-decompositions-eigendecomposition-svd-spectral
concept:linear-algebra/matrix-decompositions-eigendecomposition-svd-spectral