Study Notes

Linear Algebra

Reactivation sheet — results and the proofs whose tricks carry the subject. The organizing claim: every matrix is diagonal between the right pair of orthonormal bases (SVD). Everything before it is machinery needed to state and prove that; everything after is statistics cashing it in. The recurring workhorse is ATAA^TA: it powers least squares, definiteness, and singular values.

1. Four ways to read AxAx, four subspaces

Four readings of matrix multiplication, each the right tool somewhere:

  • Row picture: entry ii of AxAx is (row ii) x\cdot\,x — the system Ax=bAx = b is mm hyperplane constraints intersecting.
  • Column picture: Ax=x1(col1)++xn(coln)Ax = x_1(\text{col}_1) + \cdots + x_n(\text{col}_n) — a linear combination of columns with weights xx. This is the picture that generalizes: Ax=bAx = b solvable ⟺ bC(A)b \in C(A).
  • Column-wise product: AB=[Ab1Abp]AB = [Ab_1 \cdots Ab_p] — apply AA to each column of BB.
  • Outer-product sum: AB=k(colk of A)(rowk of B)AB = \sum_k (\text{col}_k \text{ of } A)(\text{row}_k \text{ of } B) — a sum of rank-1 matrices. This view makes SVD’s σiuiviT\sum \sigma_i u_i v_i^T natural before you ever see it.

Fundamental theorem. For ARm×nA \in R^{m \times n} with rank rr:

SubspaceLives inDimOrthogonal complement of
Row space C(AT)C(A^T)RnR^nrrN(A)N(A)
Null space N(A)N(A)RnR^nnrn - rC(AT)C(A^T)
Column space C(A)C(A)RmR^mrrN(AT)N(A^T)
Left null space N(AT)N(A^T)RmR^mmrm - rC(A)C(A)

Build it up:

  • xN(A)x \in N(A)Ax=0Ax = 0 ⟺ every row dots to zero against xxxx \perp row space. So N(A)=C(AT)N(A) = C(A^T)^\perp — the orthogonality is nearly definitional.
  • Apply the same statement to ATA^T: N(AT)=C(A)N(A^T) = C(A)^\perp.
  • Row rank = column rank: one number rr sets all four dimensions. Rank–nullity is the bookkeeping: r+(nr)=nr + (n-r) = n.
  • Restricted to the row space, AA is a bijection onto the column space: injective because row space ∩ null space ={0}= \{0\} (they’re complements), surjective because dims match (rr on both sides). The null space is what AA forgets; the left null space is what AA can’t reach.
  • Elimination (A=LUA = LU) computes rr as the pivot count and never changes N(A)N(A) — row operations are invertible, so solutions are preserved.

The picture to hold (and redraw cold): two panes. Left pane RnR^n, split into row space (dim rr) ⊥ null space (dim nrn-r); right pane RmR^m, split into column space (dim rr) ⊥ left null space (dim mrm-r). One arrow carries the row space bijectively onto the column space; a second arrow crushes the null space to 00.

Solvability regimes for Ax=bAx = b:

RankShape of RRN(A)N(A)# solutions
r=n<mr = n < m (full col)[I;0][\,I;\,0\,]{0}\{0\}0 or 1
r=m<nr = m < n (full row)[I    F][\,I \;\; F\,]dim nmn-m
r=m=nr = m = nII{0}\{0\}1 (invertible)
r<m,nr < m, n[IF00]\begin{bmatrix} I & F \\ 0 & 0\end{bmatrix}dim nrn-r0 or ∞
  • Complete solution =xp+N(A)= x_p + N(A): one particular solution plus the whole null space — an affine subspace, a copy of N(A)N(A) shifted off the origin.
  • Free variables: nrn - r of them, one special solution each; the special solutions are a basis for N(A)N(A).

Implications — what falls out of the four-subspace picture:

  • Fredholm alternative: Ax=bAx = b is solvable ⟺ bN(AT)b \perp N(A^T). Either you can solve the system, or there exists a certificate yy with ATy=0A^Ty = 0 and yTb0y^Tb \neq 0 — never both. (Just restating C(A)=N(AT)C(A) = N(A^T)^\perp, but it converts “is it solvable?” into a checkable orthogonality condition.)
  • Every xRnx \in R^n splits uniquely as x=xrow+xnullx = x_{row} + x_{null} with the two parts orthogonal. AA acts only on xrowx_{row}; this split is the engine behind the minimum-norm solution in §6.
  • Rank-1 matrices are exactly outer products uvTuv^T; rank kk ⟺ a sum of kk outer products ⟺ factorization into (n×k)(k×d)(n \times k)(k \times d) — the seed of low-rank approximation.

