Guozhen AIGlobal AI field notes and model intelligence

English translation

Define matrix A

Published:

Category: Linear Algebra for AI

Read time: 4 min

Reads: 0

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

Conceptual Diagram of Singular Value Computation

You can compute singular values manually by starting from the eigenvalues of ATAA^T A. In practice, engineers delegate this task to numerical libraries—but understanding the underlying derivation helps interpret results correctly.

Verification Diagram for Singular Value Computation

I verify that singular values are non-negative and typically ordered in descending order. If their ordering is incorrect, low-rank approximations will also be wrong.

In the previous article, we introduced the concept of Singular Value Decomposition (SVD) and discussed why it plays such a pivotal role in data science and machine learning. This article dives deeper into how singular values are computed—equipping you with mastery of this core technique and laying a solid foundation for subsequent applications.

1. Theoretical Foundation

Singular Value Decomposition (SVD) is a matrix factorization method that decomposes any matrix AA into the product of three matrices. Specifically, if AA is an m×nm \times n matrix, it can be expressed as:

Singular Value Computation Decision Card

When computing singular values, consider: transpose–product relationships, eigenvalues, square-root mapping, singular vectors, dimensional changes, and numerical stability.

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

where:

  • UU is an m×mm \times m orthogonal matrix;
  • Σ\Sigma is an m×nm \times n diagonal matrix containing the singular values of AA;
  • VTV^T is the transpose of VV, and VV is an n×nn \times n orthogonal matrix.

Singular values represent a kind of “signature” of matrix AA, reflecting its structural properties and information content. To extract them from Σ\Sigma, follow these steps:

  1. Compute ATAA^T A and AATA A^T.
  2. Obtain the eigenvalues of both matrices.
  3. Take the non-negative square roots of those eigenvalues to yield the singular values.

2. Step-by-Step Computation of Singular Values

To compute singular values, proceed as follows:

Step 1: Compute ATAA^T A

Given a matrix AA, first compute its transpose ATA^T, then multiply it by AA to obtain ATAA^T A. The result is an n×nn \times n matrix.

Step 2: Compute Eigenvalues

Next, compute the eigenvalues λi\lambda_i of ATAA^T A. If AA is m×nm \times n, then ATAA^T A is n×nn \times n, and its eigenvalues can be found by solving the characteristic polynomial.

Step 3: Compute Singular Values

Each singular value sis_i is the non-negative square root of the corresponding eigenvalue:

si=λis_i = \sqrt{\lambda_i}

Apply this to all eigenvalues λi\lambda_i to obtain the full set of singular values.

3. Worked Example

Let’s demonstrate singular value computation using a concrete matrix. Consider:

Linear Algebra Reading Map Card

“The Computation of Singular Values in SVD” can be read through four lenses: scenario, concept, action, and outcome. First align these four elements, then revisit parameters, code, or workflows in the main text.

A=(123456)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{pmatrix}

Detailed Computation Steps

  1. Compute ATAA^T A:

    AT=(135246)A^T = \begin{pmatrix} 1 & 3 & 5 \\ 2 & 4 & 6 \end{pmatrix}

    So,

    ATA=(135246)(123456)=(35444456)A^T A = \begin{pmatrix} 1 & 3 & 5 \\ 2 & 4 & 6 \end{pmatrix} \begin{pmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{pmatrix} = \begin{pmatrix} 35 & 44 \\ 44 & 56 \end{pmatrix}
  2. Compute eigenvalues: Solve

    det(ATAλI)=0,\det(A^T A - \lambda I) = 0,

    where II is the 2×22 \times 2 identity matrix. Solving yields eigenvalues:

    λ1=91,λ2=0.\lambda_1 = 91,\quad \lambda_2 = 0.
  3. Compute singular values:

    s1=λ1=919.54,s_1 = \sqrt{\lambda_1} = \sqrt{91} \approx 9.54, s2=λ2=0=0.s_2 = \sqrt{\lambda_2} = \sqrt{0} = 0.

Thus, the singular values of AA are approximately 9.549.54 and 00.

4. Python Implementation

Using NumPy, we can implement this computation concisely:

import numpy as np

# Define matrix A
A = np.array([[1, 2], [3, 4], [5, 6]])

# Compute SVD
U, s, VT = np.linalg.svd(A)

# Output singular values
print("Singular values:", s)

Running this code yields:

Singular values: [9.52551809 0.51449576]

Application Retrospective Card: Singular Value Computation in SVD

After studying “The Computation of Singular Values in SVD”, try applying it to your own scenario—pay close attention to whether inputs, processing steps, and outputs align coherently.

Application Validation Card: Singular Value Computation in SVD

To apply “The Computation of Singular Values in SVD” to your own task, begin by narrowing the scope—focus on validating just one critical decision point.

Summary

This article thoroughly explains how singular values are computed—including theoretical foundations, a step-by-step worked example, and a practical Python implementation. This knowledge is essential for deeply understanding SVD and its applications. In the next article, we’ll explore real-world use cases of SVD—for instance, in recommendation systems and image processing.

Stay tuned for our ongoing tutorial series—and deepen your grasp of linear algebra’s vital role in AI!

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...