Singular Value Decomposition Calculator

Compute singular values, U, Sigma, V, rank, and low-rank approximations for a numeric matrix.

Results are calculated automatically as you enter data.

Edit the matrix, paste data, or change dimensions up to 8 x 8.

Rows
2
Columns
3

Enter a matrix to compute its decomposition.

Numeric decomposition
Singular values-

▼ See explanations and tips below ▼

What Is Singular Value Decomposition?

Singular value decomposition, usually shortened to SVD, is a way to break a real matrix into simpler parts. It rewrites a matrix as a product of three matrices:

$$ A = U\Sigma V^T $$

In this factorization, \(A\) is the original matrix, \(U\) and \(V\) describe orthogonal directions, and \(\Sigma\) contains nonnegative numbers called singular values. Those singular values are usually listed from largest to smallest.

A helpful way to think about SVD is this: a matrix transformation can rotate or reflect input directions, stretch or shrink them by certain amounts, and then rotate or reflect the result again. The singular values are the stretching factors. A large singular value means the matrix has a strong effect in that direction. A zero or very small singular value means that direction contributes little or may be lost by the transformation.

SVD is useful because it works for many matrices that ordinary eigenvalue decomposition does not handle well. The matrix does not need to be square, symmetric, or invertible. This makes SVD one of the most important tools in linear algebra, numerical computing, data analysis, image compression, principal component analysis, and low-rank approximation.


Why Singular Value Decomposition Matters

SVD is valuable because it organizes the information in a matrix by importance. The first singular value and its singular vectors describe the strongest rank-one pattern in the matrix. The next singular value describes the strongest remaining pattern, and so on.

This ordering makes SVD useful for questions such as:

  • Which directions does a matrix stretch the most?
  • What is the numerical rank of a matrix?
  • How much of the matrix is explained by the largest singular values?
  • Can the matrix be approximated using fewer dimensions?
  • How much error is introduced when only the first \(k\) singular values are kept?

For students, SVD connects matrix multiplication, orthogonality, eigenvalues, rank, and approximation. For data science and engineering learners, it explains why a high-dimensional matrix can sometimes be represented accurately by a much smaller number of components.


Key Terms to Know

  • Matrix: A rectangular array of numbers. In this calculator, entries are real, finite, unitless numbers.
  • Orthogonal matrix: A square matrix whose columns are mutually perpendicular unit vectors. For an orthogonal matrix \(Q\), \(Q^TQ = I\).
  • Singular value: A nonnegative scaling factor in the SVD. Singular values are usually written as \(\sigma_1, \sigma_2, \ldots\) and sorted so that \(\sigma_1 \ge \sigma_2 \ge \cdots \ge 0\).
  • Left singular vectors: The columns of \(U\). They describe important directions in the output space.
  • Right singular vectors: The columns of \(V\). They describe important directions in the input space.
  • Sigma matrix: The diagonal rectangular matrix \(\Sigma\) that stores the singular values on its diagonal.
  • Rank: The number of independent directions in a matrix. In SVD terms, exact rank is the number of nonzero singular values.
  • Numerical rank: A rank estimate based on a small threshold rather than exact symbolic zero.
  • Low-rank approximation: A simpler matrix that keeps only the first \(k\) singular directions.
  • Energy contribution: A percentage based on squared singular values. It measures how much of the total squared singular-value magnitude is captured by one singular value or by the first \(k\) singular values.

How Singular Value Decomposition Works

For a real \(m \times n\) matrix \(A\), the singular value decomposition has the form:

$$ A = U\Sigma V^T $$

where:

  • \(U\) is an \(m \times m\) orthogonal matrix.
  • \(\Sigma\) is an \(m \times n\) diagonal rectangular matrix.
  • \(V\) is an \(n \times n\) orthogonal matrix.
  • \(V^T\) is the transpose of \(V\).
  • The diagonal entries of \(\Sigma\) are the singular values \(\sigma_1,\sigma_2,\ldots\).

The singular values can be found from the symmetric matrix \(A^TA\). If \(\lambda_i(A^TA)\) is an eigenvalue of \(A^TA\), then the corresponding singular value is:

$$ \sigma_i = \sqrt{\lambda_i(A^TA)} $$

