0Pricing
R Academy · Lesson

Eigenvalues and Eigenvectors

Compute eigen decompositions with eigen() and interpret results.

What Are Eigenvalues?

An eigenvector v of matrix A is a non-zero vector that only scales (not rotates) when multiplied by A: Av = λv. The scalar λ is the eigenvalue. They reveal a matrix's intrinsic stretching directions.

# Intuition: A simple scaling matrix
A <- matrix(c(3, 0,
              0, 2), nrow = 2, byrow = TRUE)

# The eigenvectors are the standard basis vectors
# A * c(1,0) = 3 * c(1,0)  -> eigenvalue 3
# A * c(0,1) = 2 * c(0,1)  -> eigenvalue 2

v1 <- c(1, 0)
A %*% v1  # c(3, 0) = 3 * v1

v2 <- c(0, 1)
A %*% v2  # c(0, 2) = 2 * v2

cat('Eigenvalues of a diagonal matrix are its diagonal entries')

eigen(): Computing Eigenvalues

eigen(A) returns a list with $values (eigenvalues sorted by decreasing magnitude) and $vectors (matrix of eigenvectors as columns). The eigenvectors are normalized to unit length.

A <- matrix(c(4, 1,
              2, 3), nrow = 2, byrow = TRUE)

# Compute eigendecomposition
eig <- eigen(A)

# Eigenvalues
eig$values
# [1] 5 2  (descending order)

# Eigenvectors (columns)
eig$vectors
#           [,1]       [,2]
# [1,] 0.7071068 -0.4472136
# [2,] 0.7071068  0.8944272

cat('Each column is one eigenvector (unit length)')

All lessons in this course

  1. Matrix Multiplication and Determinants
  2. Solving Linear Systems with solve()
  3. Eigenvalues and Eigenvectors
  4. SVD, QR, and Cholesky Decompositions
← Back to R Academy