Singular Values Calculator
Enter the entries of your 2x2 or 3x3 matrix and this tool computes its singular values via Singular Value Decomposition (SVD). You get the full factorization A = U Sigma V-transpose with all three factor matrices displayed, plus the matrix rank, condition number, spectral norm, Frobenius norm, and nuclear norm. A step-by-step panel shows the underlying eigenvalue computation of A-transpose A so you can follow every stage of the algorithm.
Formula
Worked example
For A = [[3, 2], [2, 3]]: A^T A = [[13, 12], [12, 13]]. Eigenvalues: (13+12) = 25 and (13-12) = 1. Singular values: sigma-1 = sqrt(25) = 5, sigma-2 = sqrt(1) = 1. Condition number = 5/1 = 5. Frobenius norm = sqrt(25+1) = sqrt(26) approx 5.099.
What are singular values?
Every real matrix A, regardless of whether it is square or rectangular or symmetric, can be factored as A = U Sigma V-transpose, where U and V are orthogonal matrices and Sigma is a diagonal matrix. The non-negative diagonal entries of Sigma are the singular values, usually written sigma-1, sigma-2, and so on, arranged in descending order. Geometrically, any matrix A transforms the unit sphere into an ellipsoid, and the singular values are the lengths of the semi-axes of that ellipsoid. The largest singular value (sigma-1) tells you the maximum stretch factor, and the smallest tells you the minimum, which is why their ratio is the condition number. Unlike eigenvalues, singular values are always real and non-negative and exist for every matrix, including non-square and non-symmetric ones.
How singular values are calculated (the A-transpose A method)
For a real matrix A, the product A-transpose times A is always square, symmetric, and positive-semidefinite. Its eigenvalues are all real and non-negative, and their square roots are precisely the singular values of A. This calculator forms A-transpose A, computes its eigenvalues analytically via the quadratic formula (for 2x2 matrices) or Cardano's trigonometric method (for 3x3 matrices), takes the square roots to get sigma-i, and then finds the right singular vectors V as eigenvectors of A-transpose A. The left singular vectors U follow from u_i = A v_i divided by sigma_i for each non-zero sigma_i. The three matrices U, Sigma, and V-transpose together make up the complete SVD: A = U Sigma V-transpose.
The condition number and numerical stability
The condition number kappa is the ratio of the largest to the smallest singular value. It quantifies how sensitive the solution of a linear system A x = b is to small changes in b or A. If kappa is around 100, solving the system may lose about 2 significant digits of precision. If kappa is around 1e8, you may lose 8 digits, which is catastrophic for double-precision arithmetic. A well-conditioned matrix (kappa below 10) gives stable, reliable results. A rank-deficient matrix has kappa equal to infinity because one or more singular values are zero, which means the standard inverse does not exist. In that case the Moore-Penrose pseudoinverse, built from only the non-zero singular values, provides the minimum-norm least-squares solution.
Applications of SVD and singular values
Singular Value Decomposition is one of the most widely used tools in applied mathematics and data science. In image compression, the SVD of an image matrix allows you to keep only the largest singular values and their corresponding vectors, discarding the small ones and reducing storage while preserving most visual information. In principal component analysis (PCA), the left singular vectors of the data matrix are the principal directions. In natural language processing, latent semantic analysis uses SVD to find hidden relationships between words and documents. In recommender systems (such as movie rating predictions), SVD-based matrix factorization reveals latent user and item factors. In control theory, the smallest singular value measures robustness to uncertainty. In statistics, the Frobenius norm and nuclear norm (sum of singular values) are used as convex relaxations of rank in regularised optimisation.
Singular values and matrix properties
| Singular value pattern | Property | Interpretation |
|---|---|---|
| All sigma_i > 0 | Full rank | Matrix is invertible; has a unique solution for every right-hand side |
| One or more sigma_i = 0 | Rank-deficient | Matrix is singular; system A x = b may have no solution or infinitely many |
| sigma_1 >> sigma_2 (large gap) | Near rank-1 | Matrix is well-approximated by a rank-1 outer product: u1 sigma1 v1-transpose |
| kappa = sigma_1 / sigma_min < 10 | Well-conditioned | Linear systems are numerically stable; small input errors cause small output errors |
| kappa between 10 and 1e6 | Moderately ill-conditioned | Some loss of significant digits in computed solutions is expected |
| kappa > 1e8 | Ill-conditioned | Solution highly sensitive to perturbations; results may be dominated by rounding error |
| All sigma_i equal | Scaled isometry | Matrix scales all vectors by the same factor (e.g. rotation times a scalar) |
| All sigma_i = 1 | Orthogonal matrix | Matrix preserves lengths and angles; its inverse equals its transpose |
Common interpretations of singular value patterns for real square matrices.
Frequently asked questions
What is the difference between singular values and eigenvalues?
Eigenvalues exist only for square matrices and can be complex numbers, including negative values. Singular values exist for any matrix (square or rectangular) and are always real and non-negative. For a symmetric positive-definite square matrix, the singular values equal the eigenvalues, but for a general matrix they are different. The singular values measure how much A stretches different directions, while eigenvalues describe the scaling of specific special vectors (eigenvectors) that A maps back onto themselves.
Can this calculator handle rectangular matrices?
The current calculator is designed for square matrices (2x2 or 3x3), because the A-transpose A approach works cleanly and the three factor matrices are all square in that case. For general m x n rectangular matrices the same SVD formula applies, but computing it efficiently requires algorithms like the bidiagonalisation-QR method, which involve many more steps.
Why is the condition number important?
The condition number kappa tells you how much the output of A x = b can change relative to a small change in b. If kappa = 1000 and b has a relative error of 0.01% (from measurement noise, for example), then x may have a relative error of up to 10%. Matrices with kappa larger than 1e8 are considered practically singular for double-precision computation because floating-point rounding errors alone can corrupt the solution. When you see a large condition number, consider regularisation techniques such as Tikhonov regularisation or a truncated SVD.
What does it mean when one singular value is zero?
A zero singular value means the matrix is rank-deficient: it collapses at least one direction in the input space to zero length. Equivalently, the matrix is singular (non-invertible), and the standard solution A-inverse b does not exist. In practice, "zero" is determined by the numerical threshold sigma < 1e-9 times the largest singular value, because floating-point arithmetic rarely produces an exact zero.
What are the Frobenius norm and nuclear norm used for?
The Frobenius norm is the square root of the sum of squares of all entries of A, which by the SVD equals the square root of the sum of squared singular values. It is the matrix analog of the Euclidean vector length and measures the overall magnitude of A. The nuclear norm is the sum of all singular values and is the smallest convex function that upper-bounds the rank of a matrix. This makes it popular in machine learning as a regulariser for low-rank matrix recovery problems such as collaborative filtering.
How does SVD relate to low-rank matrix approximation?
The Eckart-Young theorem states that the best rank-k approximation to a matrix A, in terms of both the Frobenius and spectral norms, is obtained by keeping only the k largest singular values and their associated left and right singular vectors. If A = U Sigma V-transpose, the rank-k approximation is the sum of sigma-i u_i v_i-transpose for i from 1 to k. This is the mathematical foundation of image compression, PCA, and many recommender systems.