For each nonzero singular value, the corresponding left singular vector can be found from the right singular vector:

$$ u_i = \frac{Av_i}{\sigma_i} $$

This is why SVD is closely related to eigenvalues and eigenvectors, but it is more flexible. The matrix \(A^TA\) is always square and symmetric, even when \(A\) itself is rectangular.

SVD can also be written as a sum of rank-one pieces:

$$ A = \sigma_1u_1v_1^T + \sigma_2u_2v_2^T + \cdots + \sigma_ru_rv_r^T $$

where \(r\) is the rank of \(A\). This form shows why singular values are useful for approximation. Keeping the first \(k\) terms gives a rank-\(k\) approximation:

$$ A_k = \sum_{i=1}^{k}\sigma_i u_i v_i^T $$

The first \(k\) terms preserve the largest singular-value patterns. The mathematical result behind this best-approximation idea, under common matrix-error measures such as the Frobenius norm, is commonly known as the Eckart-Young theorem.

Energy from Singular Values

A common way to summarize how much structure is captured by the first \(k\) singular values is to use squared singular values:

$$ \text{Energy kept by rank }k = \frac{\sum_{i=1}^{k}\sigma_i^2}{\sum_{i=1}^{r}\sigma_i^2} \times 100\% $$

This is why the largest singular values often dominate the energy table. A singular value that is twice as large contributes four times as much squared energy.


Examples of Singular Value Decomposition in Practice

Example 1: A Simple Diagonal Matrix

Consider the matrix:

$$ A = \begin{bmatrix} 4 & 0 \\ 0 & 1 \end{bmatrix} $$

This matrix already stretches the first coordinate by \(4\) and the second coordinate by \(1\). Its singular values are:

$$ \sigma_1 = 4,\quad \sigma_2 = 1 $$

The squared singular values are:

$$ 4^2 = 16,\quad 1^2 = 1 $$

So the first singular value accounts for:

$$ \frac{16}{16+1}\times 100\% \approx 94.12\% $$

The second singular value accounts for:

$$ \frac{1}{16+1}\times 100\% \approx 5.88\% $$

This simple example shows why energy percentages can be dominated by the largest singular value.


Example 2: A Rank-Deficient Matrix

Now consider:

$$ A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 3 & 6 & 9 \end{bmatrix} $$

Each row is a multiple of the first row, so the matrix has only one independent row direction. It is a rank-one matrix. In fact, it can be written as:

$$ A = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} \begin{bmatrix} 1 & 2 & 3 \end{bmatrix} $$

Its only positive singular value is:

$$ \sigma_1 = 1^2 + 2^2 + 3^2 = 14 $$

All remaining singular values are zero. A rank-\(1\) approximation reconstructs this matrix exactly because the matrix already has rank \(1\).


Example 3: Low-Rank Approximation

Suppose a matrix has singular values:

$$ 10,\quad 3,\quad 1 $$

The total squared singular-value energy is:

$$ 10^2 + 3^2 + 1^2 = 100 + 9 + 1 = 110 $$

A rank-\(1\) approximation keeps only the first singular value:

$$ \frac{10^2}{110}\times 100\% \approx 90.91\% $$

A rank-\(2\) approximation keeps the first two singular values:

$$ \frac{10^2 + 3^2}{110}\times 100\% \approx 99.09\% $$

In this case, rank \(2\) keeps nearly all of the squared singular-value energy, while rank \(1\) may still miss visible structure.


How to Interpret the Result

The singular values are the most important part of the result. They tell you how strongly the matrix scales different orthogonal directions.

A large singular value means the matrix has a strong effect in that direction. A small singular value means that direction has little effect. A zero or near-zero singular value indicates a direction that is collapsed or numerically negligible.

The numerical rank is based on how many singular values exceed a scale-relative tolerance proportional to \(\sigma_1\max(m,n)\epsilon\), where \(\epsilon\) is floating-point machine precision. This makes the classification invariant under safe nonzero rescaling, but it remains a numerical estimate rather than a symbolic proof of exact rank.

The energy contribution table shows each singular value’s share of total squared singular-value energy. If the first few rows account for most of the energy, a low-rank approximation may preserve much of the matrix’s main structure.

