MIT 18.06 Completed

Lecture 16 · Projection matrix and least squares

Master projection matrices and least squares, and understand normal equations.

On this page

Projection matrices and least squares | Gilbert Strang | MIT 18.06 Linear Algebra

Lecture 16 / Total 35 Lectures |Part 2 · Orthogonality and Determinant

Video of this lecture: Bilibili p16 · Projection matrix and least squares ↗(48:05)| MIT OCW official page ↗

Illustration: MIT OCW 18.06SC official lecture summary (CC BY-NC-SA 4.0) and Bilibili classroom video frames (time stamped), about 10 frames per lecture.

Introduction to this lecture

In the previous lecture, the projection was written as a matrix: if m×nm\times n matrix AA The columns of are linearly independent and constitute a set of basis of a certain subspace, then the vector is projected onto the subspace projection matrix (projection matrix) is

P=A(ATA)−1AT.P=A(A^{\mathsf T}A)^{-1}A^{\mathsf T}.

This lecture first returns to this formula and tests it with two extreme cases: when the vector is originally in the subspace, the projection should return it unchanged; when the vector is perpendicular to the subspace everywhere, the projection should be zero. Generally, the vector is between the two and is split into two parts: “inside the subspace” and “outside the subspace”. This step not only reviews projections, but also strings together projections, four basic subspaces and matrix algebra to prepare the geometry for least squares.

The main thread of this lecture is least squares (least squares). Fitting a straight line to three data points will result in three equations with only two unknowns. The system of equations has no solution; but you can ask which straight line has the smallest total error. Define the error as the length of the residual vector, and define “minimum” as the minimum square of the length. The problem is geometrically projecting the data vector into column space, and algebraically it boils down to a 2×22\times 2 of normal equation(normal equations)ATAx^=ATbA^{\mathsf T}A\hat{\boldsymbol x}=A^{\mathsf T}\boldsymbol b. By solving it, the coefficients of the best straight line, the projection vector, and the error at each point are obtained together.

Finally, I would like to add one thing that has been used before but has not been proven yet: AA When the columns of are linearly independent, ATAA^{\mathsf T}A It must be reversible. This fact underpins every step of the derivation of the projection formula and the normal equation, and the proof uses only two tools: the square of the vector length and the null space. Taking a step further along the same clue, you will see a more ideal column: if they are not only linearly independent, but also perpendicular to each other, with a length of 11, then ATA=IA^{\mathsf T}A=I, the normal equations are simplified to the point where calculation is almost unnecessary. This is the subject of the next lecture.

Official Handout Summary Page 1/3

MIT OCW Official Lecture Notes Summary Page 1/3 (18.06SC Lecture 16 Summary, CC BY-NC-SA 4.0).

1. Projection matrix: two extreme cases

Set AA is m×nm\times n matrix, nn The column vectors are linearly independent, forming a column space C(A)C(A) a set of bases. put vector b∈Rm\boldsymbol b\in\mathbb R^m Project to C(A)C(A) above, the result is given by

P=A(ATA)−1AT,p=PbP=A(A^{\mathsf T}A)^{-1}A^{\mathsf T}, \qquad \boldsymbol p=P\boldsymbol b

Given, PP is m×mm\times m phalanx. This formula looks complicated, but what it needs to do is very simple: find the distance in the column space b\boldsymbol b nearest point. Two extreme cases can be used to see how it is done.

The first situation: b\boldsymbol b It is originally in the column space. The column space is given by AA is a column span of , where each vector can be written as AxA\boldsymbol x form, so let b=Ax\boldsymbol b=A\boldsymbol x. Substitute into the formula, the middle two factors (ATA)−1(A^{\mathsf T}A)^{-1} with ATAA^{\mathsf T}A Adjacent, first multiply into the identity matrix:

Pb=A(ATA)−1AT(Ax)=A(ATA)−1(ATA)x=Ax=b.P\boldsymbol b=A(A^{\mathsf T}A)^{-1}A^{\mathsf T}(A\boldsymbol x) =A(A^{\mathsf T}A)^{-1}(A^{\mathsf T}A)\boldsymbol x=A\boldsymbol x=\boldsymbol b.