Core competency set

  • Draw the four-subspace picture with dimensions and orthogonality from a blank page.
  • Read solution count straight off the rank regime.
  • State the Fredholm alternative and the orthogonal split x=xrow+xnullx = x_{row} + x_{null}.

2. Projection and least squares

Build the projection from one dimension up:

  • Project bb onto the line through aa. The projection lies on the line: p=x^ap = \hat{x}a for some scalar x^\hat{x}. The defining property is that the error is perpendicular: e=bx^aae = b - \hat{x}a \perp a. Solve that one condition:

aT(bx^a)=0    aTb=x^aTa    x^=aTbaTaa^T(b - \hat{x}a) = 0 \;\Rightarrow\; a^Tb = \hat{x}\,a^Ta \;\Rightarrow\; \hat{x} = \frac{a^Tb}{a^Ta}

  • Repackage to expose the matrix acting on bb:

p=ax^=aaTbaTa=aaTaTab    P=aaTaTap = a\hat{x} = a\,\frac{a^Tb}{a^Ta} = \frac{aa^T}{a^Ta}\,b \;\Rightarrow\; P = \frac{aa^T}{a^Ta}

— rank 1, built from an outer product.

  • Project onto a subspace C(A)C(A). Same logic, scalar → vector: p=Ax^p = A\hat{x}, and the error must be perpendicular to every column at once, which is exactly one matrix statement:

AT(bAx^)=0        ATAx^=ATbA^T(b - A\hat{x}) = 0 \;\iff\; \boxed{A^TA\hat{x} = A^Tb}

  • The normal equations are the orthogonality condition — there is nothing else in the derivation.
  • ATAA^TA is invertible ⟺ AA has independent columns. Why: they share a null space —

ATAx=0    xTATAx=Ax2=0    Ax=0A^TAx = 0 \;\Rightarrow\; x^TA^TAx = \|Ax\|^2 = 0 \;\Rightarrow\; Ax = 0

  • So with independent columns:

x^=(ATA)1ATb,P=A(ATA)1AT\hat{x} = (A^TA)^{-1}A^Tb, \qquad P = A(A^TA)^{-1}A^T

Numbers: project b=(2,0)b = (2,0) onto a=(1,1)a = (1,1): x^=aTbaTa=22=1\hat{x} = \frac{a^Tb}{a^Ta} = \frac{2}{2} = 1, so p=(1,1)p = (1,1) and e=bp=(1,1)e = b - p = (1,-1); check eTa=0e^Ta = 0. The right triangle b=p+eb = p + e is the whole subject in one sketch — that triangle is also the picture to redraw cold.

Calculus arrives at the same place. Expand the loss, differentiate, set to zero:

Axb2=(Axb)T(Axb)=xTATAx2xTATb+bTb\|Ax - b\|^2 = (Ax - b)^T(Ax - b) = x^TA^TAx - 2x^TA^Tb + b^Tb

xAxb2=2ATAx2ATb=2AT(Axb)\nabla_x\|Ax - b\|^2 = 2A^TAx - 2A^Tb = 2A^T(Ax - b)

x=0        ATAx^=ATb\nabla_x = 0 \;\iff\; A^TA\hat{x} = A^Tb

Geometry and calculus give the same equations because “gradient zero” and “error ⊥ columns” are the same statement: the loss stops decreasing exactly when no direction in C(A)C(A) has any component of the error left to remove.

Reading PP:

  • Projection matrices are exactly the symmetric idempotents: PT=PP^T = P, P2=PP^2 = P (projecting twice changes nothing).
  • bC(A)Pb=bb \in C(A) \Rightarrow Pb = b; bC(A)Pb=0b \perp C(A) \Rightarrow Pb = 0; in general b=Pb+(IP)bb = Pb + (I-P)b splits bb into column-space part + left-null-space part. IPI - P projects onto the complement.
  • Least squares is this picture applied to an unsolvable system: bC(A)b \notin C(A), so solve the nearest solvable problem Ax^=PbA\hat{x} = Pb. The residual e=bAx^e = b - A\hat{x} lives in N(AT)N(A^T).

Implications — what falls out of the projection picture:

  • Pythagoras for regression. Since Pb(IP)bPb \perp (I-P)b:

b2=Pb2+(IP)b2\|b\|^2 = \|Pb\|^2 + \|(I-P)b\|^2

Total = explained + residual. Applied to centered data this is the R2R^2 decomposition: R2=Pb2/b2R^2 = \|Pb\|^2 / \|b\|^2.

  • In regression language: PP is the hat matrix, y^=Pb\hat{y} = Pb are fitted values, residuals are orthogonal to every regressor and to the fitted values — not an assumption, a theorem of the geometry.
  • Adding a column to AA grows C(A)C(A), so the residual norm can only shrink or stay — why R2R^2 never decreases when you add variables, and why that’s not evidence of a better model.

