AᵀA gives the singular values and V; uᵢ = A vᵢ / σᵢ gives U; then A = U Σ Vᵀ, a sum of rank-one pieces.
Preset?Every matrix, square or not, maps the unit sphere to an ellipsoid. The singular values σᵢ are the semi-axes, the columns of U their directions in the output space, and the columns of V the input directions that land on them: A vᵢ = σᵢ uᵢ. Computing it by hand goes through AᵀA, whose eigenvalues are σᵢ² and whose eigenvectors are the vᵢ; then uᵢ = A vᵢ / σᵢ.
Size
A2×2
Entries of A
A2×2
3
0
4
5
Step 1 / 11
Step explanations
1Singular value decomposition of a 2×2 matrix
The goal is A = U Σ Vᵀ with U (m×m) and V (n×n) orthogonal and Σ (m×n) diagonal with the singular values σ₁ ≥ σ₂ ≥ … ≥ 0. Geometrically: A sends the orthonormal input directions vᵢ to the orthogonal output directions σᵢuᵢ — the unit sphere becomes an ellipsoid with semi-axes σᵢ. Plan: form AᵀA, take its eigenvalues and eigenvectors, set σᵢ = √λᵢ and uᵢ = A vᵢ / σᵢ, and assemble.
Choose a matrix of any shape from 2×2 to 3×3 and watch it factor into UΣVT.
• Use the Preset pills for seven matrices: a classic 2×2, a rank-one matrix, a symmetric one, a rotation, a wide 2×3, a tall 3×2, and a 3×3 with a repeated singular value • Use the two Size steppers for rows and columns independently, and Shuffle for a random small-integer matrix • Edit any entry directly • Hover the ? icon for a reminder of what the pieces mean geometrically • Press play or step manually; the step log on the right keeps every stage
The computation is the hand method: eigenvalues and eigenvectors of ATA, square roots for the singular values, ui=Avi/σi, and completion of U when the rank is less than m. The eigenvalues of ATA are reported rather than derived, since the eigenvalue visualizer shows that derivation.
The Scenes in Order
The visualizer follows the textbook procedure exactly.
• Form ATA — an n×n symmetric positive semidefinite matrix • Eigenvalues and singular values — λi≥0 of ATA in decreasing order and σi=λi, with the rank read off and ∑σi2 checked against the sum of squared entries • Right singular vectors — for each eigenvalue, ATA−λI row reduced and one integer vector per free column, orthogonalized inside a repeated eigenspace, then normalized • Left singular vectors — ui=Avi/σi for each σi>0, with the length of Avi confirmed as σi • Complete U — only when there are fewer non-zero singular values than rows: Gram–Schmidt on standard basis vectors fills the remaining orthonormal columns • Assemble — U, the rectangular Σ, and VT • Factor — A=U⋅Σ⋅VT multiplied out • Rank-one sum — A=σ1u1v1T+σ2u2v2T+⋯ • Done — rank, norms, condition number, the ellipse picture, and the four fundamental subspaces
Forming A Transpose A
The first move is to multiply AT by A. The frozen picture below shows it for the default preset: ATA=(25202025), symmetric, with the squared column lengths on the diagonal and the dot product of the columns off it.
Everything about the singular values and V is in this matrix.
AᵀA, frozen
The default preset: AᵀA = [25, 20; 20, 25], symmetric with the squared column lengths on the diagonal and the dot product of the columns off it.
ATA is symmetric because (ATA)T=ATA, and positive semidefinite because xTATAx=∣Ax∣2≥0. So the spectral theorem applies: real non-negative eigenvalues and an orthonormal eigenvector basis. That is why the SVD of an arbitrary matrix reduces to the spectral decomposition of a symmetric one.
The other product, AAT, has the same non-zero eigenvalues and gives U directly. The tool uses ATA for V and then Avi/σi for U, which is less work and keeps the signs consistent automatically.
The Singular Values
The frozen picture below shows ATA leading to its eigenvalues 45 and 5 and then to σ=45,5.
Both are non-zero, so the rank is 2, and 45+5=50 equals the sum of the squared entries of A.
Singular values, frozen
Eigenvalues 45 and 5 of AᵀA, then σ = √45, √5. Both non-zero: rank 2. Check: 45 + 5 = 50 = 9 + 0 + 16 + 25.
The singular values are the lengths of the semi-axes of the ellipse that A makes from the unit circle. The largest, 45≈6.7, is the most any unit vector is stretched, the spectral norm; the smallest non-zero, 5≈2.2, is the least, and their ratio 3 is the condition number.
The identity ∑σi2=∑aij2 is the quickest check on the arithmetic. It holds because both sides equal the trace of ATA: the left as the sum of its eigenvalues, the right as the sum of its diagonal entries.
From v to u
The frozen picture below shows the first left singular vector: A applied to v1=(1,1)/2 gives (3,9)/2, of length 45 exactly, and dividing by σ1 leaves the unit vector u1=(1,3)/10.
The length of Av1 coming out as σ1 is not luck: ∣Av∣2=vTATAv=λ.
u₁ = A v₁ / σ₁, frozen
A times v₁ = (1, 1)/√2 gives (3, 9)/√2, of length √45 exactly; dividing by σ₁ leaves u₁ = (1, 3)/√10.
This is the step that makes the SVD geometric. The vi are the perpendicular input directions along which A acts as a pure stretch, and ui is where each one lands. The ui are perpendicular to one another because Avi⋅Avj=viTATAvj=λjvi⋅vj=0.
Contrast eigenvectors, where the input and output directions are the same. For a non-symmetric matrix that requirement is what forces skewed or complex eigenvectors; the SVD gives up on it, allows two different orthonormal bases, and in exchange works for every matrix.
The Factorization
The frozen picture below shows A=UΣVT for the default preset, with the columns of U, the diagonal of Σ and the rows of VT in matching colours.
Read from the right: VT rotates the input by 45°, Σ stretches by 45 and 5, and U rotates and reflects into the output axes.
A = U Σ Vᵀ, frozen
Columns of U, diagonal of Σ and rows of Vᵀ in matching colours. Rotate by 45°, stretch by √45 and √5, rotate again: the product reproduces A.
Every matrix is a rotation, a stretch along the axes, and another rotation; that is the whole statement, and it holds in any dimensions, including m=n, where Σ is rectangular and either drops input dimensions or embeds into extra output dimensions.
Because U and V are orthogonal, they preserve lengths, so all the stretching is in Σ. This is what makes the singular values the right measure of a matrix's size and conditioning, and why numerical algorithms for the SVD are the most trusted in linear algebra: nothing in the orthogonal factors can amplify error.
The Rank-One Expansion
The frozen picture below shows the default preset as 45u1v1T+5u2v2T: two rank-one matrices adding to A.
The first term alone is the best rank-one approximation of A; its error, in the spectral norm, is 5.
Rank-one expansion, frozen
A = √45 u₁v₁ᵀ + √5 u₂v₂ᵀ. The first term alone is the best rank-one approximation of A, with error √5.
Each term σiuiviT takes the component of the input along vi, scales it by σi, and outputs it along ui. The terms are ordered by σi, so the sum lists the actions of A from most to least significant. Truncating after k terms gives the nearest rank-k matrix, a theorem due to Eckart and Young, and the discarded singular values measure exactly what was lost.
For a 2×2 matrix the expansion is a curiosity. For a 1000×1000 image it is compression: a few dozen terms often reproduce the picture, and the singular values say how many are needed.
Completing U
The tall preset 110011 has two singular values, 3 and 1, and Avi/σi gives two columns of U. But U must be 3×3. The frozen picture below shows the completed U: u1=(1,2,1)/6, u2=(1,0,−1)/2, and a third column (1,−1,1)/3 perpendicular to both.
The third column multiplies a zero row of Σ and does not affect the product.
Completing U, frozen
The tall preset: two columns from A vᵢ / σᵢ, and a third, (1, −1, 1)/√3, from Gram–Schmidt on e₁. It spans the left null space and multiplies a zero row of Σ.
The added column spans the left null space of A, the vectors y with ATy=0; it is the direction in the output space that A cannot reach. Gram–Schmidt on a standard basis vector finds it: subtract the projections onto u1 and u2 and normalize what is left.
Many texts avoid the completion by using the reduced SVD, with U of size m×r and Σ square r×r. The product is the same; the full form is the one with U orthogonal, and the one that displays all four fundamental subspaces at once.
A Rank-One Matrix
The rank-one preset (1224) has singular values 5 and 0. The frozen picture below shows its expansion: a single term, 5u1v1T with u1=v1=(1,2)/5, which is the matrix itself.
The zero singular value contributes nothing, and v2=(2,−1)/5 spans the null space.
A rank-one matrix, frozen
The rank-one preset: σ = 5 and 0, so the expansion has one term, 5 u₁v₁ᵀ with u₁ = v₁ = (1, 2)/√5 - which is A itself.
A rank-one matrix is an outer product σuvT, and the SVD recognizes it as such: one term and nothing else. The second column of V is the direction A collapses, and the second column of U, obtained by completion, the direction A never reaches.
The condition number of a singular matrix is infinite, and the tool says so. Near-singular matrices, with a small but non-zero σ2, are the practical concern: their condition number is large, and solving with them amplifies errors by that factor.
Reading the Scene Player
Each scene shows the matrices for one step with the arithmetic in the caption.
• The columns of U, the diagonal of Σ and the rows of VT share one colour per index, since each triple is one equation Avi=σiui • Non-zero singular values are accent, zero ones muted; the off-diagonal zeros of Σ are grey • Entries of U and V are decimals because they involve square roots; the captions give the exact forms, such as (1,3)/10, and the singular values as 45 rather than 6.708 when they are square roots of integers • In the completion scene the columns obtained from Avi keep their colours and the added columns are secondary • The rank-one terms are shown as separate matrices that add up to A
Choosing a Matrix
The seven presets each make a different point.
• 2×2 classic — (3405) with σ=45,5; V is the 45° rotation and U has columns (1,3)/10 and (3,−1)/10 • Rank one — (1224) with σ=5,0; one term, and U needs completing • Symmetric — (2112); the singular values are the eigenvalues 3,1 and U=V, so the SVD is the spectral decomposition • Rotation — σ=1,1; a repeated singular value, V=I and U is the rotation itself • Wide 2×3 — σ=3,1 and a third v3 with λ=0 spanning the null space • Tall 3×2 — σ=3,1 and a third column of U from Gram–Schmidt • 3×3 — σ=2,1,1; a repeated singular value needing Gram–Schmidt inside the eigenspace of ATA
Shuffle produces small-integer matrices whose singular values are usually irrational; the tool shows them to four decimals.
What the SVD Is
Every real m×n matrix can be written as
A=UΣVT
with U an m×m orthogonal matrix, V an n×n orthogonal matrix, and Σ an m×n matrix whose only non-zero entries are σ1≥σ2≥⋯≥σr>0 on the diagonal, where r is the rank. Column by column the equation says
Avi=σiui
An orthonormal set of input directions is sent to an orthogonal set of output directions, each scaled by its singular value. The unit sphere in Rn becomes an ellipsoid in Rm with semi-axes σi along ui; directions with σi=0 are flattened away.
The hand computation goes through ATA. Substituting the factorization, ATA=VΣTΣVT, which is the spectral decomposition of the symmetric matrix ATA with eigenvalues σi2 and eigenvectors vi. So the vi and σi come from a symmetric eigenvalue problem, and then ui=Avi/σi for each positive σi. These ui are automatically orthonormal, because Avi⋅Avj=viTATAvj=σj2vi⋅vj. If r<m, the remaining columns of U are any orthonormal completion.
Expanding the product gives the other form,
A=σ1u1v1T+σ2u2v2T+⋯+σrurvrT
a sum of r rank-one matrices in decreasing order of importance. Keeping the first k terms gives the closest rank-k matrix to A, in both the spectral and Frobenius norms, which is why the SVD underlies compression and dimensionality reduction. For the theory, see the singular value decomposition page and the spectral decomposition theory page.
Key Properties
Facts that hold for every matrix.
• Existence: every matrix has an SVD, square or not, invertible or not, symmetric or not • Singular values are unique; U and V are unique up to signs when the singular values are distinct, and up to rotations within a repeated one • Rank is the number of non-zero singular values, and the SVD is the numerically reliable way to compute it • Norms: ∥A∥2=σ1 and ∥A∥F2=∑σi2= the sum of the squares of all entries • Condition numberσ1/σr measures how much A amplifies relative errors when solving Ax=b • Four subspaces: u1,…,ur span the column space, ur+1,… the left null space, v1,…,vr the row space, vr+1,… the null space, all orthonormal • Pseudoinverse: A+=VΣ+UT, with Σ+ inverting the non-zero singular values; A+b is the least-squares solution of minimum length • Inverse: for square invertible A, A−1=VΣ−1UT and the singular values of A−1 are 1/σi • Symmetric positive semidefinite A: the SVD is the spectral decomposition, U=V and σi=λi; for symmetric A in general, σi=∣λi∣ • Determinant: for square A, ∣detA∣=∏σi
Why It Matters
The SVD is the factorization that works for every matrix, and most of applied linear algebra rests on it.
• Low-rank approximation: keeping the largest singular values compresses images, signals and data matrices with the least possible error • Principal component analysis: the right singular vectors of a centred data matrix are the principal components and the singular values measure the variance along them, without ever forming the covariance matrix • Least squares: the pseudoinverse solves overdetermined and rank-deficient systems, and the singular values show which directions are poorly determined • Numerical rank and conditioning: tiny singular values reveal near-dependence among columns that Gaussian elimination cannot see reliably • Recommender systems and latent semantic analysis: users-by-items and documents-by-terms matrices are factored into a few dominant rank-one patterns • Geometry of a map: the singular vectors and values give the exact stretching, in any dimension, for matrices that are not square and have no eigenvectors • Polar decomposition and Procrustes: A=(UVT)(VΣVT) splits any map into a rotation and a symmetric stretch, and UVT is the nearest orthogonal matrix to A
Worked Example
Take the default preset,
A=(3405)
ATA.ATA=(25202025).
Eigenvalues.λ2−50λ+225=0 gives λ=45,5, so σ1=45 and σ2=5. Check: 45+5=50=9+0+16+25.
Right singular vectors. For 45: ATA−45I=(−202020−20) gives v1=(1,1)/2. For 5: (20202020) gives v2=(1,−1)/2.
Left singular vectors.Av1=(3,9)/2, of length 90/2=45, so u1=(3,9)/90=(1,3)/10. Av2=(3,−1)/2, of length 5, so u2=(3,−1)/10. Their dot product is 0.
Assemble.
U=101(133−1),Σ=(45005),VT=21(111−1)
Check.ΣVT=21(45545−5), and UΣVT=201(45+35345−545−35345+5). With 45=35 and 20=25 this is 21(68010)=A.
Numbers. Rank 2, ∥A∥2=45≈6.71, ∥A∥F=50, condition number 45/5=3, and ∣detA∣=15=455. The unit circle maps to an ellipse with semi-axes 45 along (1,3) and 5 along (3,−1).
Common Mistakes
A few mistakes recur.
• Forgetting the square root — the eigenvalues of ATA are σi2, not σi • Taking eigenvectors of A instead of ATA — for a non-symmetric matrix they are different, and A may not have real eigenvectors at all • Mismatched signs — if vi is replaced by −vi then ui must be too; ui is computed from vi, never chosen independently • Wrong order — the singular values must decrease along the diagonal, and U and V must follow the same order • Square Σ for a rectangular A — Σ has the shape of A, with zero rows or columns making up the difference • Stopping at r columns of U — U must be square and orthogonal; the extra columns come from an orthonormal completion, though the reduced SVD, with U of size m×r, is also standard • Forgetting to normalize vi — an integer eigenvector gives the right direction but the wrong length for Avi=σiui • Reading singular values as eigenvalues — they agree only for symmetric positive semidefinite matrices; in general σi=∣λi∣
Related Concepts
Spectral decomposition — of ATA, which is where V and the singular values come from; for symmetric positive semidefinite A the two decompositions coincide.