Euler Hall — free maths guides

Form the projection matrix A(A transpose A) inverse A transpose

Form P = A(AT A)-1 AT for a matrix with independent columns. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.

The one picture behind everything in this module

You have a subspaceVV — a line, a plane, some flat thing through the origin — and a vectorbb that is usually not in it. There is exactly one pointpp ofVV closest tobb, and the arrow frompp tobb meetsVV at a right angle. That is the whole idea of a projection, and everything else here is that sentence written as algebra.

Three names for the three objects:

-pp is the projection ofbb ontoVV. It is inVV. -e=b−pe = b - p is the error, also called the residual. It is perpendicular toVV. -PP is the matrix withPb=pPb = p for everybb. Same job, written as something you can multiply.

The formula comes from the right angle, not from memory

Take the line case,V=span⁡{a}V = \operatorname{span}\{a\}. Every point of that line is a multiplex^a\hat x a, so the problem is to find the single numberx^\hat x. The condition is that the error is perpendicular to the line:

Thenp=x^ap = \hat x a and

P=aaTaTa.P = \frac{a a^{T}}{a^{T}a}.

Read the shape:aaTa a^{T} is a column times a row, which is a full matrix;aTaa^{T}a is a single number. SoPP is a matrix divided by a scalar — it has rank one, and the division byaTaa^{T}a is the step students drop.

Now replace the single vectoraa withnn independent columns in a matrixAA. The same right angle, applied to each column separately, givesnn equations at once:

p=Ax^=A(ATA)−1ATb,P=A(ATA)−1AT.p = A\hat x = A(A^{T}A)^{-1}A^{T}b, \qquad P = A(A^{T}A)^{-1}A^{T}.

The numberaTaa^{T}a became the matrixATAA^{T}A; dividing by a number became inverting a matrix. Nothing else changed.

The exam's shape, all the way through

Leta1=(1,2,0)a_1 = (1,2,0) anda2=(0,1,3)a_2 = (0,1,3), and letVV be their span inR3\mathbb{R}^3. Find the projection matrixPP.

Step 1 — the Gram matrix.ATA=[52210]A^{T}A = \begin{bmatrix}5&2\\2&10\end{bmatrix}, froma1⋅a1=5a_1\cdot a_1 = 5,a1⋅a2=2a_1\cdot a_2 = 2,a2⋅a2=10a_2\cdot a_2 = 10.

Step 2 — invert it.det⁡=50−4=46\det = 50 - 4 = 46, so(ATA)−1=146[10−2−25]\def\arraystretch{1.6}(A^{T}A)^{-1} = \frac{1}{46}\begin{bmatrix}10&-2\\-2&5\end{bmatrix}.

Step 3 — multiply. MultiplyAA times(ATA)−1(A^{T}A)^{-1} timesATA^{T}:

Step 4 — check, in this order.

  • -PT=PP^{T} = P ✓ (compare two entries, not all nine).
  • -P2=PP^2 = P — verified by multiplication, and it must hold, becausePbPb is already inVV.
  • -Pa1=a1P a_1 = a_1 andPa2=a2P a_2 = a_2 ✓ — the subspace does not move.
  • -trace⁡P=10+37+4546=2\operatorname{trace}P = \frac{10 + 37 + 45}{46} = 2 ✓, the dimension ofVV.

Four checks, and any one of them failing means the answer is wrong even if the arithmetic looked clean.

By the end you can
  • Form P = A(A^T A)^-1 A^T for a matrix with independent columns
  • Check a claimed projection matrix by symmetry, idempotence, the fixed columns and the trace
  • Read rank and trace off the dimension of the target subspace without forming P
Two questions, one minute

(a)PP projectsR4\mathbb{R}^{4} onto a 2-dimensional subspace. What arerank⁡P\operatorname{rank}P,trace⁡P\operatorname{trace}P, and what doesI−PI - P project onto?

(b) Is[1500]\begin{bmatrix}1&5\\0&0\end{bmatrix} an orthogonal projection? Answer yes or no and give the one check that decides it.

Answers

(a)rank⁡P=2\operatorname{rank}P = 2 andtrace⁡P=2=1+1+0+0\operatorname{trace}P = 2 = 1 + 1 + 0 + 0, the eigenvalues along and across the subspace.I−PI - P projects onto the 2-dimensional orthogonal complement, with the same rank and trace.

(b) No. It does square to itself, so it is a projection — but its transpose is[1050]\begin{bmatrix}1&0\\5&0\end{bmatrix}, which is notMM. The shadow is cast at a slant. One comparison of two entries settles it.

Work out where to start — free, no accountAnswer six real questions — free, no account