Orthogonal matrices. QQ has orthonormal columns: qiTqj=1q_i^Tq_j = 1 if i=ji = j, else 00; equivalently QTQ=IQ^TQ = I (square ⟹ QT=Q1Q^T = Q^{-1}).

  • They preserve lengths and inner products: Qx=x\|Qx\| = \|x\| — pure rotations/reflections.
  • With orthonormal columns, projection collapses:

P=Q(QTQ)1QT=QQTP = Q(Q^TQ)^{-1}Q^T = QQ^T

No inverse to compute — this is the reason to orthogonalize. Coefficients are just inner products: x^i=qiTb\hat{x}_i = q_i^Tb, each computed independently of the others.

Gram–Schmidt — the procedure that manufactures orthonormal bases. One move, repeated: subtract from each new vector its projections onto everything already built; what survives is the genuinely new direction.

  • Input: independent a,b,ca, b, c. Output: orthogonal A,B,CA, B, C, then orthonormal qiq_i.
  • Step 1: A=aA = a. The first direction is kept as-is.
  • Step 2: remove bb‘s shadow on AA:

B=bATbATAAB = b - \frac{A^Tb}{A^TA}A

Verify the move worked:

ATB=ATbATbATAATA=ATbATb=0A^TB = A^Tb - \frac{A^Tb}{A^TA}\,A^TA = A^Tb - A^Tb = 0

  • Step 3: remove shadows on both prior directions:

C=cATcATAABTcBTBBC = c - \frac{A^Tc}{A^TA}A - \frac{B^Tc}{B^TB}B

Subtracting projections onto orthogonal directions doesn’t interfere — removing the BB-shadow leaves the AA-orthogonality intact, which is why the procedure can work one direction at a time.

  • Normalize last: q1=AAq_1 = \frac{A}{\|A\|}, q2=BBq_2 = \frac{B}{\|B\|}, q3=CCq_3 = \frac{C}{\|C\|}.
  • Spans are preserved at every step: span(q1,,qk)=span(a1,,ak)\operatorname{span}(q_1, \ldots, q_k) = \operatorname{span}(a_1, \ldots, a_k).
  • Bookkeeping form A=QRA = QR: since aka_k involves only q1,,qkq_1, \ldots, q_k (never later ones), the coefficient matrix R=QTAR = Q^TA is upper triangular with rij=qiTajr_{ij} = q_i^Ta_j.

Implications — why QR earns its keep:

  • Least squares via QR: substitute A=QRA = QR into the normal equations and watch them collapse:

ATAx^=ATb    RTQTQRx^=RTQTb    Rx^=QTbA^TA\hat{x} = A^Tb \;\Rightarrow\; R^TQ^TQR\hat{x} = R^TQ^Tb \;\Rightarrow\; R\hat{x} = Q^Tb

One triangular solve. Better conditioned than forming ATAA^TA, whose condition number is the square of AA‘s.

  • The same “project out what’s already explained” move is the engine elsewhere: a regression coefficient measures what a variable adds beyond the others (successive orthogonalization), orthogonal polynomials, Arnoldi/Lanczos iterations.

Core competency set

  • Run the 1-D → subspace projection derivation; state that normal equations = orthogonality = gradient zero.
  • Reproduce the calculus derivation of the normal equations from the expanded loss.
  • Execute Gram–Schmidt on three vectors; explain why RR is triangular and how QR collapses the normal equations.
  • Narrate the Pythagoras/R2R^2 decomposition as projection geometry.

3. Determinants — the load-bearing facts

Three axioms (det I=1I = 1; sign flips per row swap; linear in each row separately) generate every property. Keep:

  • detA\det A = product of pivots (± for swaps) = product of eigenvalues = signed volume of the column parallelepiped.
  • detA=0    \det A = 0 \iff singular; detAB=detAdetB\det AB = \det A \det B; detAT=detA\det A^T = \det A; detA1=1/detA\det A^{-1} = 1/\det A.
  • Elimination doesn’t change the determinant: subtracting a multiple of one row from another adds a multiple of a repeated-row determinant, which is 0 —

det[abcadb]=det[abcd]det[abab]=det[abcd]\det\begin{bmatrix} a & b \\ c - \ell a & d - \ell b \end{bmatrix} = \det\begin{bmatrix} a & b \\ c & d \end{bmatrix} - \ell\det\begin{bmatrix} a & b \\ a & b \end{bmatrix} = \det\begin{bmatrix} a & b \\ c & d \end{bmatrix}

That’s why “product of pivots” works: eliminate (det unchanged), then a triangular determinant is the diagonal product.

  • Similar matrices share determinant, trace, and eigenvalues — these are basis-free numbers attached to the underlying map.
  • Cofactor expansion exists; in practice eliminate instead.
  • detJ|\det J| = local volume scaling of a map — the bridge to change of variables in probability.

