ZestCalc

SVD Calculator

Break any matrix into a turn, a stretch along the axes, and another turn. The singular values show how much it stretches, and how close it comes to losing a dimension.

Matrix

Enter any matrix up to 6×6, or start from an example.

Up to 6 rows and 6 columns.

Use integers, decimals, or fractions such as 1/3. Paste rows from a spreadsheet or a Python list into any cell.

Input

A=[3045]A = \begin{bmatrix} 3 & 0 \\ 4 & 5 \end{bmatrix}

Singular value decomposition

Updates as you type.

σ1≈6.708204,σ2≈2.236068\sigma_{1} \approx 6.708204,\quad \sigma_{2} \approx 2.236068
A=UΣVTA = U \Sigma V^{T}
U≈[0.3162280.9486830.948683−0.316228]U \approx \begin{bmatrix} 0.316228 & 0.948683 \\ 0.948683 & -0.316228 \end{bmatrix}
Σ≈[6.708204002.236068]\Sigma \approx \begin{bmatrix} 6.708204 & 0 \\ 0 & 2.236068 \end{bmatrix}
VT≈[0.7071070.7071070.707107−0.707107]V^{T} \approx \begin{bmatrix} 0.707107 & 0.707107 \\ 0.707107 & -0.707107 \end{bmatrix}

An SVD generally has no exact form, so these values are found numerically and rounded to 6 places. Rebuilding A from them is accurate to about 15 decimal places.

Rank 2, the number of nonzero singular values. This count comes from exact arithmetic.

Condition number 3: the largest stretch divided by the smallest.

The route through AᵀA

ATA=[25202025]A^{T}A = \begin{bmatrix} 25 & 20 \\ 20 & 25 \end{bmatrix}

ATAA^{T}A is symmetric, with exact entries. Its eigenvalues are real and at least 0, and its eigenvectors can be chosen perpendicular.

Step 0 of 4

What the SVD says

Every matrix, of any shape, can be written as three factors:

A=UΣVTA = U \Sigma V^{T}

UU and VV have perpendicular unit columns, so they only turn or flip. Σ\Sigma is diagonal, with the singular values σ1≥σ2≥⋯≥0\sigma_1 \ge \sigma_2 \ge \cdots \ge 0. So any matrix turns the space, stretches along the axes, and turns again. A unit circle always lands on an ellipse, and its semi-axes are the singular values.

Unlike the Matrix Diagonalization Calculator, this always works, even for rectangular and defective matrices.

How it relates to eigenvalues

Multiplying AA by its transpose cancels UU:

ATA=VΣTΣVTA^{T}A = V \Sigma^{T} \Sigma V^{T}

That's a diagonalization of a symmetric matrix. So the singular values are the square roots of the eigenvalues of ATAA^{T}A, which you can find with the Eigenvalue and Eigenvector Calculator, and VV holds its eigenvectors. Each column of UU then follows from ui=Avi/σiu_i = A v_i / \sigma_i.

Software rarely computes it this way, because squaring the entries loses accuracy on small singular values. This calculator uses one-sided Jacobi rotations, and it shows the route through ATAA^{T}A because that's the one to learn.

What singular values tell you

The number of nonzero singular values is the Matrix Rank Calculator. The condition number σ1/σn\sigma_1 / \sigma_n measures how close a square matrix is to losing a dimension. A large value means small changes in the input can cause large changes in a solved system.

Keeping only the largest singular values gives the best possible approximation of lower rank, which is the idea behind image compression and principal component analysis. The SVD also gives the most reliable way to solve Least Squares Calculator problems when columns are nearly dependent.