SVD Calculator
Compute the Singular Value Decomposition of a matrix. Enter values for instant results with step-by-step formulas.
Reviewed for accuracy by Manoj Kumar, Mathematics Educator
SVD Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: A = U * Sigma * V^T
Worked example — Singular values: 5, 1 | Condition number: 5 | Rank: 2
Formula
A = U * Sigma * V^T
The matrix A is decomposed into the product of three matrices: U (left singular vectors), Sigma (diagonal matrix of singular values), and V^T (transpose of right singular vectors). Singular values are the square roots of the eigenvalues of A^T * A.
Worked Examples
Example 1: SVD of a 2x2 Symmetric Matrix
Problem:Compute the singular values of A = [[3,2],[2,3]].
Solution:A^T * A = [[13, 12],[12, 13]] Characteristic polynomial: lambda^2 - 26*lambda + 25 = 0 Eigenvalues: lambda_1 = 25, lambda_2 = 1 Singular values: s1 = sqrt(25) = 5, s2 = sqrt(1) = 1 Condition number: 5/1 = 5 Frobenius norm: sqrt(9+4+4+9) = sqrt(26) = 5.099
Result:Singular values: 5, 1 | Condition number: 5 | Rank: 2
Example 2: Rank-Deficient Matrix
Problem:Compute the singular values of A = [[1,2],[2,4]].
Solution:A^T * A = [[5, 10],[10, 20]] Characteristic polynomial: lambda^2 - 25*lambda + 0 = 0 Eigenvalues: lambda_1 = 25, lambda_2 = 0 Singular values: s1 = 5, s2 = 0 The matrix has rank 1 (row 2 = 2 * row 1)
Result:Singular values: 5, 0 | Condition number: Infinite | Rank: 1 (rank-deficient)
Frequently Asked Questions
What is Singular Value Decomposition and what does it do?
Singular Value Decomposition (SVD) factors any m-by-n matrix A into three matrices: A = U * Sigma * V^T, where U is an m-by-m orthogonal matrix, Sigma is an m-by-n diagonal matrix of singular values, and V^T is the transpose of an n-by-n orthogonal matrix. The singular values in Sigma are non-negative numbers arranged in decreasing order that represent the importance or strength of each corresponding dimension. SVD is arguably the most important matrix decomposition in applied mathematics because it works on any matrix regardless of shape or rank, unlike eigendecomposition which requires square matrices. It reveals the fundamental geometry of a linear transformation as a rotation, scaling, and another rotation.
How are singular values different from eigenvalues?
Singular values and eigenvalues are related but distinct concepts. Eigenvalues are defined only for square matrices and can be negative, zero, or complex numbers. Singular values are defined for any matrix (including rectangular) and are always non-negative real numbers. The singular values of a matrix A are the square roots of the eigenvalues of A^T*A (or equivalently A*A^T). For symmetric positive definite matrices, the singular values equal the eigenvalues. For general matrices, singular values provide a more robust measure of the matrix properties. While eigenvalues tell you about the spectral properties of a linear transformation on the same space, singular values describe how the transformation stretches space between potentially different input and output dimensions.
What is the condition number and why does it matter?
The condition number of a matrix is the ratio of its largest singular value to its smallest singular value. It measures how sensitive the solution of a linear system Ax = b is to perturbations in the data. A condition number close to 1 means the matrix is well-conditioned and the system can be solved accurately. A large condition number (thousands or millions) means the system is ill-conditioned and small errors in the input can cause large errors in the solution. When the smallest singular value is zero, the condition number is infinite, meaning the matrix is singular. As a rule of thumb, you lose about log10(condition number) digits of accuracy when solving a linear system, so a condition number of 1000 means you lose about 3 significant digits.
How is SVD used for image compression?
SVD enables image compression by approximating the original image matrix with a low-rank version that uses far less storage. A grayscale image is an m-by-n matrix of pixel values. Computing its SVD gives singular values in decreasing order of importance. By keeping only the k largest singular values and their corresponding columns of U and V (called a rank-k approximation), you create a compressed version of the image that captures the most important visual features. Instead of storing m*n pixel values, you store k*(m+n+1) values. For a 1000-by-1000 image, keeping just 50 singular values reduces storage by 90% while maintaining recognizable image quality. The Eckart-Young theorem guarantees this is the optimal rank-k approximation.
What is the relationship between SVD and the pseudoinverse?
SVD provides a direct way to compute the Moore-Penrose pseudoinverse of any matrix, which generalizes the matrix inverse to non-square and singular matrices. Given A = U * Sigma * V^T, the pseudoinverse is A+ = V * Sigma+ * U^T, where Sigma+ is formed by taking the reciprocal of each nonzero singular value and transposing the matrix. The pseudoinverse gives the least-squares solution to overdetermined systems (more equations than unknowns) and the minimum-norm solution to underdetermined systems (fewer equations than unknowns). This makes SVD the foundation of least-squares fitting, which is used extensively in statistics, machine learning, signal processing, and any field that requires fitting models to data.
How does SVD relate to Principal Component Analysis?
Principal Component Analysis (PCA) is essentially SVD applied to centered data. When you have a data matrix X where each row is a data point and each column is a feature, PCA finds the directions of maximum variance. Computing the SVD of the centered data matrix X = U * Sigma * V^T reveals that the columns of V are the principal components (directions of maximum variance), the singular values in Sigma are proportional to the standard deviations along each component, and the matrix U * Sigma gives the coordinates of each data point in the principal component basis. This connection is why SVD is the preferred computational method for PCA, as it is more numerically stable than computing eigenvalues of the covariance matrix directly.
What matrix norms can be computed from singular values?
Several important matrix norms are directly related to singular values. The spectral norm (also called the 2-norm or operator norm) equals the largest singular value and represents the maximum stretching factor of the matrix. The Frobenius norm equals the square root of the sum of squared singular values and represents the total energy in the matrix. The nuclear norm (also called trace norm) equals the sum of all singular values and is used in matrix completion and low-rank optimization problems. The rank of a matrix equals the number of nonzero singular values. These relationships make SVD a universal tool for matrix analysis, since computing the SVD once gives you access to all these important quantities.
What is the Eckart-Young theorem?
The Eckart-Young theorem states that the best rank-k approximation to a matrix (in either the spectral norm or Frobenius norm) is obtained by keeping the k largest singular values and zeroing out the rest. Specifically, if A = U * Sigma * V^T and A_k is formed by keeping only the first k singular values, then A_k minimizes the distance to A among all rank-k matrices. The error of this approximation equals the (k+1)th singular value in the spectral norm, or the square root of the sum of squared remaining singular values in the Frobenius norm. This theorem is the theoretical foundation for SVD-based compression, dimensionality reduction, and denoising, guaranteeing that no other method can do better.
How is SVD used in recommendation systems?
Recommendation systems like those used by Netflix and Amazon use SVD to discover latent factors in user-item interaction data. The user-rating matrix (with users as rows and items as columns) is approximately factored using truncated SVD into low-rank matrices that capture hidden patterns. The singular values represent the importance of each latent factor, while the U and V matrices encode how users and items relate to these factors. Missing ratings can then be predicted by multiplying the low-rank factors. In practice, modified versions like regularized SVD or matrix factorization with stochastic gradient descent are used because the rating matrix is very sparse. The Netflix Prize competition famously demonstrated that SVD-based approaches could improve recommendation accuracy by over 10 percent.
What are the computational costs and algorithms for SVD?
Computing the full SVD of an m-by-n matrix costs approximately O(min(mn^2, m^2n)) floating-point operations, making it about 3-5 times more expensive than LU decomposition. The most widely used algorithm is the Golub-Kahan bidiagonalization followed by implicit QR iteration, which is implemented in LAPACK and used by MATLAB, NumPy, and R. For very large matrices where only the top k singular values are needed, iterative methods like the Lanczos algorithm or randomized SVD provide much faster approximate results. Randomized SVD, introduced by Halko, Martinsson, and Tropp, can compute a rank-k approximation in O(mn*log(k)) time, making SVD practical for matrices with millions of rows and columns.
References
Reviewed for accuracy by Manoj Kumar, Mathematics Educator · Editorial policy
Related Calculators
🧮Annulus Area Calculator
Calculate annulus area with inputs, formulas, and instant results.
🧮Area Calculator
Calculate area with inputs, formulas, and instant results.
🧮Area of a Rectangle Calculator
Calculate the area, perimeter, and diagonal of a rectangle. Find missing sides from known area. Convert between metric and imperial area units.
🧮Area of Crescent Calculator
Calculate area of crescent with inputs, formulas, and instant results.
🧮Center of Mass Calculator
Calculate center of mass with inputs, formulas, and instant results.
🧮Centroid Calculator
Calculate centroid with inputs, formulas, and instant results.
🧮Chord Length Calculator
Calculate chord length with inputs, formulas, and instant results.
🧮Conic Sections Calculator
Calculate conic sections with inputs, formulas, and instant results.