4. Eigenvalues and diagonalization

Ax=λxAx = \lambda x: directions the map only stretches; λ\lambda is the stretch factor (negative = flip).

The procedure:

  1. Ax=λx    (AλI)x=0Ax = \lambda x \iff (A - \lambda I)x = 0 — we need AλIA - \lambda I singular.
  2. So set det(AλI)=0\det(A - \lambda I) = 0: the characteristic polynomial, degree nn, nn roots with multiplicity.
  3. For each root λi\lambda_i, the eigenvectors are N(AλiI)N(A - \lambda_i I) — find by elimination. The whole null space is the eigenspace.
  4. Sanity-check instantly: λi=trA\sum \lambda_i = \operatorname{tr} A, λi=detA\prod \lambda_i = \det A.

Numbers: A=[2112]A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} — trace 4, det 3, so λ=3,1\lambda = 3, 1 on sight. Eigenvectors (1,1)(1,1) and (1,1)(1,-1): orthogonal, because AA is symmetric (§5 coming). Powers grow like 3k3^k along (1,1)(1,1).

Fast facts:

  • Triangular ⟹ eigenvalues sit on the diagonal.
  • Singular ⟺ λ=0\lambda = 0 is present.
  • AA and ATA^T share eigenvalues (same characteristic polynomial), not eigenvectors.
  • Distinct eigenvalues ⟹ independent eigenvectors ⟹ diagonalizable. Repeated eigenvalues may starve you of eigenvectors (eigenspace dimension < multiplicity); Jordan form is the fallback, rarely needed.

Diagonalization. With nn independent eigenvectors as columns of SS, apply AA column by column:

AS=A[x1xn]=[λ1x1λnxn]=SΛ    A=SΛS1AS = A[x_1 \cdots x_n] = [\lambda_1 x_1 \cdots \lambda_n x_n] = S\Lambda \;\Rightarrow\; A = S\Lambda S^{-1}

Read it as a recipe: S1S^{-1} translates into eigen-coordinates, Λ\Lambda stretches each coordinate independently, SS translates back. In the right basis, the map has no cross-talk at all.

Implications — what falls out of knowing AA is diagonalizable:

  • Powers cost one decomposition. The inner pairs cancel:

Ak=(SΛS1)(SΛS1)=SΛkS1A^k = (S\Lambda S^{-1})(S\Lambda S^{-1})\cdots = S\Lambda^kS^{-1}

Only the eigenvalues get powered.

  • Linear recurrences get closed forms. uk+1=Auku_{k+1} = Au_k solves as uk=Aku0u_k = A^ku_0: expand u0=cixiu_0 = \sum c_ix_i in eigenvectors, then

uk=iciλikxiu_k = \sum_i c_i\lambda_i^k x_i

Each mode evolves independently. Fibonacci is the classic instance: (Fk+1Fk)=[1110](FkFk1)\binom{F_{k+1}}{F_k} = \begin{bmatrix}1 & 1\\ 1 & 0\end{bmatrix}\binom{F_k}{F_{k-1}}, eigenvalues 1±52\frac{1 \pm \sqrt 5}{2} — golden-ratio growth is the dominant eigenvalue showing through.

  • Stability is a one-number question. Ak0    A^k \to 0 \iff all λi<1|\lambda_i| < 1; long-run behavior is owned by λmax\lambda_{max}. This single fact is LDS stability, Markov chain convergence, and power iteration (repeatedly applying AA amplifies the top eigenvector until it’s all that’s left).
  • ODEs decouple. u˙=Au\dot{u} = Au solves as u(t)=SeΛtS1u0u(t) = Se^{\Lambda t}S^{-1}u_0 — exponentials eλite^{\lambda_i t} per mode; continuous-time stability ⟺ all Re(λi)<0\operatorname{Re}(\lambda_i) < 0.
  • Functions of matrices become functions of scalars: f(A)=Sf(Λ)S1f(A) = S\,f(\Lambda)\,S^{-1} for any polynomial/power series — matrix exponentials, square roots, inverses all ride the same identity.
  • Convergence rates come from the spectral gap: a Markov chain approaches its steady state like λ2k|\lambda_2|^k — the second eigenvalue, not the first, sets the speed.

Markov matrices (entries ≥ 0, columns sum to 1):

  • λ=1\lambda = 1 always: columns of AIA - I sum to 0, so the rows are dependent, so AIA - I is singular.
  • All other λ1|\lambda| \leq 1; the steady state is the λ=1\lambda = 1 eigenvector, reached because every other mode decays as λik\lambda_i^k.

