Eigenvalue and Singular Value Decomposition

Eigenvalues: The DNA of a Matrix

Eigenvalue decomposition reveals the intrinsic geometry of a linear transformation — its principal axes and scaling factors. In wireless communications, the eigenvalues of the channel correlation matrix determine the spatial degrees of freedom, the singular values of the channel matrix determine the capacity of each spatial stream, and PCA (principal component analysis) is eigendecomposition of the sample covariance.

Definition:

Eigenvalue Decomposition

A square matrix ACn×n\mathbf{A} \in \mathbb{C}^{n \times n} has eigenvalue decomposition Av=λv\mathbf{A}\mathbf{v} = \lambda \mathbf{v}, where λ\lambda is an eigenvalue and v\mathbf{v} is the corresponding eigenvector. If A\mathbf{A} is diagonalizable:

A=VΛV1\mathbf{A} = \mathbf{V}\boldsymbol{\Lambda}\mathbf{V}^{-1}

where Λ=diag(λ1,,λn)\boldsymbol{\Lambda} = \mathrm{diag}(\lambda_1, \ldots, \lambda_n).

eigenvalues, V = np.linalg.eig(A)       # general matrix
eigenvalues, V = np.linalg.eigh(A)      # Hermitian/symmetric

eigh is preferred when A=AH\mathbf{A} = \mathbf{A}^H because it guarantees real eigenvalues, orthogonal eigenvectors, and is 3×3\times faster than eig (exploits symmetry via the divide-and-conquer algorithm).

Definition:

Singular Value Decomposition (SVD)

Any matrix ACm×n\mathbf{A} \in \mathbb{C}^{m \times n} (not necessarily square) admits a factorization:

A=UΣVH\mathbf{A} = \mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^H

where UCm×m\mathbf{U} \in \mathbb{C}^{m \times m} (left singular vectors), ΣRm×n\boldsymbol{\Sigma} \in \mathbb{R}^{m \times n} (singular values on the diagonal), and VCn×n\mathbf{V} \in \mathbb{C}^{n \times n} (right singular vectors).

U, s, Vh = np.linalg.svd(A, full_matrices=True)   # full SVD
U, s, Vh = np.linalg.svd(A, full_matrices=False)  # reduced SVD

The reduced SVD returns UCm×r\mathbf{U} \in \mathbb{C}^{m \times r}, σRr\boldsymbol{\sigma} \in \mathbb{R}^r, VHCr×n\mathbf{V}^H \in \mathbb{C}^{r \times n} where r=min(m,n)r = \min(m, n).

The singular values are always real and non-negative: σ1σ20\sigma_1 \ge \sigma_2 \ge \cdots \ge 0. The eigenvalues of AHA\mathbf{A}^H\mathbf{A} are σi2\sigma_i^2.

Definition:

Condition Number

The condition number of a matrix (in the 2-norm) is the ratio of its largest to smallest singular value:

κ2(A)=σmaxσmin\kappa_2(\mathbf{A}) = \frac{\sigma_{\max}}{\sigma_{\min}}

kappa = np.linalg.cond(A)
# or equivalently:
s = np.linalg.svd(A, compute_uv=False)
kappa = s[0] / s[-1]

A matrix with κ1\kappa \approx 1 is well-conditioned (stable to solve). A matrix with κ1\kappa \gg 1 is ill-conditioned (solutions are sensitive to perturbations). For double precision, roughly log10(κ)\log_{10}(\kappa) digits of accuracy are lost in solving Ax=b\mathbf{Ax} = \mathbf{b}.

Definition:

Numerical Rank

The numerical rank of a matrix is the number of singular values above a threshold ϵ\epsilon:

rankϵ(A)={i:σi>ϵ}\mathrm{rank}_\epsilon(\mathbf{A}) = |\{i : \sigma_i > \epsilon\}|

In NumPy:

rank = np.linalg.matrix_rank(A)          # default tolerance
rank = np.linalg.matrix_rank(A, tol=1e-6)  # custom tolerance

The default tolerance is σmaxmax(m,n)ϵmach\sigma_{\max} \cdot \max(m, n) \cdot \epsilon_{\mathrm{mach}}.

Theorem: Eckart-Young-Mirsky Theorem (Best Low-Rank Approximation)

The best rank-kk approximation to A\mathbf{A} in the Frobenius (or spectral) norm is obtained by keeping only the kk largest singular values:

Ak=i=1kσiuiviH\mathbf{A}_k = \sum_{i=1}^{k} \sigma_i \mathbf{u}_i \mathbf{v}_i^H

The approximation error is: AAkF=σk+12++σr2\|\mathbf{A} - \mathbf{A}_k\|_F = \sqrt{\sigma_{k+1}^2 + \cdots + \sigma_r^2}

The SVD sorts the "information content" of a matrix by singular value. Truncating at rank kk keeps the kk most important components and discards the rest. This is the mathematical basis for PCA, image compression, and low-rank channel approximations.

Theorem: Spectral Theorem for Hermitian Matrices

A Hermitian matrix A=AH\mathbf{A} = \mathbf{A}^H has:

  1. All real eigenvalues
  2. Orthogonal eigenvectors: VHV=I\mathbf{V}^H\mathbf{V} = \mathbf{I}
  3. Eigendecomposition A=VΛVH\mathbf{A} = \mathbf{V}\boldsymbol{\Lambda}\mathbf{V}^H

For a positive semidefinite (PSD) matrix, all eigenvalues are 0\ge 0. For a positive definite (PD) matrix, all eigenvalues are >0> 0.