The rank-\(k\) approximation uses only the first \(k\) singular directions. Its quality depends on how quickly the singular values drop. If the singular values fall sharply, a small \(k\) may work well. If they decline slowly, a small \(k\) may lose important information.

The relative reconstruction error compares the Frobenius norm of the reconstruction residual with the Frobenius norm of the original matrix. The calculator also verifies that \(U\) and \(V\) are orthogonal before reporting success.

The relative low-rank error compares the original matrix with the selected rank-\(k\) approximation. This error should generally decrease as \(k\) increases, because more singular directions are included.

The displayed \(U\), \(\Sigma\), and \(V\) matrices correspond to the formula:

$$ A = U\Sigma V^T $$

The calculator displays \(V\), while the formula uses \(V^T\) during reconstruction.

The conceptual graph uses the first two singular values to sketch how unit directions are transformed. It is a helpful two-dimensional picture, not a full visualization of every dimension in a larger matrix.


Common Mistakes and Misconceptions

Leaving a blank cell and expecting the placeholder to count as zero. A placeholder is only a visual hint. To use zero, enter 0 as the actual matrix value.

Pasting rows with different lengths. A matrix must have the same number of entries in every row. An import such as one row with three numbers and another row with two numbers is not a valid rectangular matrix.

Entering fractions, complex numbers, or expressions. The calculator accepts real decimal numbers and scientific notation such as 1e-3. It does not parse fraction strings, complex values, variables, or algebraic expressions.

Confusing \(\Sigma\) with an ordinary dense matrix. In SVD, \(\Sigma\) is diagonal or rectangular diagonal. Its nonzero entries appear only on the diagonal.

Assuming rank is always exact. Numerical software needs a threshold for tiny values. A singular value very close to zero may be treated as zero for rank purposes.

Assuming a larger requested rank will always be kept. The selected approximation rank is clamped to the valid range. It cannot exceed the matrix’s effective rank or the maximum possible rank when the numeric rank is nonzero.

Rounding too early. Rounded display values are easier to read, but they can hide small numerical differences. Use more decimal places when you need to inspect near-zero values.

Treating the conceptual graph as a complete plot. The graph is based on the first two singular values. It does not show every singular direction in a matrix with more dimensions.

Confusing full reconstruction error with low-rank error. Full reconstruction error checks whether the SVD factors reproduce the original matrix. Low-rank error checks how much information is lost after keeping only the selected rank.


When to Use Singular Value Decomposition

Use SVD when you want to:

  • Break a matrix into interpretable orthogonal directions and scaling factors.
  • Study the rank or numerical rank of a matrix.
  • Understand which directions dominate a matrix transformation.
  • Build a low-rank approximation.
  • Estimate how much structure is preserved by the first \(k\) singular values.
  • Explore the connection between matrix factorization and principal component analysis.
  • Compare full reconstruction with a reduced approximation.
  • Investigate rectangular, rank-deficient, or nearly rank-deficient matrices.

SVD is especially useful when a matrix is not square or when ordinary eigenvalue methods do not directly apply.


Limitations and Things to Keep in Mind

This calculator works with real, finite numeric matrices. It does not parse complex numbers, symbolic variables, algebraic expressions, or fraction strings.

Matrices are limited to \(1\) through \(8\) rows and \(1\) through \(8\) columns. This keeps the display responsive and readable, but it means the tool is intended for learning, checking small examples, and exploring concepts rather than processing large datasets.

The calculation is numerical, not symbolic. The matrix is normalized before a one-sided Jacobi SVD is computed, which avoids forming \(A^TA\) and improves behavior for very large, very small, and ill-conditioned inputs. Results that do not pass convergence, reconstruction, and orthogonality checks are rejected instead of displayed as successful.

Displayed decimal precision can be set from \(2\) to \(10\) decimal places. If the precision field is blank or invalid, the display uses a default precision of \(5\) decimal places. Very large or very small displayed values may use exponential notation.

The full relative reconstruction error should be close to zero but may not be exactly zero. The low-rank approximation error is expected to be larger unless the selected rank captures the full numerical rank.

The rank selector permits rank \(0\) for an all-zero matrix and is otherwise kept between \(0\) and the reported numerical rank.

If all singular values are zero, the matrix has no nonzero squared singular-value energy. In that case, energy percentages are a display convention rather than evidence that one direction explains meaningful structure.