Core competency set

  • Run the eigen-procedure; sanity-check with trace/det reflexively.
  • Derive A=SΛS1A = S\Lambda S^{-1} from AS=SΛAS = S\Lambda and narrate it as a change into eigen-coordinates.
  • Produce the implications unprompted: powers, recurrences (Fibonacci), stability via λmax|\lambda_{max}|, ODE decoupling, f(A)=Sf(Λ)S1f(A) = Sf(\Lambda)S^{-1}, spectral-gap rates.

5. Symmetric and positive definite matrices

Spectral theorem: A=ATA = A^T ⟹ real eigenvalues and a full set of orthonormal eigenvectors:

A=QΛQT=iλiqiqiTA = Q\Lambda Q^T = \sum_i \lambda_i q_iq_i^T

  • Reading: every symmetric matrix is a weighted sum of rank-1 orthogonal projections — AA acts by projecting onto each eigendirection and scaling by λi\lambda_i.
  • Proof beat (orthogonality): symmetry lets AA hop across the inner product —

λ1x1Tx2=(Ax1)Tx2=x1T(Ax2)=λ2x1Tx2\lambda_1 x_1^Tx_2 = (Ax_1)^Tx_2 = x_1^T(Ax_2) = \lambda_2 x_1^Tx_2

so λ1λ2\lambda_1 \neq \lambda_2 forces x1Tx2=0x_1^Tx_2 = 0.

  • Proof beat (reality): compute xˉTAx\bar{x}^TAx two ways —

xˉTAx=xˉT(λx)=λx2andxˉTAx=(Axˉ)Tx=λˉx2\bar{x}^TAx = \bar{x}^T(\lambda x) = \lambda\|x\|^2 \qquad \text{and} \qquad \bar{x}^TAx = (A\bar{x})^Tx = \bar{\lambda}\|x\|^2

so λ=λˉ\lambda = \bar{\lambda}: real.

  • For symmetric matrices, # positive pivots = # positive eigenvalues — elimination and the spectrum agree on signs.

Implications — what falls out of the spectral theorem:

  • Rayleigh quotient bounds. Expanding xx in the eigenbasis, xTAx=λi(qiTx)2x^TAx = \sum \lambda_i(q_i^Tx)^2, so

λminxTAxxTxλmax\lambda_{min} \leq \frac{x^TAx}{x^Tx} \leq \lambda_{max}

with equality at the eigenvectors. “Maximize variance” problems (PCA) are this: the top eigenvector is the argmax of the quadratic form on the sphere.

  • Quadratic-form geometry: the level set xTAx=1x^TAx = 1 (PD case) is an ellipsoid with axes along the qiq_i and semi-lengths 1/λi1/\sqrt{\lambda_i} — eigen-decomposition literally draws the picture of the form.
  • Whitening / matrix roots: A1/2=QΛ1/2QTA^{1/2} = Q\Lambda^{1/2}Q^T exists for PSD AA; transform data by Σ1/2\Sigma^{-1/2} to make its covariance the identity.

Positive definite — four equivalent tests, cycle freely:

  1. All eigenvalues >0> 0.
  2. xTAx>0x^TAx > 0 for all x0x \neq 0 (the defining quadratic-form test).
  3. All pivots >0> 0.
  4. All leading principal subdeterminants >0> 0.
  • The quadratic form xTAxx^TAx is a bowl; PD means the bowl opens upward in every direction.
  • Completing the square is elimination:

2x2+12xy+20y2=2(x+3y)2+2y22x^2 + 12xy + 20y^2 = 2(x + 3y)^2 + 2y^2

The outer coefficients (2, 2) are the pivots; the inside multiplier (3) is the elimination multiplier 21\ell_{21}. PD ⟺ all completed squares have positive coefficients — that’s why test 3 works.

  • PD matrices are exactly the valid covariance matrices and the valid inner products (x,y=xTAy\langle x, y\rangle = x^TAy).
  • Semi-definite: xTAx0x^TAx \geq 0 — eigenvalues allowed to touch zero.

ATAA^TA is always PSD:

xTATAx=(Ax)T(Ax)=Ax20x^TA^TAx = (Ax)^T(Ax) = \|Ax\|^2 \geq 0

with equality exactly on N(A)N(A) — so PD ⟺ full column rank. This single fact ties together least squares (§2), covariance matrices, and SVD (§6).

Cholesky: PD A=LLTA = LL^T, LL lower triangular with positive diagonal, unique — a matrix square root recorded by elimination. How you sample correlated Gaussians (x=Lzx = Lz for iid zz gives Cov(x)=LLT=A\operatorname{Cov}(x) = LL^T = A) and the cheap way to solve PD systems. Also detA=lii2\det A = \prod l_{ii}^2.