Nothing changed after projection. This fits the definition of “closest point”: b\boldsymbol b The distance to the column space is zero, and the closest point is itself.

Second situation: b\boldsymbol b Perpendicular to the entire column space. Perpendicular to the column space, it is equal to AA Each column of is vertical, i.e. ATb=0A^{\mathsf T}\boldsymbol b=\boldsymbol 0. These vectors form four basic subspaces left null space(left nullspace)N(AT)N(A^{\mathsf T}). At this time

Pb=A(ATA)−1(ATb)=0,P\boldsymbol b=A(A^{\mathsf T}A)^{-1}(A^{\mathsf T}\boldsymbol b)=\boldsymbol 0,

Because the rightmost factor ATbA^{\mathsf T}\boldsymbol b is already a zero vector. A vector without any components in the column space direction, its nearest point can only be the origin.

Generally vectors fall somewhere in between, being cleanly cut into two pieces by the projection:

b=p+e,p=Pb,e=(I−P)b,\boldsymbol b=\boldsymbol p+\boldsymbol e,\qquad \boldsymbol p=P\boldsymbol b,\quad \boldsymbol e=(I-P)\boldsymbol b,

Among them p\boldsymbol p Within the column space, e\boldsymbol e Perpendicular to the column space, it is called error vector (error vector). From the picture, p\boldsymbol p is b\boldsymbol b The shadow falling on the column space, e\boldsymbol e is the deviation perpendicular to the column space, the two are b\boldsymbol b Form a right triangle for the hypotenuse. I−PI-P It is also a projection matrix, which projects the vector onto the subspace perpendicular to the column space. This can be directly verified algebraically: if PT=PP^{\mathsf T}=P and P2=PP^2=P, then

(I−P)T=I−PT=I−P,(I−P)2=I−2P+P2=I−P.(I-P)^{\mathsf T}=I-P^{\mathsf T}=I-P, \qquad (I-P)^2=I-2P+P^2=I-P.

Two basic properties of a projection matrix - symmetry with respect to the transpose and the fact that the square is equal to itself - are imparted to its complementary projection. Squared equal to itself means that another projection does not change the result: the shadow is projected again, and it is still the same shadow. PP Reserve b\boldsymbol b components in column space, I−PI-P reserved PP The part that was lost can be restored exactly by combining the two. b\boldsymbol b.

Video 00:04:49: Classroom blackboard writing

Video 00:04:49 | Approximately corresponding to Section 1 “1. Projection Matrix: Two Extreme Cases”.

2. Three points and a straight line

Now let’s use projection on a specific problem: find the closest straight line to three data points. The data is t=1,2,3t=1,2,3 Observations at three moments 1,2,21,2,2, the straight line to be found is written as

y=C+Dt,y=C+Dt,

Among them CC is the intercept, DD is the slope. If a straight line passes through exactly three points, it should satisfy three equations at the same time:

