SVD Calculator
The singular value decomposition of matrices will never cause you any problems again — with the help of our SVD calculator, you will quickly master this important topic in linear algebra. Scroll down and learn:
-
What is the singular value decomposition?
-
How do I find the SVD of a matrix using our SVD calculator?
-
How to calculate the SVD of a matrix by hand?
-
Is the singular value decomposition unique?
Ready? Let's go!
What is the singular value decomposition?
Singular value decomposition (SVD) is a way of factorizing a matrix: any real matrix of size decomposes as
where and are orthogonal matrices of sizes and respectively, and is a rectangular matrix of the same size as (so ) which has non-negative numbers on its diagonal and zeroes everywhere else. The diagonal elements of are in fact the singular values of .
🙋 If is complex, replace the transposition (we also have matrix transpose calculator to help you with that) with the complex conjugation . and then become unitary matrices, but still features real non-negative numbers on its diagonal.
Here's a visualization of singular value decomposition of a matrix .
Once we know what the singular value decomposition of a matrix is, it'd be beneficial to see some examples. Calculating SVD by hand is a time-consuming procedure, as we will see in the section on How to calculate SVD of a matrix. We bet the quickest way to generate examples of SVD is to use Omni's singular value decomposition calculator!
How to use this SVD calculator?
Working with this SVD calculator is simple!
- Pick the matrix size: the number of rows and the number of columns in .
- Enter the matrix entries in their dedicated fields.
- The components of singular value decomposition , and will appear at the bottom of the calculator.
Do you want to verify the results? Just perform the matrix multiplication of the result's three matrices and compare that outcome with your initial matrix. Remember that numerical computations and rounding may cause tiny discrepancies!
Do you want to understand how the SVD calculator got its results? In the next section, we will discuss all the theory that stands behind the singular value decomposition and explain step-by-step how to find the SVD of a matrix. Ready?
How to calculate SVD of a matrix?
Here's how to calculate the singular value decomposition of a matrix by hand. We will see that SVD is closely related to the eigenvalues and eigenvectors of .
As we remember, we can easily find the eigenvalues and eigenvectors for square matrices, yet can be rectangular in SVD. What can we do? Let's consider two square matrices that are closely related to : these matrices are and :
- The columns of are eigenvectors of .
- The non-zero elements of are the non-zero singular values of , i.e., they are the square roots of the non-zero eigenvalues of .
- Once we know and , we can recover from the SVD formula ().
In more details, to find SVD by hand:
-
Compute .
-
Compute the eigenvalues and eigenvectors of .
-
Draw a matrix of the same size as and fill in its diagonal entries with the square roots of the eigenvalues you found in Step 2. This is .
-
Write down the matrix whose columns are the eigenvectors you found in Step 2. This is .
-
The SVD equation transforms to . We can rewrite this in terms of columns as . This tells us how to compute , as the columns of set for every such that .
-
If needs more columns to fill its size, you can pick arbitrary vectors, but you have to make sure that is an orthogonal matrix. Therefore, you must pick vectors that have unit length and are orthogonal to all the columns in (and the ones you're adding).
Is singular value decomposition unique?
No, the SVD is not unique. Even if we agree to have the diagonal elements of Σ
in descending order (which makes Σ
unique), the matrices U
and V
are still non-unique.
FAQ
What does SVD do to a matrix?
SVD decomposes an arbitrary rectangular matrix A
into the product of three matrices UΣVᵀ
, which is subject to some constraints. These U
and V
are orthogonal matrices. Σ
has the same size as A
and contains the singular values of A
as its diagonal entries.
What is SVD of a symmetric matrix?
If A
is real symmetric, then its singular values (the diagonal elements of Σ
) coincide with the absolute values of its eigenvalues. The columns of U
and V
are the unit eigenvectors of A
. In particular, if the eigenvalues of A
are all strictly positive (i.e. A
is positive definite), then U = V
and the SVD of A
coincides with the eigendecomposition of A
.
What is SVD of a unitary matrix?
For unitary matrices, SVD is trivial. Namely, if A
is unitary (i.e., AA = AA* = I
), then all of the singular values of A
are equal to 1
. Hence, in SVD we have U = A
, Σ = I
, and V = I
.
A | = |
|