Core competency set

  • Write the spectral theorem in both forms; reproduce both proof beats (hop, reality).
  • Cycle between the four PD tests; narrate completing-the-square as elimination.
  • Derive the Rayleigh bounds from the eigenbasis expansion; connect top-eigenvector to variance maximization.
  • Explain ATA0A^TA \succeq 0 in one line and when it upgrades to 0\succ 0.

6. SVD — the capstone

A=UΣVT=i=1rσiuiviT,U,V orthogonal, Σ diagonal0A = U\Sigma V^T = \sum_{i=1}^{r} \sigma_i u_iv_i^T, \qquad U, V \text{ orthogonal},\ \Sigma \text{ diagonal} \geq 0

Exists for every matrix — no squareness, no symmetry, no diagonalizability needed. Meaning: rotate (orthonormal basis VV in the domain), scale each axis by σi\sigma_i, rotate (orthonormal basis UU in the codomain). Eigendecomposition uses one basis and needs a lucky matrix; SVD buys universality by allowing two.

The picture: the unit circle, hit by VTV^T (rotate), then Σ\Sigma (stretch into an ellipse with semi-axes σ1,σ2\sigma_1, \sigma_2 along the coordinate axes), then UU (rotate the ellipse into place). Every matrix does exactly this to the unit sphere — the σi\sigma_i are the ellipse’s axis lengths.

Construction — also the existence proof, built entirely from §5:

  1. Form ATAA^TA: symmetric PSD, the workhorse again.
  2. Spectral theorem gives orthonormal eigenvectors v1,,vnv_1, \ldots, v_n with eigenvalues λi0\lambda_i \geq 0. Define σi=λi\sigma_i = \sqrt{\lambda_i}, sorted descending.
  3. For each σi>0\sigma_i > 0, define ui=Aviσiu_i = \frac{Av_i}{\sigma_i} — push the right basis through AA and renormalize.
  4. The uiu_i come out orthonormal automatically — the one computation worth memorizing:

uiTuj=(Avi)T(Avj)σiσj=viTATAvjσiσj=σj2viTvjσiσj=δiju_i^Tu_j = \frac{(Av_i)^T(Av_j)}{\sigma_i\sigma_j} = \frac{v_i^TA^TAv_j}{\sigma_i\sigma_j} = \frac{\sigma_j^2\,v_i^Tv_j}{\sigma_i\sigma_j} = \delta_{ij}

  1. Extend {ui}\{u_i\} to an orthonormal basis of RmR^m; assemble AV=UΣAV = U\Sigma, i.e. A=UΣVTA = U\Sigma V^T.

Numbers — run the construction on A=[4433]A = \begin{bmatrix} 4 & 4 \\ -3 & 3 \end{bmatrix}:

ATA=[257725]    λ=32,18;v1=12[11],  v2=12[11];σ1=32,  σ2=18A^TA = \begin{bmatrix} 25 & 7 \\ 7 & 25 \end{bmatrix} \;\Rightarrow\; \lambda = 32,\, 18; \quad v_1 = \tfrac{1}{\sqrt{2}}\begin{bmatrix} 1 \\ 1 \end{bmatrix},\; v_2 = \tfrac{1}{\sqrt{2}}\begin{bmatrix} 1 \\ -1 \end{bmatrix}; \quad \sigma_1 = \sqrt{32},\; \sigma_2 = \sqrt{18}

u1=Av1σ1=1232[80]=[10],u2=Av2σ2=1218[06]=[01]u_1 = \frac{Av_1}{\sigma_1} = \frac{1}{\sqrt{2}\sqrt{32}}\begin{bmatrix} 8 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \qquad u_2 = \frac{Av_2}{\sigma_2} = \frac{1}{\sqrt{2}\sqrt{18}}\begin{bmatrix} 0 \\ -6 \end{bmatrix} = \begin{bmatrix} 0 \\ -1 \end{bmatrix}

Note u2=(0,1)u_2 = (0, -1), not (0,1)(0, 1). The signs must come from ui=Avi/σiu_i = Av_i/\sigma_i — eigendecomposing AATAA^T separately and picking signs independently is the classic way to assemble an “SVD” that doesn’t multiply back to AA.

Consequences to keep paired with the construction:

  • Right singular vectors = eigenvectors of ATAA^TA; left = eigenvectors of AATAA^T; σi=λi(ATA)\sigma_i = \sqrt{\lambda_i(A^TA)} — both products share the same nonzero eigenvalues.
  • SVD is the fundamental theorem made computational: v1vrv_1 \ldots v_r span the row space, vr+1vnv_{r+1} \ldots v_n the null space, u1uru_1 \ldots u_r the column space, ur+1umu_{r+1} \ldots u_m the left null space. Orthonormal bases for all four subspaces, with the row→column bijection scaled by the σi\sigma_i.
  • AF2=iσi2\|A\|_F^2 = \sum_i \sigma_i^2 — total “energy” lives in the singular values (orthogonal rotations don’t change Frobenius norm).

