Free preview

59 lessons

Essential Linear Algebra for ML

Free preview

Essential Linear Algebra for ML · 59 lessons

Master the linear algebra that powers modern ML

No surprise gaps

Actually remember it

Skip what you know

One subscription. All learning paths included.

Our content is best on a larger screen

Interpreting the SVD

From the unit circle to the ellipse

Explanation

To see the geometry of the singular value decomposition, we start with the unit circle in R2\mathbb{R}^2: the set of all vectors of length one. The reason for focusing on the unit circle is simple. If we want to understand how a matrix acts on all directions at once, we can apply it to every point on the circle. The resulting shape captures the global effect of the transformation.

When we apply a matrix to the unit circle, the resulting set of points is always an ellipse (or a degenerate ellipse if the matrix has rank one or zero). This ellipse is the geometric fingerprint of the matrix: it shows exactly how the transformation stretches and rotates space.

Why does the unit circle become an ellipse?

Details

This circle‑to‑ellipse picture is the stage on which the SVD plays out. The singular values will turn out to be the lengths of the ellipse’s axes, and the singular vectors will be the directions of those axes.

Visualisation

Have a play with the interactive visualisation below to get a feel for how AA turns a circle into an ellipse. The visualisation shows the unit circle and the result of AvA\vec{v} for all vectors v\vec{v} that lie on the unit circle for any 2×22 \times 2 matrix AA.

1234−1−2−3−41234−1−2−3−4

Adjust the entries of the matrix A. The unit circle (red) is mapped by A into the ellipse (blue) with axes shown by the dashed blue lines.

Why visualise the unit circle and not a grid?

Details

Geometry of the SVD

Explanation

The singular value decomposition tells us that any matrix AA can be written as

A=UΣVT,A = U \Sigma V^T,

where UU and VV are orthogonal matrices and Σ\Sigma is diagonal with non‑negative entries.

Geometrically, this means that applying AA to the unit circle always happens in three clean steps.

  1. VTV^T rotates the circle. Since rotations preserve circles, the unit circle remains a circle, but its coordinate axes are re‑oriented.
  2. Σ\Sigma stretches the circle into an ellipse, with the singular values giving the lengths of the ellipse’s axes.
  3. UU rotates the ellipse into its final position in the output space.

So the unit circle always becomes an ellipse, and the SVD gives the universal recipe: rotate → stretch → rotate.

This geometric view explains why the SVD is so powerful. The singular values are the lengths of the ellipse’s axes. The right singular vectors (the columns of VV) are the input directions that get stretched. The left singular vectors (the columns of UU) are the output directions of the ellipse’s axes.

Unlike eigendecomposition, which only works in special cases, the SVD always produces this clean orthogonal picture.

What about higher dimensions?

Details

Visualisation

With an animation, we can make this process vivid and interactive: it allows us to modify UU, Σ\Sigma and VV (which compose AA) and see the impact of the linear transformation Av=UΣVTvA\vec{v} = U \Sigma V^T \vec{v} for all vectors v\vec{v} which lie on the unit circle. At each stage, the geometry is simple and transparent.

1234−1−2−3−41234−1−2−3−4
e1
e2
Visualising the SVD
Matrices are updated live as you move the sliders.
U=[1.000.000.001.00],Σ=[2.00001.00],V=[1.000.000.001.00]

A=UΣVT=[2.000.000.001.00]

Step 1: Unit circle

We begin with the unit circle (red) and the standard basis vectors, e1 and e2. The unit circle allows us to visualise all unit directions at once.

How this compares to diagonalisation

Details

Practice questions

4 questions

Suppose x\vec{x} is a unit vector on the unit circle in R2\mathbb{R}^2. What happens when we apply VTV^T to x\vec{x} in the SVD A=UΣVTA = U \Sigma V^T?

Select the correct answer:

+ 3 more questions

Zero singular values

Explanation

So far we have seen the geometry of the SVD when both singular values are positive: the unit circle becomes a full ellipse. But what if one of the singular values is zero, or if the matrix is rectangular? In those cases, the ellipse collapses in one or more directions. This is exactly what zero singular values record, and it is the next piece of the story.