{C+D=1,C+2D=2,C+3D=2.\begin{cases} C+D=1,\\ C+2D=2,\\ C+3D=2. \end{cases}

The first two points fall exactly on y=ty=t on, but this straight line is on t=3t=3 given at 33, than the observed value 22 Big 11. Since a straight line cannot be found that passes through three points simultaneously, this set of equations has no solution.

Write the system of equations in matrix form:

A=[111213],x=[CD],b=[122],Ax=b.A=\begin{bmatrix}1&1\\1&2\\1&3\end{bmatrix}, \qquad \boldsymbol x=\begin{bmatrix}C\\D\end{bmatrix}, \qquad \boldsymbol b=\begin{bmatrix}1\\2\\2\end{bmatrix}, \qquad A\boldsymbol x=\boldsymbol b.

AA is 3×23\times 2 Matrix, with more equations than unknowns: three rows corresponding to observations at three moments, and two columns corresponding to two undetermined parameters. its two columns (1,1,1)(1,1,1) with (1,2,3)(1,2,3) It is not proportional and linearly independent, so it is indeed a set of basis of column space; and b\boldsymbol b Not in this column space, which is why the equation has no solution. So the next best thing is to choose the one with the smallest overall error among all candidate straight lines.

“Error” needs to be defined. given C,DC,D, the deviations of each of the three equations are

e1=1−(C+D),e2=2−(C+2D),e3=2−(C+3D),e_1=1-(C+D),\qquad e_2=2-(C+2D),\qquad e_3=2-(C+3D),

Arranged into vectors it is e=b−Ax\boldsymbol e=\boldsymbol b-A\boldsymbol x. The smaller the length of the error vector, the better the straight line fit; the length is non-negative, minimizing the length is the same thing as minimizing its square, so use the sum of squares

E(C,D)=∥e∥2=(C+D−1)2+(C+2D−2)2+(C+3D−2)2E(C,D)=\|\boldsymbol e\|^2=(C+D-1)^2+(C+2D-2)^2+(C+3D-2)^2

as the overall error. this is least squares The origin of the name: Minimize the sum of squares of the errors.

Why use the square instead of the length itself? The sum of squares is a quadratic function. After derivation, the linear equation is obtained, which is the cleanest calculation. Moreover, the square and the length reach zero at the same place, which means that the system of equations has an exact solution. b\boldsymbol b falls in the column space. Statisticians call this linear regression (linear regression), the sum of squares is the most commonly used error measure. to it outliers (outlier) but quite sensitive: if in t=0t=0 If an observation with a large deviation is added here, the square term it contributes will far outweigh the other three items, pulling the entire straight line towards itself. Therefore, before statisticians use sums of squares, they often find and deal with outliers, rather than letting one potentially erroneous observation dominate the entire straight line.

This perspective makes the meaning of least squares clear: the original three equations are b\boldsymbol b There is no solution if it is not in the column space; put b\boldsymbol b Replace with the closest one in column space p\boldsymbol p After that, the system of equations is consistent, and the solution is exactly the pair (C,D)(C,D). So what least squares does is to replace the original system of unsolved equations with a nearest system of equations that has a solution, and “nearest” refers to the smallest length of the error vector.

There are two ways to draw the same question. The first is plotted on the data plane: the horizontal axis is tt, the vertical axis is yy, the three points are observations, the straight line is the candidate, and the three small vertical line segments are e1,e2,e3e_1,e_2,e_3. The second kind of painting is in R3\mathbb R^3 Here: b=(1,2,2)\boldsymbol b=(1,2,2) It’s a point, AA The column space of is a plane passing through the origin, and the vector corresponding to the best straight line p\boldsymbol p is the in-plane distance b\boldsymbol b The nearest point, e\boldsymbol e It is from p\boldsymbol p point to b\boldsymbol b vertical segment. Assume that the heights of the best straight line at three moments are in sequence P1,P2,P3P_1,P_2,P_3, then p=(P1,P2,P3)\boldsymbol p=(P_1,P_2,P_3); it falls within the column space, meaning there is C,DC,D such that p=C(1,1,1)+D(1,2,3)\boldsymbol p=C(1,1,1)+D(1,2,3), and this pair (C,D)(C,D) It is the coefficient of the best straight line. The two graphs say the same thing: the “vertical distance from the point to the straight line” on the data graph is the three components of the error vector on the vector graph.

Video 00:12:25: Classroom blackboard writing

Video 00:12:25 | Approximately corresponding to section 2 “2. Three points and a straight line”.

Video 00:14:26: Classroom blackboard writing

Video 00:14:26 | Approximately corresponding to section 2 “2. Three points and a straight line”.

3. Normal equation

Ask for E(C,D)E(C,D) There are two ways to minimize the value of , one using calculus and one using linear algebra. They give the same system of equations.

The road to calculus: separate pairs C,DC,D Find the partial derivative and set it to zero,

∂E∂C=2[(C+D−1)+(C+2D−2)+(C+3D−2)]=0,\frac{\partial E}{\partial C}=2\big[(C+D-1)+(C+2D-2)+(C+3D-2)\big]=0, ∂E∂D=2[(C+D−1)+2(C+2D−2)+3(C+3D−2)]=0.\frac{\partial E}{\partial D}=2\big[(C+D-1)+2(C+2D-2)+3(C+3D-2)\big]=0.

well organized

3C+6D=5,6C+14D=11.3C+6D=5,\qquad 6C+14D=11.

The road to linear algebra: the least squares solution satisfies normal equation(normal equations)

ATAx^=ATb.A^{\mathsf T}A\hat{\boldsymbol x}=A^{\mathsf T}\boldsymbol b.

put A,bA,\boldsymbol b Substituting in, we get exactly the two equations above. It is no exaggeration to call it the most important equation in statistics and estimation: whenever “a few parameters are used to fit noisy data”, it is almost always the first one to be solved.

Calculate the matrix on both sides. ATAA^{\mathsf T}A of (1,1)(1,1) Yuan is three 11 sum of squares 33; (1,2)(1,2) Yuan Yu (2,1)(2,1) Yuan is (1,1,1)(1,1,1) with (1,2,3)(1,2,3) dot product of 1+2+3=61+2+3=6; (2,2)(2,2) Yuan is 12+22+32=141^2+2^2+3^2=14, so

ATA=[36614].A^{\mathsf T}A=\begin{bmatrix}3&6\\6&14\end{bmatrix}.

Right end ATbA^{\mathsf T}\boldsymbol b The two components of are b=(1,2,2)\boldsymbol b=(1,2,2) Dot product with two columns: 1+2+2=51+2+2=5 and 1+4+6=111+4+6=11, that is

ATb=[511].A^{\mathsf T}\boldsymbol b=\begin{bmatrix}5\\11\end{bmatrix}.

ATAA^{\mathsf T}A is a symmetric matrix, this is no coincidence: (ATA)T=ATA(A^{\mathsf T}A)^{\mathsf T}=A^{\mathsf T}A to any AA All are established. See more clearly dollar by dollar: ATAA^{\mathsf T}A of (i,j)(i,j) Yuan is the first ii Column and No. jj The dot product of the columns, the diagonal element is the square of the length of each column, exchange i,ji,j Does not change the results. It is still reversible here because AA are linearly independent; we will show later in the course that it is even positive definite (positive definite) matrix. Symmetry, reversibility, and positive certainty are the three most anticipated properties of this key matrix.

Solve this 2×22\times 2 System of equations. The second equation minus twice the first equation:

(6C+14D)−2(3C+6D)=11−10,(6C+14D)-2(3C+6D)=11-10,

On the left is 2D2D, so D=12D=\frac12. Substituting back into the first equation: 3C+3=53C+3=5, got C=23C=\frac23. The best straight line is

y=23+12t,x^=[2/31/2].y=\frac23+\frac12 t, \qquad \hat{\boldsymbol x}=\begin{bmatrix}2/3\\1/2\end{bmatrix}.

There are only two equations because there are only two parameters; if the model has nn parameters, the normal equation is n×nn\times n The order of the system of equations is determined only by the number of parameters and has nothing to do with the number of data points.

The whole process can therefore be fixed: write out from the data AA with b\boldsymbol b, solving the normal equation we get x^\hat{\boldsymbol x}, then calculate p=Ax^\boldsymbol p=A\hat{\boldsymbol x} with e=b−p\boldsymbol e=\boldsymbol b-\boldsymbol p. Changing a set of data only changes AA, b\boldsymbol b The steps to solve the two numbers are exactly the same.

Official Handout Summary Page 2/3

MIT OCW Official Lecture Notes Summary Page 2/3 (18.06SC Lecture 16 Summary, CC BY-NC-SA 4.0).

Video 00:25:56: Classroom blackboard writing

Video 00:25:56|Approximately corresponding to Section 3 “3. Normal Equations”.

4. Projection, error and two pictures

put x^\hat{\boldsymbol x} Substitute AA, get the projection of the data vector on the column space

p=Ax^=[111213][2/31/2]=[7/65/313/6].\boldsymbol p=A\hat{\boldsymbol x} =\begin{bmatrix}1&1\\1&2\\1&3\end{bmatrix}\begin{bmatrix}2/3\\1/2\end{bmatrix} =\begin{bmatrix}7/6\\5/3\\13/6\end{bmatrix}.

The three components are the best straight lines in t=1,2,3t=1,2,3 Height at: 76\frac76 Slightly higher than the observed value 11, 53\frac53 lower than observed value 22, 136\frac{13}{6} higher than observed value 22. The error vector is

e=b−p=[122]−[7/65/313/6]=[−1/61/3−1/6],\boldsymbol e=\boldsymbol b-\boldsymbol p =\begin{bmatrix}1\\2\\2\end{bmatrix}-\begin{bmatrix}7/6\\5/3\\13/6\end{bmatrix} =\begin{bmatrix}-1/6\\1/3\\-1/6\end{bmatrix},

obviously p+e=b\boldsymbol p+\boldsymbol e=\boldsymbol b, the three residuals, two negative and one positive, add up to exactly zero. The sum of squares of the errors is

∥e∥2=136+436+136=16,\|\boldsymbol e\|^2=\frac{1}{36}+\frac{4}{36}+\frac{1}{36}=\frac16,

This is the minimum total error that can be achieved in all straight lines.

The geometric properties of the projection can be verified one by one in this example. e\boldsymbol e with p\boldsymbol p The dot product of is

76⋅(−16)+53⋅13+136⋅(−16)=−736+2036−1336=0,\frac76\cdot\left(-\frac16\right)+\frac53\cdot\frac13+\frac{13}{6}\cdot\left(-\frac16\right) =-\frac{7}{36}+\frac{20}{36}-\frac{13}{36}=0,

Both are vertical. But e\boldsymbol e Vertical is not just p\boldsymbol p: It is perpendicular to any vector in column space. Get the simplest one in the column space (1,1,1)(1,1,1), the dot product is −16+13−16=0-\frac16+\frac13-\frac16=0, which also explains why the three errors cancel each other out; then take another column (1,2,3)(1,2,3), the dot product is −16+23−12=0-\frac16+\frac23-\frac12=0. If it is perpendicular to both columns, it is perpendicular to the entire column space, that is, e∈N(AT)\boldsymbol e\in N(A^{\mathsf T}). put e=b−Ax^\boldsymbol e=\boldsymbol b-A\hat{\boldsymbol x} Substitute,

AT(b−Ax^)=0  ⟺  ATAx^=ATb,A^{\mathsf T}(\boldsymbol b-A\hat{\boldsymbol x})=\boldsymbol 0 \;\Longleftrightarrow\; A^{\mathsf T}A\hat{\boldsymbol x}=A^{\mathsf T}\boldsymbol b,

It is the normal equation. It turns out that “the error is perpendicular to the column space” and “the parameters satisfy the normal equation” are two versions of the same sentence, one expressed in geometry and the other in algebra. This also connects this lecture with the projection formula:

p=Ax^=A(ATA)−1ATb=Pb.\boldsymbol p=A\hat{\boldsymbol x}=A(A^{\mathsf T}A)^{-1}A^{\mathsf T}\boldsymbol b=P\boldsymbol b.

Compare the two graphs again: On the data graph, the length and direction of the three vertical errors are given by e\boldsymbol e The three components of are given; on the vector diagram, p\boldsymbol p is b\boldsymbol b Projection onto column space, e\boldsymbol e It’s the section perpendicular to it. Coefficients of the best straight line (23,12)(\frac23,\frac12), exactly p\boldsymbol p On base {(1,1,1),(1,2,3)}\{(1,1,1),(1,2,3)\} the coordinates below. To put it another way: “closest” on the data map refers to the smallest sum of squares of the vertical distance, and “closest” on the vector map refers to the smallest Euclidean distance. The two actually mean the same thing.

Video 00:31:15: Classroom blackboard writing

Video 00:31:15 | Approximately corresponding to Section 4 “4. Projection, Error and Two Images”.

Video 00:35:20: Classroom blackboard writing

Video 00:35:20 | Approximately corresponding to Section 4 “4. Projection, Error and Two Images”.

5. Why ATAA^{\mathsf T}A Reversible

The entire least squares calculation is based on (ATA)−1(A^{\mathsf T}A)^{-1} Above: It is used in projection formulas and normal equations. So we must answer: When is this matrix invertible?

Theorem: If AA The columns of are linearly independent, then ATAA^{\mathsf T}A Reversible.

This conclusion deserves a complete proof, because it uses all the tools learned previously; there is more than one way to prove it, and the most direct one will be taken below. The idea is to prove ATAA^{\mathsf T}A The nullspace of contains only zero vectors. Set

ATAx=0.A^{\mathsf T}A\boldsymbol x=\boldsymbol 0.

Take left on both sides xT\boldsymbol x^{\mathsf T}:

xTATAx=0.\boldsymbol x^{\mathsf T}A^{\mathsf T}A\boldsymbol x=0.

left xTAT\boldsymbol x^{\mathsf T}A^{\mathsf T} That’s it (Ax)T(A\boldsymbol x)^{\mathsf T}, so the entire expression can be read as (Ax)T(Ax)(A\boldsymbol x)^{\mathsf T}(A\boldsymbol x), that is, vector AxA\boldsymbol x dot product with itself, which is the length squared ∥Ax∥2\|A\boldsymbol x\|^2. The length square of a real vector is zero and can only be a zero vector, so

Ax=0.A\boldsymbol x=\boldsymbol 0.

Again using the assumption that the columns are linearly independent: AxA\boldsymbol x Is each column based on x\boldsymbol x The component of is a vector composed of coefficients. It is equal to zero but the coefficients are not all zero, which means that the columns are linearly related. Since the columns are linearly independent, it can only be

x=0.\boldsymbol x=\boldsymbol 0.

There is nothing in null space except zero vectors, ATAA^{\mathsf T}A Reversible.

This proof is very short, but it uses two old tools in key places: one is to xTATAx\boldsymbol x^{\mathsf T}A^{\mathsf T}A\boldsymbol x recognize (Ax)T(Ax)(A\boldsymbol x)^{\mathsf T}(A\boldsymbol x), relying on the multiplication rule of transposition and “the dot product of a vector and itself is equal to the square of the length”; the second is that the language of null space is used to process columns, which has nothing to do with it. AA The columns of are linearly independent and are equivalent to Ax=0A\boldsymbol x=\boldsymbol 0 There is only zero solution. The last step is the only place where an assumption is used, and it also explains why this assumption cannot be omitted: if the columns are linearly related, there is a non-zero x\boldsymbol x such that Ax=0A\boldsymbol x=\boldsymbol 0, so ATAx=0A^{\mathsf T}A\boldsymbol x=\boldsymbol 0, this matrix is destined to be irreversible, and both projection and normal equations will lose their meaning.

Video 00:38:28: Classroom blackboard writing

Video 00:38:28|Approximately corresponding to Section 5 “5. Why ATAA^{\mathsf T}A “Reversible” nearby.

6. Orthonormal columns

Since ATAA^{\mathsf T}A The reversibility of comes from the linear independence of columns. A natural question is: what kind of columns can make ATAA^{\mathsf T}A Extremely simple? The answer is that two pairs are perpendicular and their length is 11 of columns.

Let’s look at the most familiar group first. Take three column vectors (1,0,0),(0,1,0),(0,0,1)(1,0,0),(0,1,0),(0,0,1) Arranged into a matrix, we get the identity matrix II, obviously ATA=IA^{\mathsf T}A=I. These three vectors are perpendicular to each other and have the same length. 11, is the most standard example. Let’s look at a pair in 2D:

q1=[cos⁡θsin⁡θ],q2=[−sin⁡θcos⁡θ].\boldsymbol q_1=\begin{bmatrix}\cos\theta\\ \sin\theta\end{bmatrix}, \qquad \boldsymbol q_2=\begin{bmatrix}-\sin\theta\\ \cos\theta\end{bmatrix}.

Both lengths are 11;Dot product cos⁡θ⋅(−sin⁡θ)+sin⁡θ⋅cos⁡θ=0\cos\theta\cdot(-\sin\theta)+\sin\theta\cdot\cos\theta=0, so vertical. Take them as columns,

A=[cos⁡θ−sin⁡θsin⁡θcos⁡θ],ATA=[1001]=I.A=\begin{bmatrix}\cos\theta&-\sin\theta\\ \sin\theta&\cos\theta\end{bmatrix}, \qquad A^{\mathsf T}A=\begin{bmatrix}1&0\\0&1\end{bmatrix}=I.

Pairs are perpendicular and their length is 11 The vector of is called orthogonal (orthonormal) vector. They are automatically linearly independent: any non-trivial linear combination of two perpendicular non-zero vectors is non-zero, so the theorem of the previous section guarantees that such matrices ATAA^{\mathsf T}A Reversible. A matrix with orthonormal vectors as columns has the best columns: ATA=IA^{\mathsf T}A=I, the normal equation degenerates into x^=ATb\hat{\boldsymbol x}=A^{\mathsf T}\boldsymbol b, neither inversion nor elimination is required; there is no coupling between columns, and each parameter can be determined independently.

So, given a set of ordinary basis, how can we transform it into an orthonormal basis? This is the question to be answered in the next lecture. The next lecture will first explain why orthonormal columns make all calculations easier, and then give a systematic method to turn any set of bases into orthonormal bases.

Official Handout Summary Page 3/3

MIT OCW Official Lecture Notes Summary Page 3/3 (18.06SC Lecture 16 Summary, CC BY-NC-SA 4.0).

Summary of this lecture

  • projection matrix (projection matrix) is P=A(ATA)−1ATP=A(A^{\mathsf T}A)^{-1}A^{\mathsf T}, among which AA The columns of constitute a set of basis of the column space; PbP\boldsymbol b is b\boldsymbol b The closest point in column space.
  • Two extreme situations: b\boldsymbol b when within column space Pb=bP\boldsymbol b=\boldsymbol b, because (ATA)−1(ATA)(A^{\mathsf T}A)^{-1}(A^{\mathsf T}A) offset; offset; b\boldsymbol b Perpendicular to the column space, that is b∈N(AT)\boldsymbol b\in N(A^{\mathsf T}) time Pb=0P\boldsymbol b=\boldsymbol 0.
  • A general vector is decomposed into b=p+e\boldsymbol b=\boldsymbol p+\boldsymbol e, among which p=Pb\boldsymbol p=P\boldsymbol b, e=(I−P)b\boldsymbol e=(I-P)\boldsymbol b; I−PI-P is the projection matrix projected onto the left null space, PP with I−PI-P Both are symmetric about the transpose and squared equal to themselves.
  • Least squares problem: use y=C+Dty=C+Dt fitting (1,1),(2,2),(3,2)(1,1),(2,2),(3,2) Three points, get three equations C+D=1C+D=1, C+2D=2C+2D=2, C+3D=2C+3D=2, no solution; AA for 3×23\times 2, the two columns are linearly independent, b\boldsymbol b Not within column space.
  • The “best” criterion is the sum of squared errors E(C,D)=(C+D−1)2+(C+2D−2)2+(C+3D−2)2=∥b−Ax∥2E(C,D)=(C+D-1)^2+(C+2D-2)^2+(C+3D-2)^2=\|\boldsymbol b-A\boldsymbol x\|^2 Minimum; statistically called linear regression, the sum of squares is sensitive to outliers.
  • normal equation (normal equations) is ATAx^=ATbA^{\mathsf T}A\hat{\boldsymbol x}=A^{\mathsf T}\boldsymbol b;This example ATA=[36614]A^{\mathsf T}A=\begin{bmatrix}3&6\\6&14\end{bmatrix}, ATb=[511]A^{\mathsf T}\boldsymbol b=\begin{bmatrix}5\\11\end{bmatrix}, the solution is C=23C=\frac23, D=12D=\frac12, the best straight line y=23+12ty=\frac23+\frac12t.
  • Projection vector p=(76,53,136)\boldsymbol p=(\frac76,\frac53,\frac{13}{6}), error vector e=(−16,13,−16)\boldsymbol e=(-\frac16,\frac13,-\frac16), satisfy p+e=b\boldsymbol p+\boldsymbol e=\boldsymbol b; e\boldsymbol e Perpendicular to both columns, that is ATe=0A^{\mathsf T}\boldsymbol e=\boldsymbol 0, which is exactly the normal equation; the minimum sum of squared errors is 16\frac16.
  • If AA The columns of are linearly independent, then ATAA^{\mathsf T}A Reversible: by ATAx=0A^{\mathsf T}A\boldsymbol x=\boldsymbol 0 Take left xT\boldsymbol x^{\mathsf T} Got ∥Ax∥2=0\|A\boldsymbol x\|^2=0, so Ax=0A\boldsymbol x=\boldsymbol 0, and then from the column independence we get x=0\boldsymbol x=\boldsymbol 0.
  • If AA The columns of are orthonormal, then ATA=IA^{\mathsf T}A=I, the normal equation simplifies to x^=ATb\hat{\boldsymbol x}=A^{\mathsf T}\boldsymbol b;Identity matrix and rotation matrix [cos⁡θ−sin⁡θsin⁡θcos⁡θ]\begin{bmatrix}\cos\theta&-\sin\theta\\ \sin\theta&\cos\theta\end{bmatrix} All are examples. In the next lecture, we will learn how to convert a general basis into an orthonormal basis.

keywords

EnglishChineseOne sentence explanation
projection matrixprojection matrixThe matrix that maps the vector to the nearest point in the subspace, P=A(ATA)−1ATP=A(A^{\mathsf T}A)^{-1}A^{\mathsf T}
least squaresleast squaresFitting method based on the minimum sum of squared errors as the criterion
normal equationsnormal equationATAx^=ATbA^{\mathsf T}A\hat{\boldsymbol x}=A^{\mathsf T}\boldsymbol b, a system of equations whose least squares solution satisfies
error vectorerror vectorThe difference between the observed value and the fitted value, e=b−Ax^\boldsymbol e=\boldsymbol b-A\hat{\boldsymbol x}
linear regressionlinear regressionA statistical method that fits data with a straight line or linear model to minimize the squared error.
outlieroutliersObservations that deviate significantly from the rest of the data will have their effect magnified by the squared error
sum of squaressum of squaresThe sum of the squares of each error component, the quantity to be minimized by least squares
column spacecolumn spaceAA The subspace spanned by all column vectors of C(A)C(A)
left nullspaceleft null spacesubspace consisting of vectors perpendicular to the column space N(AT)N(A^{\mathsf T})
orthonormalorthogonalPairs are perpendicular and their length is 11 vector set of
symmetric matrixsymmetric matrixtransposes a matrix equal to itself, ATAA^{\mathsf T}A always symmetrical
positive definitepositive definiteLater in the course it will be demonstrated ATAA^{\mathsf T}A is positive definite, which is another good quality of this key matrix
linearly independent columnsColumns are linearly independentAx=0A\boldsymbol x=\boldsymbol 0 There is only zero solution, which is equivalent to ATAA^{\mathsf T}A Reversible

← Lecture 15 | Course Catalog | Lecture 17 →

Machine-assisted translation · Read Chinese original