The implementation normalizes the matrix and uses pair-scaled one-sided Jacobi rotations rather than forming \(A^TA\). Inputs and results must still be finite binary64 numbers; an extreme condition range can exceed the available precision or make a reconstructed value unrepresentable. If a calculation is rejected, rescale the matrix or use specialized numerical software.

For engineering, scientific, financial, or safety-related work, treat the results as a computational aid. Double-check important calculations with appropriate software, documentation, and professional judgment.


How to Use This Calculator

  1. Enter finite real numbers in the matrix grid. To use zero, type 0 in the cell.
  2. Use the row and column controls to resize the matrix between \(1 \times 1\) and \(8 \times 8\).
  3. To import a matrix, paste rows separated by newlines. Values may be separated by spaces, commas, semicolons, or tabs.
  4. Use decimal or scientific notation for entries, such as 2.5, -4, or 1e-3.
  5. Choose the low-rank approximation rank. The calculator will keep the value within the valid range.
  6. Choose the displayed decimal precision from \(2\) to \(10\) decimal places.
  7. Run the calculation and review the singular values, rank, energy table, reconstruction errors, \(U\), \(\Sigma\), \(V\), and rank-\(k\) approximation.
  8. Use the graph download option when a conceptual graph is available.

Frequently Asked Questions

Is SVD only for square matrices?

No. One of the main advantages of SVD is that it works for rectangular matrices as well as square matrices. For a real \(m \times n\) matrix, \(\Sigma\) has the same rectangular shape as the original matrix.


What do singular values mean?

Singular values are nonnegative scaling factors. They describe how much the matrix stretches or preserves information along special orthogonal directions. Larger singular values represent stronger directions in the matrix.


How are singular values related to eigenvalues?

For a real matrix \(A\), the singular values are the square roots of the eigenvalues of \(A^TA\):

$$ \sigma_i = \sqrt{\lambda_i(A^TA)} $$

This relationship is useful because \(A^TA\) is symmetric and square, even when \(A\) is rectangular.


Why does the energy table use squared singular values?

Energy is based on \(\sigma_i^2\) because squared singular values measure squared magnitude contributions. This is why one large singular value can dominate the total energy. For example, a singular value of \(10\) contributes \(100\) squared units, while a singular value of \(1\) contributes only \(1\).


What is the difference between rank and selected rank?

The rank describes how many singular values are treated as nonzero. The selected rank \(k\) is the number of leading singular directions used for the low-rank approximation. The selected rank may be clamped so it stays within a valid range for the matrix.


Why is my reconstruction error not exactly zero?

The calculation is numerical, so tiny roundoff differences can occur. If the matrix is well scaled, the full reconstruction error should usually be very small. Display rounding can also make small values appear as zero or hide tiny differences.


Can I use this calculator for complex matrices?

No. This calculator accepts real finite numbers only. Complex-valued SVD is an important general topic, but complex entries are not supported here.


Sources and References

Books and Open Textbooks

  1. Sheldon Axler. Linear Algebra Done Right. 4th ed., Springer, 2024. Sections 7E–7F, singular value decomposition and consequences of SVD. Open textbook PDF.
  2. David Austin. Understanding Linear Algebra. Runestone Academy. Sections 7.4–7.5, singular value decompositions and using singular value decompositions. Singular Value Decompositions and Using Singular Value Decompositions. Accessed July 4, 2026.
  3. Lloyd N. Trefethen and David Bau III. Numerical Linear Algebra. SIAM, 1997. Lectures 4–5, the singular value decomposition and more on the SVD. SIAM book page.

Online and Official Sources

  1. MIT OpenCourseWare. “Singular Value Decomposition.” 18.06SC Linear Algebra, Fall 2011. MIT OCW course page. Accessed July 4, 2026.
  2. Eric W. Weisstein. “Singular Value Decomposition.” MathWorld—A Wolfram Resource. MathWorld page. Accessed July 4, 2026.
  3. Abner J. Salgado and Steven M. Wise. “The Singular Value Decomposition.” Chapter 2 in Classical Numerical Analysis: A Comprehensive Course. Cambridge University Press, 2022. Cambridge Core chapter page. Accessed July 4, 2026.