Rank deficiency (true zero singular values)

Even within the min(m,n)\min(m,n) singular values on Σ\Sigma's main diagonal, some may be zero if the matrix is not full rank. This means that the transformation actively collapses certain directions completely.

For example, a 3×23 \times 2 matrix of rank 11 has only one linearly independent column. This means the second column is a multiple of the first, so the matrix cannot span two independent directions. In the SVD, this shows up as one positive singular value σ1\sigma_1 and one zero singular value σ2=0\sigma_2 = 0. On top of that, there is the extra zero row in Σ\Sigma to make it 3×23 \times 2.

So the single non‑zero singular value reflects the one independent direction in the columns of AA, while the zero singular value reflects the redundancy.

Geometrically, the ellipse collapses into a line segment: only one axis survives, the other is squashed flat.

Rank and zero singular values

Tip

The number of non‑zero singular values of a matrix is equal to its rank.

So if a matrix has rank rr, then it has exactly rr positive singular values, and the remaining min(m,n)r\min(m,n) - r singular values are zero.

Visualisation

Have a play with the interactive visualisation below. Note that here we’ve fixed U=V=IU = V = I, so A=ΣA = \Sigma. That means when a singular value is zero, we see a whole row or column of zeros in AA.

In a typical matrix AA, rank deficiency doesn’t usually appear as literal zeros - instead, one row (or one column) is a linear combination of the others. The SVD makes this structure explicit by rotating into a basis where the dependency shows up as a zero in Σ\Sigma. Either way, the geometry is the same: a zero singular value means one direction is completely collapsed.

1234−1−2−3−41234−1−2−3−4
Watching the ellipse collapse
Drag the sliders to change the singular values. Watch how the ellipse collapses when a singular value goes to zero.
U=[1.000.000.001.00],Σ=[2.00001.00],V=[1.000.000.001.00]

A=UΣVT=[2.000.000.001.00]
σ1: 2.0
σ2: 1.0

Aside: rectangular matrices

Even when a matrix is full rank, if it is rectangular then Σ\Sigma must be padded with zeros. This is not just padding for shape - it reflects a real limitation: a matrix can only stretch space in at most min(m,n)\min(m,n) independent directions.

That is why, when we computed the SVD of a rectangular matrix AA, we had to add extra orthonormal vectors to complete UU and VV, and pad Σ\Sigma with zeros.

The extra vectors in UU or VV point in directions where the transformation does nothing, and the matching zeros in Σ\Sigma record this fact.

Example: transforming a vector

Details


Key Point

The SVD always maps the unit circle (or hypersphere) to an ellipse (or ellipsoid).

  • The positive singular values give the lengths of its axes.
  • The zero singular values show exactly which axes collapse.

This is why the SVD is universal: it makes both the stretching and the limitations of any matrix completely explicit.

Practice questions

5 questions

Consider the matrix

A=[1224].A = \begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix}.

From the SVD we find that

V=15[1221],Σ=[5000].V =\dfrac{1}{\sqrt{5}} \begin{bmatrix} 1 & -2 \\ 2 & 1 \end{bmatrix}, \quad \Sigma = \begin{bmatrix} 5 & 0 \\ 0 & 0 \end{bmatrix}.

Now take an arbitrary input vector

x=[x1x2].\vec{x} = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}.

When we compute y=VTx=[y1y2]\vec{y} = V^T \vec{x} = \begin{bmatrix} y_1 \\ y_2 \end{bmatrix}, the coordinates y1y_1 and y2y_2 represent how much of xx lies along the right singular vectors v1\vec{v}_1 and v2\vec{v}_2. Multiplying by Σ\Sigma gives

z=Σy=[5y10].\vec{z} = \Sigma \vec{y} = \begin{bmatrix} 5 y_1 \\ 0 \end{bmatrix}.

Notice that the second entry of z\vec{z} is always zero, regardless of the input vector x\vec{x}.

What is the correct interpretation of this fact?

Select the correct answer:

+ 4 more questions