Interactive
Linear Algebra
Zoom 0%

Orthogonal Vectors

Inner product of x(2,1,0) and y(-1,2,0) is zero. xTy = yTx = 0

  • Zero is the only vector orthogonal to itself.
  • Zero is the only vector orthogonal to every other vector.

Types of Subspaces in ℝ³

A subspace must always contain the origin. Four types in 3D:

  • 0D: Origin alone Z={0}
  • 1D: Any line through origin
  • 2D: Any plane through origin
  • 3D: Entire ℝ³ space

Orthogonal Subspaces

Subspaces S and T are orthogonal if every x∈S is orthogonal to every y∈T. xTy = 0

  • Z={0} is orthogonal to all subspaces.
  • In ℝ³, a line can be orthogonal to a plane.
  • In ℝ³, two planes cannot be orthogonal. → Tab 4
dim S + dim T ≤ n
  • Orthogonal complements: dim S + dim T = n
  • Here n=3, two lines: 1+1=2 ≤ 3 ✓

"A plane cannot be orthogonal to another plane"

In ℝ³, two 2D planes must intersect along a line. They share the Purple Vector v.

Since v is in both planes and vTv ≠ 0, the planes cannot be orthogonal subspaces.

Orthogonal Complement

Given a subspace V of ℝⁿ, the space of all vectors orthogonal to V is called the orthogonal complement of V, written V and read as "V perp".

Let W = V — the orthogonal complement of V.

If W = V then V = W and V⊥⊥ = V
dim V + dim W = n
  • Here n=3, dim V=1 → dim V=2 ✓
  • The whole space ℝⁿ is decomposed into two perpendicular parts V and W = V.
  • Every vector in ℝⁿ splits uniquely into a part in V and a part in V.

Projection

Closest point in a subspace to b.

■ b — original vector

■ p — projection onto line a

■ e = b − p — error (perpendicular to a)

x̂ = aTb / aTa    p = x̂a

Projection Matrix (onto line)

P = aaT / aTa
p = Pb
  • P is symmetric: P = PT
  • Its square is itself: P2 = P

Cauchy-Schwarz Inequality

Derived from the fact that error e = b − p has length ≥ 0

|aTb| ≤ ‖a‖ ‖b‖
  • Dividing both sides by ‖a‖‖b‖:
|aTb| / ‖a‖‖b‖ ≤ 1
  • That gives the definition of angle:
cos θ = aTb / (‖a‖ ‖b‖)

Least Squares

Fit the best line through data with no exact solution.

◆ Familiar equation

y = mx + c

◆ Least squares line

Ax̂ = A(ATA)-1ATb = Pb

◆ What does each symbol mean?

In y = mx + c

  • x → input (independent variable)
  • y → output
  • m, c → unknowns (what we want to find)

In least squares

  • A → matrix of inputs
  • b → outputs (observed data)
  • xunknown parameters

👉 Here, x = parameters (like m and c), not the input!

◆ Projection Matrix

p = Pb    P = A(ATA)-1AT

The least squares solution is:

x̂ = (ATA)-1ATb

If you plug this back into A:

Ax̂ = A(ATA)-1ATb = Pb

👉 So:

  • Ax̂ = A(ATA)-1ATb = Pb — least square line
  • P = projection matrix
  • Least squares = computing that projection

Fundamental Subspaces

For an m×n matrix A of rank r, there are four fundamental subspaces.

  • ■ Row space C(Aᵀ) ⊂ ℝⁿ, dim = r
  • ■ Nullspace N(A) ⊂ ℝⁿ, dim = n−r
  • ■ Column space C(A) ⊂ ℝᵐ, dim = r
  • ■ Left nullspace N(Aᵀ) ⊂ ℝᵐ, dim = m−r
Axr = b  |  Axn = 0  |  Ax = b

Hover over regions in the diagram to see mappings.

Rank-Nullity Theorem

The dimensions of the four subspaces satisfy two fundamental identities:

r + (n−r) = n   (in ℝⁿ)
r + (m−r) = m   (in ℝᵐ)
  • dim C(Aᵀ) + dim N(A) = n
  • dim C(A) + dim N(Aᵀ) = m
  • Row space and nullspace are orthogonal complements in ℝⁿ.
  • Column space and left nullspace are orthogonal complements in ℝᵐ.

Orthonormal

See the notes panel →