Writing

Machine Learning Math Foundations (2) — Linear Algebra

Preface: linear algebra has many abstract topics; this note tries to connect them. Main objects: vectors, determinants, matrices, and systems of equations.

Preface: linear algebra has many abstract topics; this note tries to connect them—if not in one chain, then two. Main objects: vectors, determinants, matrices, and systems of equations.

Viewpoint

The core problem is solving systems of multivariate equations. Core ideas: inner product, rank, matrix inverse. Applications: linear regression, least squares via QR decomposition, SVD, PCA via diagonalizable matrices.

Vectors

  • Basics: a vector represents n independent properties (dimensions), often written with an arrow or as coordinates. Unit vector: magnitude 1. Inner (dot) product is a scalar: image Orthogonal vectors: inner product zero.

  • Applications: vector sets and eigenvectors

Matrices

Definition: parameters describing linear relationships—a matrix is a linear map from some vectors to others. Y = AX maps X to Y; A describes the map. Y = AX appears often in linear dependence of vector sets. Intuition:

image

  • Matrices and vectors: when m = 1 or n = 1, A is a row or column vector.

  • Square matrices: negative matrix, upper/lower triangular, diagonal, identity. Determinant transforms use triangular form. Distinguish from unit vectors.

  • Matrix transpose

Determinants

A determinant is usually a scalar—a function measuring how a linear transform affects “area” or “volume.”

  • Determinant of a square matrix: n×n matrix A has |A| or det(A).

  • Cofactor: A_ij = (−1)^(i+j) M_ij image Adjugate matrix—for finding the inverse image Square matrix inverse: if AB = BA = E, B is the inverse of A; A is invertible (nonsingular). Otherwise A is singular. Inverse denoted A⁻¹: image ## Elementary matrix operations Row and column elementary transforms. image Row echelon form, reduced row echelon, standard form—the former for variable relations, the latter for rank. Theorem (1): if A becomes B by elementary row ops, there exists invertible P with … How to find P? image Matrix rank: k-th order minor is a determinant image ## Vector sets A vector set: a collection of finitely many row or column vectors of the same dimension. image Linear representation of vectors: image As a system: image Similarly, if set B is representable by set A then: image AX = B has a solution.

  • Linear dependence and independence: image Use rank to test dependence: image ## Linear systems Theorem 1: homogeneous Ax = 0 has nontrivial solutions iff R(A) … Positive definite matrix: if xᵀAx > 0 for all x ≠ 0, A is positive definite.

  • Orthogonal matrix: n×n A with AᵀA = E is orthogonal (unitary over ℂ). Equivalent: columns (rows) are unit vectors and pairwise orthogonal.

QR Decomposition (Orthogonal–Triangular)

For m×n column-full-rank A:

image

Uses Gram–Schmidt orthogonalization:

image

Singular Value Decomposition

Generalizes symmetric eigen-decomposition to arbitrary matrices.

image

Corresponding to eigenvalues/vectors: diagonal entries of Σ are singular values; U and V are left/right singular vector matrices.

  • Equivalence canonical form: image

  • Steps: eigenvalues/vectors; eigenvectors form V₁, compute U₁: image

Derivatives of Vectors

A is m×n, x is n×1 column vector; Ax is m×1.

image

  • Partial derivative formulas: image image

  • Scalar w.r.t. matrix: image Postscript: Still learning—slow updates; we improve together.

You might also like: my NumPy notes for ML, my matplotlib notes for ML, my calculus notes for ML