Every real matrix A can be decomposed as:
A = U Σ Vᵀ
U (m×m) — left singular vectors (orthogonal
columns, rotation/reflection) · Σ (m×n) —
diagonal matrix of singular values σ₁ ≥ σ₂ ≥ 0 ·
Vᵀ (n×n) — right singular vectors (orthogonal
rows, rotation/reflection).
Geometric interpretation: A maps the unit circle
to an ellipse with semi-axes σ₁ (along u₁) and σ₂
(along u₂). The columns of V are
the input directions that get the largest scaling. For det > 0
the transformation preserves orientation; det < 0 flips it.
Applications: principal component analysis (PCA),
image compression, pseudo-inverse, noise reduction, latent
semantic analysis. The nuclear norm
‖A‖* = Σ σᵢ is the trace-norm used in low-rank regularization.
About this Simulation
This visualizer computes the exact Singular Value Decomposition A = UΣVᵀ of any 2×2 matrix you enter, using a closed-form analytic solution rather than an iterative algorithm: the singular values σ₁ ≥ σ₂ are extracted from the eigenvalues of AᵀA, the right singular vectors v₁, v₂ are the corresponding eigenvectors of AᵀA, and the left singular vectors are recovered directly as uᵢ = Avᵢ / σᵢ. The left canvas panel draws the dashed unit circle with v₁ and v₂ — the input directions A stretches most — while the right panel shows the same circle mapped through A into an ellipse whose semi-axes are σ₁ and σ₂, aligned with u₁ and u₂. A bar chart reports what share of the matrix's squared (Frobenius) energy σ₁² + σ₂² the largest singular value alone captures.
🔍 What it shows
How any 2×2 linear map bends the unit circle into an ellipse: the right singular vectors v₁, v₂ mark the input directions stretched the most, the ellipse's semi-axes equal the singular values σ₁ and σ₂, and its axes point along the left singular vectors u₁, u₂. The stats bar also tracks the determinant, rank, spectral norm ‖A‖₂ = σ₁ and condition number σ₁/σ₂.
🖱️ How to use it
Click a preset (Identity, Scaling, Shear, Rotation 45°, Low Rank, Random) to load a ready-made matrix, or type your own values into the a, b, c, d fields — the ellipse, the U·Σ·Vᵀ matrix breakdown and every stat update live as you type. Press the ? button for the full formula reference panel.
💡 Did you know?
Stacking the SVD of a data matrix and keeping only the top few singular values gives the best possible low-rank approximation of that data — the mathematical basis for image compression, recommendation engines and principal component analysis. When σ₂ drops to zero, the "Low Rank" preset shows the ellipse collapse into a line: the matrix has become singular and irreversibly loses a whole dimension of information.
Frequently Asked Questions
What is Singular Value Decomposition (SVD)?
SVD factors any real m×n matrix A into A = UΣVᵀ, where U and V are orthogonal (rotation/reflection) matrices and Σ is diagonal with non-negative entries σ₁ ≥ σ₂ ≥ … called singular values. Geometrically it says every linear map is a rotation, followed by an axis-aligned stretch, followed by another rotation. Unlike eigendecomposition, SVD exists for every matrix, including non-square and non-invertible ones, which is why it underlies PCA, image compression and the Moore–Penrose pseudo-inverse.
How does this visualizer compute the SVD without an iterative algorithm?
For a 2×2 matrix the SVD has a closed-form solution. The code first computes AᵀA and finds its eigenvalues analytically from the trace and a discriminant term, giving σ₁² and σ₂² directly. The eigenvector of AᵀA associated with σ₁² becomes v₁ (with v₂ its orthogonal complement), and each left singular vector is obtained by pushing vᵢ through A and rescaling: uᵢ = Avᵢ/σᵢ. This avoids any iterative Jacobi or power-method sweep, so the result updates instantly on every keystroke.
What do the singular values σ₁ and σ₂ represent geometrically?
They are the lengths of the semi-axes of the ellipse that A produces when it maps the unit circle. σ₁ is the largest possible stretch factor A can apply to any unit vector (its spectral norm ‖A‖₂), and σ₂ is the smallest. Their ratio σ₁/σ₂ is the condition number shown in the stats bar; a large condition number means the matrix stretches some directions far more than others and is numerically close to singular.
Why are the left singular vectors (U) different from the right singular vectors (V)?
V's columns are the eigenvectors of AᵀA and describe input directions — where a unit vector must point before the transformation to end up stretched the most. U's columns describe the corresponding output directions after the transformation, computed as uᵢ = Avᵢ/σᵢ. For a symmetric matrix U and V coincide, but in general A rotates space on the way in and rotates it again (often differently) on the way out, so the two orthogonal bases are distinct unless A happens to be symmetric or a pure scaling.
What happens when a singular value equals zero?
A zero singular value means A collapses an entire input direction to the zero vector — the output ellipse degenerates into a line segment (rank 1) or a single point (rank 0), exactly what the "Low Rank" preset (matrix [[2,4],[1,2]], whose rows are proportional) demonstrates. The rank stat counts singular values above a small numerical threshold, the determinant becomes zero, and the condition number reported by the stats bar becomes infinite because the matrix can no longer be inverted.
How is the "energy captured" percentage in the bar chart calculated?
The simulator computes the squared Frobenius norm of A as σ₁² + σ₂² (equal to the sum of the squares of every matrix entry) and reports σ₁²/(σ₁²+σ₂²) as a percentage. This is the same quantity used to decide how many singular values to keep in a rank-k approximation of real data: keeping just σ₁ retains that percentage of the matrix's total "energy," which is why truncated SVD is such an effective compression and denoising tool in practice.
🔢 SVD Visualizer
About this simulation
Singular Value Decomposition factors any real matrix into a rotation, a
pure stretch and another rotation — the single most useful matrix
factorisation in applied mathematics. This visualizer shows the geometry
directly: edit a 2×2 matrix and watch the unit circle on the left map to
an ellipse on the right. The same decomposition powers principal-component
analysis, image compression, recommendation engines and the noise
reduction behind countless data-science pipelines.
How it works
The right singular vectors v₁, v₂ are drawn as the input directions that get stretched the most.
Matrix A maps the dashed unit circle into an ellipse whose semi-axes are the singular values σ₁ and σ₂.
The ellipse axes point along the left singular vectors u₁, u₂, scaled by their singular values.
The bar chart shows each σ and how much of the matrix's energy the largest singular value captures.
Key equations
A = U·Σ·Vᵀ — U holds the left singular vectors (output rotation),
Σ is diagonal with σ₁ ≥ σ₂ ≥ 0, and Vᵀ holds the right singular vectors (input rotation).
The condition number cond = σ₁ / σ₂ and the spectral norm ‖A‖₂ = σ₁.
Controls
Presets — load identity, scaling, shear, rotation, low-rank or random matrices.
a, b, c, d inputs — type each entry of the 2×2 matrix A and see the SVD update live.
Stats bar — read σ₁, σ₂, determinant, rank, spectral norm and condition number.
? — open this information panel.
Did you know?
A singular value of zero means the matrix collapses a whole direction to
nothing — that is exactly when its rank drops and the transformation can
never be reversed, which is why SVD is the reliable way to detect and
handle near-singular matrices in scientific computing.