Lab 2: Eigenvalue Decomposition (EVD) & Singular Value Decomposition (SVD)

CILO: 1
Weeks: 8–11
Lab #2

Aim

Perform EVD and SVD on a matrix and compare their roles in dimensionality analysis.

Objectives

Algorithm / Procedure

  1. Define a 2×2 (or n×n) numeric matrix.
  2. Run eigen-decomposition to get eigenvalues/vectors.
  3. Run SVD to obtain U, Σ, Vᵀ.
  4. Compare magnitudes of eigenvalues and singular values.
  5. Interpret geometry (principal axes, energy).

Python Code

import numpy as np

A = np.array([[3, 1],
              [1, 3]])

# Eigen-decomposition
eigvals, eigvecs = np.linalg.eig(A)
print("Eigenvalues:", eigvals)
print("Eigenvectors:\n", eigvecs)

# SVD
U, S, VT = np.linalg.svd(A)
print("\nU:\n", U)
print("Singular Values:", S)
print("V^T:\n", VT)

Sample Output (expected)

Eigenvalues: [4. 2.]
Eigenvectors:
 [[ 0.7071 -0.7071]
  [ 0.7071  0.7071]]

U:
 [[-0.7071 -0.7071]
  [-0.7071  0.7071]]
Singular Values: [4. 2.]
V^T:
 [[-0.7071 -0.7071]
  [-0.7071  0.7071]]