Eckart–Young / low-rank approximation. Truncate to the top kk rank-1 terms: Ak=UkΣkVkTA_k = U_k\Sigma_kV_k^T.

  • The error identity comes free, because multiplying by orthogonal matrices preserves Frobenius norm:

AAkF2=U(ΣΣk)VTF2=ΣΣkF2=i>kσi2\|A - A_k\|_F^2 = \|U(\Sigma - \Sigma_k)V^T\|_F^2 = \|\Sigma - \Sigma_k\|_F^2 = \sum_{i>k}\sigma_i^2

Truncation error = exactly the discarded energy.

  • The theorem’s content is optimality: no rank-kk matrix of any kind beats AkA_k (in Frobenius or operator norm). Intuition for why: any rank-kk BB has an (nk)(n-k)-dimensional null space, which must intersect the (k+1)(k+1)-dimensional span of v1,,vk+1v_1, \ldots, v_{k+1} — on that intersection BB contributes nothing while AA still carries energy σk+1\geq \sigma_{k+1}. You cannot avoid missing the top of what you cut.
  • Reading: singular values rank the “concepts” in AA by signal strength — rows of VTV^T are canonical row-types, columns of UU canonical column-types, each row/column of AA a mixture of them (the customers × movies story). PCA, compression, denoising, matrix completion all start here.
  • Storage drops O(nd)O(k(n+d))O(nd) \to O(k(n+d)). Choose kk at the spectrum’s elbow, or to capture a target share of σi2\sum \sigma_i^2.

Pseudoinverse. A+=VΣ+UTA^+ = V\Sigma^+U^T, where Σ+\Sigma^+ inverts the nonzero σ\sigma‘s and transposes the shape.

  • Subspace-by-subspace: A+A^+ inverts the row↔column bijection (uivi/σiu_i \mapsto v_i/\sigma_i) and kills N(AT)N(A^T).
  • Claim: A+bA^+b is the minimum-norm least-squares solution. Motivate it, both halves:
    • Least squares half: the set of least-squares solutions is x^+N(A)\hat{x} + N(A) — all solutions of the normal equations differ by null-space vectors, since adding xnN(A)x_n \in N(A) changes nothing about Ax^A\hat{x}.
    • Minimum-norm half: split any solution into orthogonal parts x=xrow+xnullx = x_{row} + x_{null} (§1). The fit only sees the row part (Ax=AxrowAx = Ax_{row}); the null part adds pure norm. By Pythagoras:

x2=xrow2+xnull2xrow2\|x\|^2 = \|x_{row}\|^2 + \|x_{null}\|^2 \geq \|x_{row}\|^2

  • So the minimizer is the unique solution with zero null-space component — a pure row-space vector. A+b=iruiTbσiviA^+b = \sum_{i \leq r} \frac{u_i^Tb}{\sigma_i}v_i is built entirely from the viv_i spanning the row space: it is that solution.
  • Full column rank ⟹ N(A)={0}N(A) = \{0\}, the solution is unique anyway, and A+=(ATA)1ATA^+ = (A^TA)^{-1}A^T — recovering §2’s left inverse exactly.

Implications — what falls out of having an SVD:

  • Operator norm and conditioning: A2=σ1\|A\|_2 = \sigma_1 (max stretch over the unit sphere); condition number κ=σ1/σr\kappa = \sigma_1/\sigma_r measures how much relative error in bb can amplify in xx — the practical reason QR beats normal equations (forming ATAA^TA squares κ\kappa).
  • Numerical rank: count singular values above a tolerance — far more robust than counting pivots, which rounding pollutes.
  • PCA is SVD of the centered data matrix: principal directions = right singular vectors, component variances = σi2/(n1)\sigma_i^2/(n-1); “maximize variance” = Rayleigh quotient on the covariance 1n1XTX\frac{1}{n-1}X^TX (§5 implications, cashed in).
  • Polar decomposition: A=(UVT)(VΣVT)A = (UV^T)(V\Sigma V^T) = orthogonal × symmetric-PSD — every linear map is a rotation followed by a stretch.

Core competency set

  • Construct the SVD from the spectral theorem on ATAA^TA, including the uiu_i orthonormality computation.
  • Map singular vectors onto the four subspaces; state Eckart–Young with the discarded-energy identity and the null-space-intersection intuition for optimality.
  • Prove the min-norm property of A+bA^+b via the row/null split and Pythagoras.
  • Connect σ1\sigma_1, κ\kappa, PCA, and polar decomposition back to the SVD without prompting.

7. Matrix calculus — working table

Numerator layout (gradient of a scalar = row vector; Jacobian of f:RnRmf: R^n \to R^m is m×nm \times n). Chain rule = Jacobian product: xf(g(x))=JfJg\partial_x f(g(x)) = J_fJ_g — the shapes self-check.