Hermitian matrices are the complex generalization of real symmetric matrices. They appear everywhere in wireless: covariance matrices R=E[xxH]\mathbf{R} = \mathbb{E}[\mathbf{x}\mathbf{x}^H], Gram matrices HHH\mathbf{H}^H\mathbf{H}, and correlation matrices are all Hermitian PSD.

Theorem: SVD-Eigenvalue Connection

For any ACm×n\mathbf{A} \in \mathbb{C}^{m \times n}:

  • The singular values of A\mathbf{A} are the square roots of the eigenvalues of AHA\mathbf{A}^H\mathbf{A} (or AAH\mathbf{A}\mathbf{A}^H).
  • The right singular vectors are the eigenvectors of AHA\mathbf{A}^H\mathbf{A}.
  • The left singular vectors are the eigenvectors of AAH\mathbf{A}\mathbf{A}^H.

Example: Eigendecomposition of a Channel Covariance Matrix

Construct a 4×44 \times 4 spatial correlation matrix for a uniform linear array (ULA) with correlation coefficient ρ=0.7\rho = 0.7. Compute its eigendecomposition and verify the spectral theorem.

Example: Low-Rank Approximation via SVD

Approximate a 100×100100 \times 100 matrix with a rank-5 version and measure the relative approximation error. Show how the error decreases as the rank increases.

Example: Comparing eig and eigh for Hermitian Matrices

Generate a random Hermitian matrix and compare the results of np.linalg.eig vs np.linalg.eigh. Verify that eigh returns sorted real eigenvalues and is faster.

Eigenvalue Decomposition Explorer

Visualize eigenvalues and eigenvectors of a 2x2 or 3x3 matrix. See how changing matrix entries affects the eigenvalue spectrum and eigenvector directions.

Parameters
4
0.7

SVD Low-Rank Approximation (Animated)

Watch a matrix being reconstructed as rank-1, rank-2, ... components are added. See the singular value spectrum and the reconstruction error decrease with each added component.

Parameters
32

eig vs eigh vs svd

Propertynp.linalg.eignp.linalg.eighnp.linalg.svd
InputAny square matrixHermitian/symmetric onlyAny matrix (m x n)
EigenvaluesComplex, unsortedReal, sorted ascendingReal non-negative, sorted descending
EigenvectorsNot necessarily orthogonalOrthonormalTwo sets: U and V, orthonormal
LAPACK routinegeevheev / syevgesdd
ComplexityO(n3)O(n^3)O(n3)O(n^3) but ~3x fasterO(mn2)O(mn^2) or O(m2n)O(m^2n)
Use whenGeneral eigenproblemsCovariance, correlation, Gram matricesAny matrix, rank, pseudoinverse

eigenvalue

A scalar λ\lambda such that Av=λv\mathbf{A}\mathbf{v} = \lambda\mathbf{v} for some nonzero vector v\mathbf{v}. Eigenvalues characterize the scaling behavior of a linear transformation.

Related: singular value

singular value

The non-negative square roots of the eigenvalues of AHA\mathbf{A}^H\mathbf{A}. Singular values measure the "gain" of a matrix along its principal directions.

Related: eigenvalue

Common Mistake: Using eig for Hermitian Matrices

Mistake:

Using np.linalg.eig on a matrix that is known to be Hermitian (e.g., covariance matrix R=E[xxH]\mathbf{R} = \mathbb{E}[\mathbf{x}\mathbf{x}^H]).

Correction:

Use np.linalg.eigh for Hermitian matrices. It is faster, returns real eigenvalues (no spurious imaginary parts), and guarantees orthogonal eigenvectors. eig on a Hermitian matrix may return eigenvalues with small imaginary parts due to roundoff.

Why This Matters: SVD Precoding for MIMO

In MIMO with channel state information at the transmitter (CSIT), the SVD of H=UΣVH\mathbf{H} = \mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^H enables optimal precoding. By transmitting x=Vx~\mathbf{x} = \mathbf{V}\tilde{\mathbf{x}} and receiving y~=UHy\tilde{\mathbf{y}} = \mathbf{U}^H\mathbf{y}, the MIMO channel decomposes into rr parallel scalar channels: y~i=σix~i+n~i\tilde{y}_i = \sigma_i \tilde{x}_i + \tilde{n}_i The singular values σi\sigma_i determine the gain on each stream. Water-filling across these streams achieves the channel capacity.

Historical Note: The SVD: From Beltrami to Big Data

The singular value decomposition was independently discovered by Eugenio Beltrami (1873) and Camille Jordan (1874). Gene Golub and William Kahan developed the modern computational algorithm in 1965. Today, SVD underpins recommender systems (Netflix Prize), natural language processing (latent semantic analysis), image compression, and MIMO wireless — one of the most versatile tools in all of applied mathematics.

Quick Check

When should you use np.linalg.eigh instead of np.linalg.eig?

When the matrix is Hermitian (or real symmetric)

When you want complex eigenvalues

When the matrix is rectangular

Always — eigh is a strict upgrade over eig

Key Takeaway

SVD is the Swiss Army knife of linear algebra. It works on any matrix (square or rectangular, real or complex), reveals the rank, condition number, range, and null space, provides the optimal low-rank approximation, and forms the basis for the pseudoinverse. When in doubt, compute the SVD.

Eigenvalue Applications

python
PCA, low-rank approximation, eigenfaces, and channel correlation analysis using eigenvalue and singular value decompositions.
# Code from: ch06/python/eigenvalue_applications.py
# Load from backend supplements endpoint