AoZai
AoZai

Reading Notice

These are personal study and translation notes for reference only; the original course materials belong to MIT OpenCourseWare and their respective rights holders.

ZoomNotes for Linear Algebra

Gilbert Strang, MIT 18.06 · Ch.4 / 11

Part 4: Orthogonal Matrices and Least Squares

4.1 Orthogonality of the Four Subspaces

Orthogonal vectors: xyx \perp y means xTy=0x^T y = 0.

Orthogonal subspaces: Subspaces VV and WW are orthogonal if every vector in VV is orthogonal to every vector in WW.

Fundamental Orthogonality:

  • Row space C(AT)C(A^T) \perp Nullspace N(A)N(A)
  • Column space C(A)C(A) \perp Left nullspace N(AT)N(A^T)

Proof: For any xx in N(A)N(A), Ax=0Ax = 0, meaning every row of AA (a basis for the row space) is orthogonal to xx. Similarly for the second pair using ATA^T.

The Big Picture: Rows and nullspace live in Rn\mathbb{R}^n; columns and left nullspace live in Rm\mathbb{R}^m. The orthogonal subspaces are not just orthogonal -- they are orthogonal complements: together they span the whole space.

Decomposition: Every xRnx \in \mathbb{R}^n can be uniquely written as:

x=xrow+xnullx = x_{\text{row}} + x_{\text{null}}

where xrowC(AT)x_{\text{row}} \in C(A^T) and xnullN(A)x_{\text{null}} \in N(A). Similarly for Rm\mathbb{R}^m.


4.2 Projections onto Subspaces

Projection onto a line through aa:

p=aaTaTab=aTbaTaap = \frac{a a^T}{a^T a} \, b = \frac{a^T b}{a^T a} \, a

Projection matrix for a line:

P=aaTaTaP = \frac{a a^T}{a^T a}

Properties: P2=PP^2 = P (idempotent), PT=PP^T = P (symmetric).

Projection onto a subspace: Given a matrix AA with independent columns, the projection of bb onto C(A)C(A) is:

p=Ax^whereATAx^=ATbp = A \hat{x} \quad \text{where} \quad A^T A \hat{x} = A^T b

Projection matrix for a subspace:

P=A(ATA)1ATP = A (A^T A)^{-1} A^T

Properties of projection matrices:

  • P2=PP^2 = P (projecting twice is same as once)
  • PT=PP^T = P (symmetric)
  • IPI - P is the projection onto the orthogonal complement
  • PP projects onto C(A)C(A); IPI - P projects onto N(AT)N(A^T)

4.3 Least Squares Approximations (Regression): ATAx^=ATbA^T A \hat{x} = A^T b

When Ax=bAx = b has no solution (because bb is not in C(A)C(A)), we find the best approximation by minimizing bAx2\|b - Ax\|^2.

The Normal Equations:

ATAx^=ATbA^T A \hat{x} = A^T b

Why this works: The error e=bAx^e = b - A\hat{x} is orthogonal to C(A)C(A), so ATe=0A^T e = 0, giving AT(bAx^)=0A^T (b - A\hat{x}) = 0, hence ATAx^=ATbA^T A \hat{x} = A^T b.

Best Fit Line (Linear Regression): Given mm points (t1,y1),,(tm,ym)(t_1, y_1), \dots, (t_m, y_m), find the line y=C+Dty = C + Dt that minimizes the sum of squared errors.

Set up A=[1t11t21tm]A = \begin{bmatrix} 1 & t_1 \\ 1 & t_2 \\ \vdots & \vdots \\ 1 & t_m \end{bmatrix}, x=[CD]x = \begin{bmatrix} C \\ D \end{bmatrix}, b=[y1ym]b = \begin{bmatrix} y_1 \\ \vdots \\ y_m \end{bmatrix}.

Solve ATAx^=ATbA^T A \hat{x} = A^T b:

[mtititi2][CD]=[yitiyi]\begin{bmatrix} m & \sum t_i \\ \sum t_i & \sum t_i^2 \end{bmatrix} \begin{bmatrix} C \\ D \end{bmatrix} = \begin{bmatrix} \sum y_i \\ \sum t_i y_i \end{bmatrix}

4.4 Orthogonal Matrices and Gram-Schmidt

Orthogonal Matrix QQ satisfies QTQ=IQ^T Q = I. For square QQ, this means QT=Q1Q^T = Q^{-1}.

Properties:

  • Columns of QQ are orthonormal (qiTqj=0q_i^T q_j = 0 for iji \neq j, qiTqi=1q_i^T q_i = 1)
  • Qx=x\|Qx\| = \|x\| (preserves length)
  • (Qx)T(Qy)=xTy(Qx)^T (Qy) = x^T y (preserves angles)
  • Product of orthogonal matrices is orthogonal
  • detQ=±1\det Q = \pm 1

Orthonormal Basis: For a basis q1,,qnq_1, \dots, q_n with qiTqj=δijq_i^T q_j = \delta_{ij}:

Fourier Coefficients: Every vector vv can be expressed as:

v=(q1Tv)q1+(q2Tv)q2++(qnTv)qnv = (q_1^T v) q_1 + (q_2^T v) q_2 + \cdots + (q_n^T v) q_n

The coefficients ck=qkTvc_k = q_k^T v are the Fourier coefficients.

Gram-Schmidt Process: Converts independent vectors a,b,ca, b, c into orthonormal vectors q1,q2,q3q_1, q_2, q_3.

  1. q1=a/aq_1 = a / \|a\|
  2. B=b(q1Tb)q1B = b - (q_1^T b) q_1, then q2=B/Bq_2 = B / \|B\|
  3. C=c(q1Tc)q1(q2Tc)q2C = c - (q_1^T c) q_1 - (q_2^T c) q_2, then q3=C/Cq_3 = C / \|C\|

At each step, we subtract the projections onto all previous orthonormal vectors, then normalize.

QR Factorization: Every m×nm \times n matrix AA (with independent columns) factors as:

A=QRA = Q R
  • QQ is m×nm \times n with orthonormal columns
  • RR is n×nn \times n upper triangular

The entries of RR are the dot products rij=qiTajr_{ij} = q_i^T a_j (or qiTbq_i^T b in the notation above).

Solving Ax=bAx = b with QR:

ATAx=ATb    RTQTQRx=RTQTb    RTRx=RTQTb    Rx=QTbA^T A x = A^T b \implies R^T Q^T Q R x = R^T Q^T b \implies R^T R x = R^T Q^T b \implies Rx = Q^T b

Since RR is triangular, back substitution gives xx directly -- no need to form ATAA^T A.

Previous Next
© MIT OpenCourseWare  |  18.06 Linear Algebra  |  Gilbert Strang  |  Spring 2010
ocw.mit.edu  ·  CC BY-NC-SA 4.0