DerivativeCalculus.com

Matrix Operations Cheat Sheet

Essential Linear Algebra reference for students, engineers, and data scientists.

📊 Matrix Dimensions & Notation

m × n Matrix

m = rows, n = columns

Aᵢⱼ

Element in row i, column j

Aᵀ

Transpose (swap rows/columns)

Iₙ

Identity matrix (n×n)

📐 Matrix Multiplication

To multiply A (m×n) and B (n×p):

Cᵢⱼ = Σₖ₌₁ⁿ Aᵢₖ · Bₖⱼ

Result C is (m×p). Inner dimensions must match!

Example:
A = [[1,2],[3,4]] (2×2), B = [[5,6],[7,8]] (2×2)
C = [[1·5+2·7, 1·6+2·8],[3·5+4·7, 3·6+4·8]]
= [[19,22],[43,50]]
Important: Matrix multiplication is NOT commutative!
AB ≠ BA in general
🔓 Determinants
2×2: det(A) = ad - bc
3×3: det(A) = a(ei-fh) - b(di-fg) + c(dh-eg)

Properties:

  • det(I) = 1
  • det(AB) = det(A)·det(B)
  • det(Aᵀ) = det(A)
  • If row/column of zeros ⇒ det = 0
  • If two rows equal ⇒ det = 0
Singular Matrix: det(A) = 0 ⇒ No inverse exists
🔄 Matrix Inverse

Only for square matrices with det(A) ≠ 0:

2×2: A⁻¹ = (1/det(A)) · [[d, -b], [-c, a]]

Properties:

  • AA⁻¹ = A⁻¹A = I
  • (AB)⁻¹ = B⁻¹A⁻¹
  • (Aᵀ)⁻¹ = (A⁻¹)ᵀ
Example:
A = [[2,1],[1,3]], det = 5
A⁻¹ = (1/5)[[3,-1],[-1,2]] = [[0.6,-0.2],[-0.2,0.4]]
🌟 Eigenvalues & Eigenvectors

Solve the characteristic equation:

det(A - λI) = 0

For each eigenvalue λ, solve:

(A - λI)v = 0
Example:
A = [[2,1],[1,2]]
det(A-λI) = (2-λ)² - 1 = λ² - 4λ + 3 = 0
λ₁ = 1, λ₂ = 3
v₁ = [1,-1], v₂ = [1,1]
🏗️ Rank & Nullity

Rank(A): Number of linearly independent rows/columns

Nullity(A): Dimension of null space

Rank-Nullity Theorem:
rank(A) + nullity(A) = n
Example:
A = [[1,2,3],[4,5,6],[7,8,9]]
rank(A) = 2, nullity(A) = 1
Full rank matrix: rank = min(m,n)
Singular matrix: rank < n
🔀 Special Matrices
  • Symmetric: A = Aᵀ
  • Diagonal: aᵢⱼ = 0 for i≠j
  • Orthogonal: AAᵀ = I
  • Upper Triangular: aᵢⱼ = 0 for i>j
  • Idempotent: A² = A
  • Nilpotent: Aᵏ = 0 for some k
Trace: tr(A) = Σᵢ aᵢᵢ
tr(AB) = tr(BA)

💪 Quick Practice Problems

Problem 1: Multiply [[1,2],[3,4]] × [[2,0],[1,2]]
Answer: [[4,4],[10,8]]
Problem 2: Find det([[3,1],[2,4]])
Answer: 10
Problem 3: Inverse of [[2,5],[1,3]]
Answer: [[3,-5],[-1,2]]
Problem 4: Eigenvalues of [[4,1],[2,3]]
Answer: λ=2, λ=5