Guozhen AIGlobal AI field notes and model intelligence

English translation

Generate a simple random matrix (imagine it as a grayscale image)

Published:

Category: Linear Algebra for AI

Read time: 4 min

Reads: 0

Lesson #21Views are counted together with the original Chinese articleImages are preserved from the source page

Conceptual Diagram of Singular Value Decomposition

SVD decomposes any matrix into three components: direction, magnitude (strength), and direction again. It is more general than eigenvalue decomposition and better suited for real-world data matrices.

SVD Conceptual Checklist

I interpret singular values as the importance of each direction. Larger singular values typically retain more information.

In the previous article, we discussed inner products and orthogonality, introducing applications of inner product spaces. In this article, we explore the fundamental concepts of Singular Value Decomposition (SVD) and its significance in data analysis and machine learning. SVD is an exceptionally powerful tool, playing a critical role in feature extraction, dimensionality reduction, and noise filtering.

Definition of Singular Value Decomposition

Singular Value Decomposition is an important matrix factorization technique in linear algebra that decomposes an arbitrary matrix into the product of three special matrices. More formally, an m×nm \times n matrix AA can be factored as:

SVD Conceptual Flashcard

When interpreting SVD, first examine the original matrix, left and right singular vectors, magnitudes of singular values, low-rank approximation, and proportion of information retained.

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

where:

  • UU is an m×mm \times m orthogonal matrix whose columns are called left singular vectors;
  • Σ\Sigma is an m×nm \times n diagonal matrix whose diagonal entries—called singular values—are non-negative and arranged in descending order;
  • VTV^T is the transpose of an n×nn \times n orthogonal matrix VV, whose columns are called right singular vectors.

Meaning of Singular Values

Within this decomposition, each singular value σi\sigma_i (i.e., the ii-th diagonal entry of Σ\Sigma) quantifies the “importance” or “information content” of the original data along a specific direction. Larger singular values indicate directions carrying more significant information. Thus, by selecting the top kk largest singular values and their corresponding singular vectors, we can perform dimensionality reduction on the data.

Geometric Interpretation of SVD

Geometrically, SVD can be viewed as transforming data from its original space into a new coordinate system. Each data point (i.e., each row of matrix AA) is projected onto a new “feature space” spanned by the columns of UU, preserving essential structural information about the data. The singular values in Σ\Sigma quantify the relative “importance” of these features.

Application Example

Example: Image Compression

Linear Algebra Reading Map Card

Before reading “The Concept of Singular Value Decomposition”, preview the visual path from problem to result shown in the diagram. After reading, revisit the main text to verify whether you can reproduce the process step-by-step.

SVD has widespread applications in image processing—one classic use case being image compression. Suppose we have a grayscale image represented as a matrix AA. Using SVD, we decompose this matrix into the product of three matrices:

  1. Compute the SVD: A=UΣVTA = U \Sigma V^T.
  2. Reconstruct the image using only the top kk singular values and their corresponding singular vectors:
Ak=UkΣkVkTA_k = U_k \Sigma_k V_k^T

Here, UkU_k, Σk\Sigma_k, and VkV_k denote the first kk columns of UU, the k×kk \times k leading submatrix of Σ\Sigma, and the first kk rows of VTV^T, respectively.

This approach approximates the original image using only kk singular values—achieving compression while retaining the most visually important information. This method is highly effective: it significantly reduces storage requirements while preserving image readability.

Python Code Example

Below is a simple example using Python’s numpy library to compute the SVD of a matrix:

import numpy as np
import matplotlib.pyplot as plt

# Generate a simple random matrix (imagine it as a grayscale image)
A = np.random.rand(100, 100)

# Perform singular value decomposition
U, S, VT = np.linalg.svd(A)

# Select the top k singular values
k = 10
A_k = np.dot(U[:, :k], np.dot(np.diag(S[:k]), VT[:k, :]))

# Visualize results
plt.subplot(1, 2, 1)
plt.title('Original Matrix')
plt.imshow(A, cmap='gray')

plt.subplot(1, 2, 2)
plt.title('Reconstructed Matrix (k=10)')
plt.imshow(A_k, cmap='gray')

plt.show()

In the code above, we first generate a random 100×100100 \times 100 matrix (representing a simplified image), then apply numpy.linalg.svd to compute its SVD. Next, we reconstruct an approximation AkA_k using only the top k=10k = 10 singular values and associated singular vectors. Finally, we visualize and compare the original and reconstructed matrices.

SVD Concept Application Review Card

When reviewing “The Concept of Singular Value Decomposition”, place key concepts, procedural steps, and observable outcomes side-by-side on a single page for efficient revision.

SVD Concept Application Check Card

When practicing “The Concept of Singular Value Decomposition”, write down input conditions, processing actions, and observable results together—making future review faster and more systematic.

Summary

Singular Value Decomposition is a powerful tool for understanding and manipulating high-dimensional data. Not only does it provide low-rank approximations of data, but it also forms the mathematical foundation for many downstream techniques—including Principal Component Analysis (PCA) and recommendation systems. In the next article, we will delve deeper into how singular values are computed, helping you master the practical implementation of SVD.

Continue

Keep reading from here

Browse English site

Reader Messages

Reader messages

Questions, corrections, extra sources, or hands-on results can be left here. No login is required.

Max 800 characters

To reduce spam, each message is checked for length, link count, and posting frequency.

0/800

Messages

0 messages
Loading messages...