f(x)f(x)f/x\partial f / \partial x
aTxa^TxaTa^T
xTAxx^TAxxT(A+AT)x^T(A + A^T)2xTA2x^TA if symmetric
x2\|x\|^22xT2x^T
Axb2\|Ax - b\|^22(Axb)TA2(Ax-b)^TA — zero ⟹ normal equations
AxAx (Jacobian)AA

Worked chain-rule template — the least-squares gradient, done the modular way (this is the pattern backprop generalizes):

L=e2,e=bAxLx=Leex=(2eT)(A)=2(bAx)TAL = \|e\|^2, \quad e = b - Ax \qquad \frac{\partial L}{\partial x} = \frac{\partial L}{\partial e}\frac{\partial e}{\partial x} = (2e^T)(-A) = -2(b - Ax)^TA

  • Element-wise operations ⟹ diagonal Jacobians; sums pull outside derivatives.
  • detJ|\det J| = volume scaling (ties to §3 and the probability change-of-variables).
  • Taylor: f(x)f(x0)+fδ+12δTHδf(x) \approx f(x_0) + \nabla f\,\delta + \frac{1}{2}\delta^TH\delta — Hessian PD at a critical point ⟹ local min (§5 cashing in).

8. Decompositions roundup

DecompositionFormRequiresUse
LUA=LUA = LUsquare, (P for swaps)solving systems, det via pivots
QRA=QRA = QRindependent columnsleast squares, Gram–Schmidt record
CholeskyA=LLTA = LL^Tsymmetric PDsampling Gaussians, fast PD solves
EigenA=SΛS1A = S\Lambda S^{-1}nn indep. eigenvectorspowers, dynamics, stability
SpectralA=QΛQTA = Q\Lambda Q^Tsymmetricquadratic forms, PSD theory
SVDA=UΣVTA = U\Sigma V^Tnothingeverything else

9. Memorize cold

The instant-recall layer — these should cost nothing to produce. Everything else in the guide is rederivable from them plus the named moves; the fluency flashcards drill exactly this list.

  • Four subspaces: dims r,nr,r,mrr,\, n-r,\, r,\, m-r; row ⊥ null, column ⊥ left-null; AA = bijection row space → column space.
  • Normal equations ATAx^=ATbA^TA\hat{x} = A^Tb; x^=(ATA)1ATb\hat{x} = (A^TA)^{-1}A^Tb; P=A(ATA)1ATP = A(A^TA)^{-1}A^T; orthonormal case P=QQTP = QQ^T.
  • Projection test: symmetric + idempotent. Pythagoras b2=Pb2+(IP)b2\|b\|^2 = \|Pb\|^2 + \|(I-P)b\|^2.
  • Eigen: det(AλI)=0\det(A - \lambda I) = 0; λ=tr\sum\lambda = \operatorname{tr}, λ=det\prod\lambda = \det; A=SΛS1A = S\Lambda S^{-1}, Ak=SΛkS1A^k = S\Lambda^kS^{-1}; stability ⟺ all λ<1|\lambda| < 1.
  • Spectral theorem: symmetric ⟹ A=QΛQT=λiqiqiTA = Q\Lambda Q^T = \sum\lambda_iq_iq_i^T, real λ\lambda, orthonormal qq.
  • PD tests (all positive): eigenvalues / xTAxx^TAx / pivots / leading minors. ATA0A^TA \succeq 0 always; 0\succ 0 ⟺ full column rank.
  • SVD: A=UΣVT=σiuiviTA = U\Sigma V^T = \sum\sigma_iu_iv_i^T; vv = eigvecs of ATAA^TA, uu = eigvecs of AATAA^T, σi=λi(ATA)\sigma_i = \sqrt{\lambda_i(A^TA)}; AF2=σi2\|A\|_F^2 = \sum\sigma_i^2, A2=σ1\|A\|_2 = \sigma_1.
  • Pseudoinverse A+=VΣ+UTA^+ = V\Sigma^+U^T; full column rank ⟹ A+=(ATA)1ATA^+ = (A^TA)^{-1}A^T; A+bA^+b = min-norm least squares.
  • Gradient rows: (aTx)=aT\partial(a^Tx) = a^T; (xTAx)=xT(A+AT)\partial(x^TAx) = x^T(A + A^T); Axb2=2(Axb)TA\partial\|Ax-b\|^2 = 2(Ax-b)^TA.
  • The decompositions table: form, requirement, use — all six rows.
  • Named moves: error ⊥ subspace (normal equations); the inner-product hop (spectral orthogonality); project-out-what’s-built (Gram–Schmidt); row/null split + Pythagoras (min-norm); shared-null-space (ATAA^TA invertibility).