Understanding the singular values calculator — concept and principle
This calculator finds the singular values of any matrix, square or rectangular, listed from largest to smallest. It also gives the 2-norm, the smallest singular value, the rank, the condition number and the sum of squares (the squared Frobenius norm). Use it in linear algebra, numerical analysis, data science (PCA, low-rank approximation) and control engineering.
How it is calculated
- The singular values σ₁ ≥ σ₂ ≥ … ≥ σ_k ≥ 0, with k = min(m, n), are the square roots of the eigenvalues of AᵀA (or of AAᵀ).
- ‖A‖₂ = σ₁, the largest stretch.
- Rank = number of non-zero singular values.
- Condition number = σ₁ ÷ σ_k for a square or full-rank matrix.
- Σσᵢ² = ‖A‖F² = sum of the squares of all entries.
The values are computed with a one-sided Jacobi SVD, accurate to about 15 significant digits.
The principle
Every matrix maps the unit sphere to an ellipsoid. The singular values are the lengths of that ellipsoid's semi-axes: how much A stretches space along its principal directions. Unlike eigenvalues, they exist for every matrix, are always real and never negative, because AᵀA is symmetric and positive semidefinite. The largest one is the most any unit vector can be stretched, and a zero singular value means some direction is flattened completely, which lowers the rank. A large ratio between largest and smallest means the matrix is nearly singular and solving with it amplifies errors.
Worked example
Default: A = [3 2 2; 2 3 −2] (2 × 3).
- AAᵀ = [17 8; 8 17] (the smaller product, 2 × 2).
- Its eigenvalues solve (17 − λ)² = 64, so λ = 25 and 9.
- Singular values: √25 = 5 and √9 = 3, so 5, 3.
- ‖A‖₂ = 5; smallest σ = 3; rank 2; condition number 5 ÷ 3 ≈ 1.66667.
- Check: 5² + 3² = 34 = 9 + 4 + 4 + 4 + 9 + 4, the sum of squared entries.
How to read the result
A condition number near 1 means the matrix is well behaved; values in the thousands or more warn that small input errors can grow a lot in solutions. Zero singular values (or ones that are tiny compared with σ₁) reveal rank deficiency. In data analysis, the squared singular values show how much of the total variation each direction captures.
Common mistakes
- Confusing singular values with eigenvalues; they agree only (in absolute value) for symmetric matrices.
- Expecting negative singular values; they are never negative.
- Reading a tiny value such as 1e−16 as non-zero; it is rounding noise.
- Using the condition number of a rank-deficient matrix, which is infinite.
Frequently asked questions
What is the difference between singular values and eigenvalues?
Eigenvalues are defined only for square matrices and can be negative or complex; singular values exist for every matrix and are non-negative.
How are singular values used in PCA?
After centring the data matrix, its singular values give the spread along each principal component.
What does the condition number tell me?
Roughly how many times relative errors in the input can be magnified in the solution of Ax = b.
Sources: Wolfram MathWorld, "Singular Value" · J. Demmel, UC Berkeley Math 221, Lecture 3 (Fall 2011)