Projecting b onto the line through a gives the closest point p = x̂a, found from the right angle: the error e = b − x̂a is perpendicular to a, so aᵀ(b − x̂a) = 0 and x̂ = aᵀb/aᵀa. The projection matrix P = aaᵀ/aᵀa has rank one, column space the line through a, and the two defining properties Pᵀ = P and P² = P (projecting twice changes nothing). Doubling b doubles p; doubling a changes nothing. Projections are needed because Ax = b often has no solution: replace b by its projection p onto the column space and solve Ax̂ = p. For a subspace with basis a₁, …, aₙ, the columns of A, the error must be perpendicular to every column: Aᵀ(b − Ax̂) = 0, so e is in N(Aᵀ), the orthogonal complement of C(A). That gives AᵀAx̂ = Aᵀb, x̂ = (AᵀA)⁻¹Aᵀb, p = Ax̂ and P = A(AᵀA)⁻¹Aᵀ, again symmetric with P² = P. The inverse cannot be split unless A is square, and then P = I. The first application, fitting the points (1, 1), (2, 2), (3, 2) by a line b = C + Dt, gives three equations in two unknowns with no solution, to be solved by least squares.
Find the point p on the line through a that is closest to b (transcript, p. 1). (Strang says "closest to a" once; he means b.) The key is the right angle: the errore=b−p is perpendicular to a (p. 1). Trigonometry with angles would give clumsy formulas; linear algebra does better (p. 2). Since p is on the line, p=x^a for some number x^, and (pp. 2–3)
Projection onto a line
aT(b−x^a)=0⇒x^aTa=aTb⇒x^=aTaaTb,p=ax^=aaTaaTb
In words
a^ capital T the quantity b minus x hat a, equals 0 which gives x hat a^ capital T a equals a^ capital T b which gives x hat equals a^ capital T b over the quantity a^ capital T a, p equals a x hat equals a a^ capital T b over the quantity a^ capital T a
Doubling b doubles p; doubling a (or reversing it) changes nothing, since the line is the same: the factor appears twice above and twice below (pp. 3–4).
aaT is a column times a row, an n×nmatrix, divided by the number aTa=∥a∥2 (p. 5). Every Pb lands on the line, so the column space of P is the line through a and the rank is 1 (p. 6). Two more facts (pp. 6–8):
Properties of P
PT=P,P2=P
In words
capital P ^ capital T equals capital P, capital P squared equals capital P
P is symmetric, and projecting twice gives the same result as projecting once: a point already on the line stays put (p. 7). (The transcript prints capital P for both the projection and the matrix; Strang says "capital P" for the matrix, p. 8. Here the vector is p.)
Ax=b may have no solution, typically when there are more equations than unknowns (transcript, p. 8). Ax is always in the column space, and b probably is not. So solve the closest problem that can be solved (p. 9):
The solvable problem
Ax^=p,p=projection of b onto C(A)
In words
capital A x hat equals p, p equals projection of b onto C( capital A )
Describe a plane in R3 by a basisa1, a2, independent but not necessarily perpendicular; it is the column space of A=[a1a2], and the same works for n columns (transcript, p. 10). If b is already in the column space, then p=b and e=0; otherwise the projection is a combination of the columns, p=Ax^ (p. 11). The errore=b−Ax^ must be perpendicular to the plane, so to a1 and to a2 (pp. 11–13):
The error is perpendicular to the columns
a1T(b−Ax^)=0,a2T(b−Ax^)=0⟹AT(b−Ax^)=0
In words
a one ^ capital T the quantity b minus capital A x hat, equals 0, a two ^ capital T the quantity b minus capital A x hat, equals 0 which gives capital A ^ capital T the quantity b minus capital A x hat, equals 0
With one column this is the line case again (p. 13). And it fits the four subspaces: ATe=0 puts e in N(AT), which is exactly the space perpendicular to C(A) (pp. 13–14). Rewritten, the key equation and its three answers are (pp. 15–17):
capital A ^ capital T capital A x hat equals capital A ^ capital T b; x hat equals ( capital A ^ capital T capital A ) to the power minus 1 capital A ^ capital T b, p equals capital A x hat equals capital A ( capital A ^ capital T capital A ) to the power minus 1 capital A ^ capital T b, capital P equals capital A ( capital A ^ capital T capital A ) to the power minus 1 capital A ^ capital T
ATA is now an n×nmatrix, so division becomes an inverse; for one column a these are the line formulas (pp. 15–16).
A tempting mistake (pp. 17–18). Why not write (ATA)−1=A−1(AT)−1, so that P=AA−1(AT)−1AT=I? Because A is not square and has no inverse. If A were square and invertible, its column space would be all of Rn, and then indeed P=I: projecting onto the whole space changes nothing (p. 18).
The general P still has the two properties (pp. 18–19). It is symmetric because ATA and its inverse are; and P2=P because in the product the middle ATA cancels against (ATA)−1:
P squared
P2=A(ATA)−1(ATA)(ATA)−1AT=A(ATA)−1AT=P
In words
capital P squared equals capital A ( capital A ^ capital T capital A ) to the power minus 1 ( capital A ^ capital T capital A )( capital A ^ capital T capital A ) to the power minus 1 capital A ^ capital T equals capital A ( capital A ^ capital T capital A ) to the power minus 1 capital A ^ capital T equals capital P
The most common use is fitting data points that lie close to a line but not on it (transcript, p. 19). Take the points (t,b)=(1,1), (2,2), (3,2) and look for the best line b=C+Dt (p. 20). (Strang first gives the second point as (2,1) and corrects it.) Going through all three points would need (p. 21)
Three equations, two unknowns
C+D=1,C+2D=2,C+3D=2:111123(CD)=122
In words
C plus D equals 1, C plus 2 D equals 2, C plus 3 D equals 2: 1 1; 1 2; 1 3 C; D equals 1; 2; 2
At right angles; more generally, of two vectors or functions, having a dot product, or an integral of their product, of zero. Explained in Introduction to Fourier series.
A list of numbers written as a column, or more generally anything that can be added and multiplied by numbers. Explained in Orthogonal vectors and subspaces.
A set of vectors inside a larger space that is a space itself: sums and multiples of its vectors stay inside it. Explained in Transposes, permutations and vector spaces.
A rectangular table of numbers, which acts on vectors to give new ones and so describes a linear change of coordinates. Explained in Planes through three points, and matrices.
Unchanged by some swap, reflection or turn; for an expression in two quantities, unchanged when they are exchanged. Explained in Introduction to Fourier series.
A set of independent vectors from which every vector in a space can be built, in exactly one way, as a combination. Explained in Independence, basis and dimension.
The thing that undoes another: a matrix times its inverse gives the identity matrix, as a function followed by its inverse gives back the start. Explained in Planes through three points, and matrices.
Of a square matrix or operator: having an inverse that undoes it; for a matrix this happens exactly when its determinant is not zero. Explained in The geometry of linear equations.
The span of some vectors is everything that can be made by combining them; vectors span a space when they fill all of it. Explained in Independence, basis and dimension.
A way to fit a model to data by choosing it to make the sum of the squared errors as small as possible. Explained in Projection matrices and least squares.
The difference between a measured or computed value and the true one; often how large that difference may be.
Tap or click a word, here or in the text, for its meaning in this lesson. All words: the glossary. How many words are marked in the text: Reading options (the “Aa” button).