BetaFree coursewareRewritten from MIT OpenCourseWareCC BY-NC-SA 4.0
Open CosmologyPhysics & cosmology, from high school to a graduate year

Problem Set 6: projections, least squares and Gram–Schmidt

Six problems of our own on Lectures 15, 16 and 17: projecting onto a line and onto a plane, the projection matrix and its two properties, the closest point, fitting a straight line by least squares and the effect of an outlier, the projection onto the perpendicular space, reflections, when AᵀA is invertible, Gram–Schmidt and A = QR, projections with orthonormal vectors, and orthogonal matrices.

You need this first

Full reading path (19 pages)
  1. Vectors (8.01)
  2. Vectors and the dot product (18.02)
  3. Determinants and the cross product (18.02)
  4. Planes through three points, and matrices (18.02)
  5. Equations of planes and square systems (18.02)
  6. The geometry of linear equations (18.06)
  7. Elimination with matrices (18.06)
  8. Matrix multiplication and inverse matrices (18.06)
  9. Factorization into A = LU (18.06)
  10. Transposes, permutations and vector spaces (18.06)
  11. Column space and nullspace (18.06)
  12. Solving Ax = 0: pivot variables and special solutions (18.06)
  13. Solving Ax = b: the complete solution (18.06)
  14. Independence, basis and dimension (18.06)
  15. The four fundamental subspaces (18.06)
  16. Orthogonal vectors and subspaces (18.06)
  17. Projections onto subspaces (18.06)
  18. Projection matrices and least squares (18.06)
  19. Orthogonal matrices and Gram–Schmidt (18.06)
On this page · 8 sections
  1. How to answer
  2. What you need from the lessons
  3. Problem 1
  4. Problem 2
  5. Problem 3
  6. Problem 4
  7. Problem 5
  8. Problem 6

This set practises three lessons: projections onto subspaces (Lecture 15), projection matrices and least squares (Lecture 16) and orthogonal matrices and Gram–Schmidt (Lecture 17). Orthogonal subspaces and complements (Lecture 14) belong to Problem Set 5, and determinants start in Problem Set 7, so nothing here uses a determinant.

MIT's 18.06 problem sets assign exercises from a textbook that is not openly licensed, so this set is made of our own problems on the same lectures, in MIT's lecture order. No MIT or textbook problem is used: every matrix and every number below is ours, and so are the hints and the solutions. The formulas come from the lessons and from the lecture transcripts they cite.

How to answer#

Work each problem on paper first. Then type or choose your result in the answer box and press Check.

A number box wants a decimal number, not a fraction or a root: write 0.250.25, not 1/41/4. Every number box accepts any value within 0.010.01 of the exact one, so give at least two decimal places when the answer is not a whole number. A matrix or a vector cannot be typed: a box asks for one of its entries, a length or a single number, or you choose from a list. Entries are numbered by row, then column, starting from 1: "row 1, column 2" is the entry in the first row and the second column. A vector is written as a list, (1,2,2)(1, 2, 2), and its "second entry" is the second number in that list.

A formula box takes plain typing, for example (5 + beta^2)/3, and accepts every correct way of writing the answer. Type β\beta as beta.

Some parts ask you to show something. They have no answer box: write your argument, then open the solution and mark yourself. MIT gives no points for these problems: the points here (100 in all) and their split between the parts are ours. If you are stuck, open the hints one at a time. Each part ends with its full solution. Try before you open it: an answer given after its solution was opened earns no points. Your score is kept in this browser only.

What you need from the lessons#

Projecting onto a line (Lecture 15). The point p=x^ap = \hat xa on the line through aa closest to bb leaves an error e=b−pe = b - p perpendicular to aa. That right angle gives x^\hat x, and pp is a matrix PP times bb:

Projection onto a line
aT(b−x^a)=0,x^=aTbaTa,p=Pb,P=aaTaTaa^T(b - \hat xa) = 0, \qquad \hat x = \frac{a^Tb}{a^Ta}, \qquad p = Pb, \qquad P = \frac{aa^T}{a^Ta}
In words

a^ capital T the quantity b minus x hat a, equals 0, x hat equals a^ capital T b over the quantity a^ capital T a, p equals capital P b, capital P equals a a^ capital T over the quantity a^ capital T a

Projecting onto a subspace (Lecture 15). Put a basis of the subspace in the columns of AA. The error must be perpendicular to every column, which gives the normal equations and three answers:

Projection onto the column space
AT(b−Ax^)=0,ATAx^=ATb,p=Ax^,P=A(ATA)−1ATA^T(b - A\hat x) = 0, \qquad A^TA\hat x = A^Tb, \qquad p = A\hat x, \qquad P = A(A^TA)^{-1}A^T
In words

capital A ^ capital T the quantity b minus capital A x hat, equals 0, capital A ^ capital T capital A x hat equals capital A ^ capital T b, p equals capital A x hat, capital P equals capital A ( capital A ^ capital T capital A ) to the power minus 1 capital A ^ capital T

Every projection matrix has the two properties

The two properties
PT=P,P2=PP^T = P, \qquad P^2 = P
In words

capital P ^ capital T equals capital P, capital P squared equals capital P

The two projections (Lecture 16). Pb=bPb = b for bb in the column space and Pb=0Pb = 0 for bb in N(AT)N(A^T), the space perpendicular to it. Every bb splits into the two parts, and I−PI - P is the projection onto the perpendicular space:

b=p+eb = p + e
b=Pb+(I−P)b=p+eb = Pb + (I - P)b = p + e
In words

b equals capital P b plus the quantity capital I minus capital P, b equals p plus e

Least squares (Lecture 16). To fit points (t,b)(t, b) by a line C+DtC + Dt, write the equations C+Dt=bC + Dt = b for all the points as Ax=bAx = b with x=(C,D)x = (C, D); the first column of AA is all ones and the second holds the times tt. The best line makes ∥Ax−b∥2=∥e∥2\|Ax - b\|^2 = \|e\|^2, the sum of the squared vertical errors, as small as possible. It solves the normal equations ATAx^=ATbA^TA\hat x = A^Tb (pp. 5–11 of the transcript). ATAA^TA is invertible when the columns of AA are independent, because

Why AᵀA is invertible
ATAx=0  ⇒  xTATAx=∥Ax∥2=0  ⇒  Ax=0  ⇒  x=0A^TAx = 0 \;\Rightarrow\; x^TA^TAx = \|Ax\|^2 = 0 \;\Rightarrow\; Ax = 0 \;\Rightarrow\; x = 0
In words

capital A ^ capital T capital A x equals 0 which gives x^ capital T capital A ^ capital T capital A x equals the norm of capital A x squared equals 0 which gives capital A x equals 0 which gives x equals 0

Orthonormal vectors (Lecture 17). Orthonormal columns q1,…,qnq_1, \dots, q_n of QQ give QTQ=IQ^TQ = I. A square QQ with orthonormal columns is an orthogonal matrix, and then QT=Q−1Q^T = Q^{-1} (pp. 2–4). With orthonormal columns the projection needs no inverse, and each component is a dot product:

Projection with orthonormal columns
P=QQT,x^=QTb,x^i=qiTbP = QQ^T, \qquad \hat x = Q^Tb, \qquad \hat x_i = q_i^Tb
In words

capital P equals capital Q capital Q ^ capital T, x hat equals capital Q ^ capital T b, x sub i hat equals q sub i ^ capital T b

Gram–Schmidt (Lecture 17). From independent a,b,ca, b, c, keep A=aA = a and subtract from each later vector its components along the earlier directions; then divide each by its length:

Gram–Schmidt
B=b−ATbATAA,C=c−ATcATAA−BTcBTBB,q1=A∥A∥,  q2=B∥B∥,  q3=C∥C∥B = b - \frac{A^Tb}{A^TA}A, \qquad C = c - \frac{A^Tc}{A^TA}A - \frac{B^Tc}{B^TB}B, \qquad q_1 = \frac{A}{\|A\|}, \; q_2 = \frac{B}{\|B\|}, \; q_3 = \frac{C}{\|C\|}
In words

capital B equals b minus capital A ^ capital T b over the quantity capital A ^ capital T capital A, times capital A, capital C equals c minus capital A ^ capital T c over the quantity capital A ^ capital T capital A, times capital A minus capital B ^ capital T c over the quantity capital B ^ capital T capital B, times capital B, q one equals capital A over the quantity the norm of capital A, q two equals capital B over the quantity the norm of capital B, q three equals capital C over the quantity the norm of capital C

In matrix language the original matrix is QRQR, with RR upper triangular; the entry of RR in row ii and column jj is qiTq_i^T times column jj (pp. 22–24).

Problem 1#

Problem

Projecting onto a line

14 points

Take a=(1,2,2)a = (1, 2, 2) and b=(4,1,6)b = (4, 1, 6) in R3\mathrm{R}^3.

(a)5 points

Project bb onto the line through aa: find x^\hat x, the projection pp and the error e=b−pe = b - p. Give x^\hat x and the second entry of ee.

Hint

Two dot products give x^\hat x: one of aa with bb, one of aa with itself.

Hint

Then pp is x^\hat x times aa, and ee is what is left of bb. Check that ee is perpendicular to aa.

Solution

The idea. The error must be perpendicular to the line, and that one condition fixes x^\hat x.

The number x̂

aTb=4+2+12=18a^Tb = 4 + 2 + 12 = 18 and aTa=1+4+4=9a^Ta = 1 + 4 + 4 = 9, so

x̂ for the line
x^=aTbaTa=189=2,p=2a=(2,4,4),e=b−p=(2,−3,2)\hat x = \frac{a^Tb}{a^Ta} = \frac{18}{9} = 2, \qquad p = 2a = (2, 4, 4), \qquad e = b - p = (2, -3, 2)
In words

x hat equals a^ capital T b over the quantity a^ capital T a, equals 18 over 9 equals 2, p equals 2 a equals (2, 4, 4), e equals b minus p equals (2, minus 3, 2)

Source: 18.06 Lecture 15 transcript (Prof. Strang), pp. 2–3 (the method; the numbers are our own)

Check

aTe=2−6+4=0a^Te = 2 - 6 + 4 = 0: the error is perpendicular to aa. And ∥p∥2+∥e∥2=36+17=53=∥b∥2\|p\|^2 + \|e\|^2 = 36 + 17 = 53 = \|b\|^2, the right triangle of the lecture's picture.

(b)6 points

Write the projection matrix PP onto the line through aa. Give its entry in row 2, column 3 and its entry in row 1, column 1. Then find PwPw for w=(2,−1,0)w = (2, -1, 0).

Hint

aaTaa^T is a column times a row: its entry in row ii, column jj is the ii-th entry of aa times the jj-th. Do not forget the division.

Hint

For PwPw, look at aTwa^Tw before multiplying out.

Solution

The idea. P=aaT/aTaP = aa^T/a^Ta is a rank-one matrix, and it sends every vector to a multiple of aa.

The matrix

P for the line through a
P=aaTaTa=19(122244244)P = \frac{aa^T}{a^Ta} = \frac19\begin{pmatrix} 1 & 2 & 2 \\ 2 & 4 & 4 \\ 2 & 4 & 4 \end{pmatrix}
In words

capital P equals a a^ capital T over the quantity a^ capital T a, equals one ninth 1 2 2; 2 4 4; 2 4 4

Source: 18.06 Lecture 15 transcript (Prof. Strang), pp. 4–5 (the method; the numbers are our own)

Row 2, column 3 is 4/9≈0.44444/9 \approx 0.4444, and row 1, column 1 is 1/9≈0.11111/9 \approx 0.1111.

Pw

aTw=2−2+0=0a^Tw = 2 - 2 + 0 = 0, so Pw=a (aTw)/aTa=0Pw = a\,(a^Tw)/a^Ta = 0: ww is perpendicular to the line, and its projection is the zero vector.

Check

Pb=a (aTb)/9=2a=(2,4,4)Pb = a\,(a^Tb)/9 = 2a = (2, 4, 4), the pp of part (a). PP is symmetric, every column is a multiple of aa (rank one), and the diagonal adds to (1+4+4)/9=1(1 + 4 + 4)/9 = 1.

(c)3 points

Show, without multiplying out the 3×33 \times 3 matrices, that P2=PP^2 = P for the PP of part (b). Show also that the line through −3a-3a has the same projection matrix.

This part has no answer box. Write your argument, then open the solution and mark yourself.

Hint

In P2=aaTaTaaaTaTaP^2 = \frac{aa^T}{a^Ta}\frac{aa^T}{a^Ta}, group the middle aTaa^Ta together: it is a number.

Solution

The idea. A row times a column in the middle of a product is a number, and it cancels.

P squared

P² = P for a line
P2=a (aTa) aT(aTa)2=aaTaTa=PP^2 = \frac{a\,(a^Ta)\,a^T}{(a^Ta)^2} = \frac{aa^T}{a^Ta} = P
In words

capital P squared equals a (a^ capital T a) a^ capital T over (a^ capital T a) squared equals a a^ capital T over the quantity a^ capital T a, equals capital P

Source: 18.06 Lecture 15 transcript (Prof. Strang), p. 7 (the property; the grouping is our own solution)

Projecting a second time leaves pp where it is: pp is already on the line.

The line through −3a

With −3a-3a in place of aa, the top becomes (−3a)(−3a)T=9aaT(-3a)(-3a)^T = 9aa^T and the bottom (−3a)T(−3a)=9aTa(-3a)^T(-3a) = 9a^Ta. The 99 cancels, so the matrix is the same PP: the line has not changed (Lecture 15 transcript, pp. 3–4).

Check

Numerically: P2P^2 has row 1, column 1 equal to (1⋅1+2⋅2+2⋅2)/81=9/81=1/9(1 \cdot 1 + 2 \cdot 2 + 2 \cdot 2)/81 = 9/81 = 1/9, the same entry as PP.

Problem 2#

Problem

Projecting onto a plane

18 points

The columns a1=(1,0,1)a_1 = (1, 0, 1) and a2=(0,1,2)a_2 = (0, 1, 2) of A=(100112)A = \begin{pmatrix} 1 & 0 \\ 0 & 1 \\ 1 & 2 \end{pmatrix} span a plane in R3\mathrm{R}^3. Take b=(0,−5,2)b = (0, -5, 2).

(a)7 points

Solve the normal equations for x^\hat x, then find p=Ax^p = A\hat x and the error e=b−pe = b - p. Give both entries of x^\hat x and the length squared ∥e∥2\|e\|^2.

Hint

The entries of ATAA^TA are the dot products of the columns with each other; the entries of ATbA^Tb are the dot products of the columns with bb.

Hint

The two normal equations form a 2×22 \times 2 system: eliminate one unknown.

Solution

The idea. The error is perpendicular to both columns, AT(b−Ax^)=0A^T(b - A\hat x) = 0, and that is a square system for x^\hat x.

The normal equations

The normal equations for the plane
ATA=(2225),ATb=(2−1):2x^1+2x^2=2,2x^1+5x^2=−1A^TA = \begin{pmatrix} 2 & 2 \\ 2 & 5 \end{pmatrix}, \quad A^Tb = \begin{pmatrix} 2 \\ -1 \end{pmatrix}: \qquad 2\hat x_1 + 2\hat x_2 = 2, \quad 2\hat x_1 + 5\hat x_2 = -1
In words

capital A ^ capital T capital A equals 2 2; 2 5, capital A ^ capital T b equals 2; minus 1 : 2 x one hat plus 2 x two hat equals 2, 2 x one hat plus 5 x two hat equals minus 1

Source: 18.06 Lecture 15 transcript (Prof. Strang), pp. 15–16 (the method; the numbers are our own)

Subtracting the first equation from the second leaves 3x^2=−33\hat x_2 = -3, so x^2=−1\hat x_2 = -1, and then x^1=1−x^2=2\hat x_1 = 1 - \hat x_2 = 2.

Projection and error

p=2a1−a2=(2,−1,0)p = 2a_1 - a_2 = (2, -1, 0) and e=b−p=(−2,−4,2)e = b - p = (-2, -4, 2), so ∥e∥2=4+16+4=24\|e\|^2 = 4 + 16 + 4 = 24.

Check

a1Te=−2+0+2=0a_1^Te = -2 + 0 + 2 = 0 and a2Te=0−4+4=0a_2^Te = 0 - 4 + 4 = 0: ee is perpendicular to the plane, so it lies in N(AT)N(A^T).

(b)7 points

Find the projection matrix PP onto the plane. Do it the short way: find a nonzero vector nn perpendicular to both columns, write the projection onto the line through nn, and use that the projection onto the plane is II minus that one. Give the entry of PP in row 1, column 1 and the entry in row 1, column 2.

Hint

nn solves ATn=0A^Tn = 0: two equations in three unknowns. Choose its last entry and solve for the other two.

Hint

The projection onto the line through nn is nnT/nTnnn^T/n^Tn. The plane and that line are perpendicular, so the two projections add up to II.

Solution

The idea. In R3\mathrm{R}^3 the space perpendicular to a plane is a line, and b=Pb+(I−P)bb = Pb + (I - P)b splits bb between the two.

The perpendicular line

ATn=0A^Tn = 0 says n1+n3=0n_1 + n_3 = 0 and n2+2n3=0n_2 + 2n_3 = 0. With n3=1n_3 = 1: n=(−1,−2,1)n = (-1, -2, 1), and nTn=6n^Tn = 6.

The matrix

P from the perpendicular line
P=I−nnTnTn=I−16(12−124−2−1−21)=16(5−21−222125)P = I - \frac{nn^T}{n^Tn} = I - \frac16\begin{pmatrix} 1 & 2 & -1 \\ 2 & 4 & -2 \\ -1 & -2 & 1 \end{pmatrix} = \frac16\begin{pmatrix} 5 & -2 & 1 \\ -2 & 2 & 2 \\ 1 & 2 & 5 \end{pmatrix}
In words

capital P equals capital I minus n n^ capital T over the quantity n^ capital T n, equals capital I minus one sixth 1 2 minus 1; 2 4 minus 2; minus 1 minus 2 1 equals one sixth 5 minus 2 1; minus 2 2 2; 1 2 5

Source: 18.06 Lecture 16 transcript (Prof. Strang), pp. 3–4 (I − P; the numbers are our own)

Row 1, column 1 is 5/6≈0.83335/6 \approx 0.8333 and row 1, column 2 is −2/6≈−0.3333-2/6 \approx -0.3333.

Check

The long way gives the same matrix: elimination gives (ATA)−1=16(5−2−22)(A^TA)^{-1} = \frac16\begin{pmatrix} 5 & -2 \\ -2 & 2 \end{pmatrix} (multiply back: (2225)\begin{pmatrix} 2 & 2 \\ 2 & 5 \end{pmatrix} times it is II), and A(ATA)−1ATA(A^TA)^{-1}A^T has row 1, column 1 equal to 5/65/6. Also Pb=16(0+10+2,0−10+4,0−10+10)=(2,−1,0)=pPb = \frac16(0 + 10 + 2, 0 - 10 + 4, 0 - 10 + 10) = (2, -1, 0) = p, and Pa1=a1Pa_1 = a_1, Pn=0Pn = 0.

(c)4 points

Show that pp really is the point of the plane closest to bb: for every xx,

The closest point
∥b−Ax∥2=∥b−Ax^∥2+∥A(x^−x)∥2\|b - Ax\|^2 = \|b - A\hat x\|^2 + \|A(\hat x - x)\|^2
In words

the norm of b minus capital A x squared equals the norm of b minus capital A x hat squared plus the norm of capital A the quantity x hat minus x, squared

Source: 18.06 Lecture 15 transcript (Prof. Strang), p. 1 (the closest point; the identity is our own solution)

so no AxAx is closer to bb than p=Ax^p = A\hat x.

This part has no answer box. Write your argument, then open the solution and mark yourself.

Hint

Write b−Ax=(b−Ax^)+A(x^−x)b - Ax = (b - A\hat x) + A(\hat x - x) and expand the length squared of a sum.

Hint

The cross term contains (A(x^−x))Te(A(\hat x - x))^Te. What do the normal equations say about ATeA^Te?

Solution

The idea. The error is perpendicular to the whole column space, so Pythagoras applies.

Expand

With e=b−Ax^e = b - A\hat x and v=A(x^−x)v = A(\hat x - x), ∥e+v∥2=∥e∥2+2vTe+∥v∥2\|e + v\|^2 = \|e\|^2 + 2v^Te + \|v\|^2. And vTe=(x^−x)TATe=0v^Te = (\hat x - x)^TA^Te = 0, because the normal equations say AT(b−Ax^)=0A^T(b - A\hat x) = 0 (Lecture 15 transcript, p. 13).

Conclude

So ∥b−Ax∥2=∥e∥2+∥v∥2≥∥e∥2\|b - Ax\|^2 = \|e\|^2 + \|v\|^2 \ge \|e\|^2, with equality only when A(x^−x)=0A(\hat x - x) = 0, that is (the columns being independent) only for x=x^x = \hat x.

Check

For x=(0,0)x = (0, 0): ∥b∥2=0+25+4=29\|b\|^2 = 0 + 25 + 4 = 29, and ∥e∥2+∥p∥2=24+5=29\|e\|^2 + \|p\|^2 = 24 + 5 = 29.

Problem 3#

Problem

The best straight line

20 points

Four measurements (t,b)(t, b) are (−1,0)(-1, 0), (0,1)(0, 1), (1,3)(1, 3) and (2,2)(2, 2). Fit them by a straight line b=C+Dtb = C + Dt in the least-squares sense.

(a)7 points

Write the four equations as Ax=bAx = b with x=(C,D)x = (C, D). Compute ATAA^TA and ATbA^Tb, and solve the normal equations. Give the entry of ATAA^TA in row 2, column 2, the second entry of ATbA^Tb, and the best CC and DD.

Hint

AA has a column of ones and a column of times. So ATAA^TA holds the number of points, the sum of the times and the sum of their squares; ATbA^Tb holds the sum of the bb's and the sum of the products tbtb.

Hint

Eliminate CC from the two normal equations to find DD first.

Solution

The idea. Four equations in two unknowns have no solution; the normal equations ATAx^=ATbA^TA\hat x = A^Tb give the best one.

The matrices

The four equations and their normal equations
A=(1−1101112),b=(0132),ATA=(4226),ATb=(67)A = \begin{pmatrix} 1 & -1 \\ 1 & 0 \\ 1 & 1 \\ 1 & 2 \end{pmatrix}, \quad b = \begin{pmatrix} 0 \\ 1 \\ 3 \\ 2 \end{pmatrix}, \qquad A^TA = \begin{pmatrix} 4 & 2 \\ 2 & 6 \end{pmatrix}, \quad A^Tb = \begin{pmatrix} 6 \\ 7 \end{pmatrix}
In words

capital A equals 1 minus 1; 1 0; 1 1; 1 2, b equals 0; 1; 3; 2, capital A ^ capital T capital A equals 4 2; 2 6, capital A ^ capital T b equals 6; 7

Source: 18.06 Lecture 16 transcript (Prof. Strang), pp. 4–5, 9–10 (the method; the numbers are our own)

The sum of the squared times is 1+0+1+4=61 + 0 + 1 + 4 = 6, and the sum of the products tbtb is 0+0+3+4=70 + 0 + 3 + 4 = 7.

Solve

The normal equations are 4C+2D=64C + 2D = 6 and 2C+6D=72C + 6D = 7. Twice the second minus the first gives 10D=810D = 8, so D=0.8D = 0.8, and then 4C=6−1.6=4.44C = 6 - 1.6 = 4.4, so C=1.1C = 1.1. The best line is b=1.1+0.8tb = 1.1 + 0.8t.

Check

Put the numbers back: 4(1.1)+2(0.8)=64(1.1) + 2(0.8) = 6 and 2(1.1)+6(0.8)=72(1.1) + 6(0.8) = 7. Part (b) checks that the errors are perpendicular to both columns.

(b)5 points

Find the heights pp of the best line at the four times and the errors e=b−pe = b - p. Give the error at t=2t = 2 and the total squared error ∥e∥2\|e\|^2.

Hint

p=Ax^p = A\hat x: put each time into C+DtC + Dt with the CC and DD of part (a).

Solution

The idea. b=p+eb = p + e with pp in the column space and ee perpendicular to it.

Heights and errors

Projection and error for the four points
p=Ax^=(0.31.11.92.7),e=b−p=(−0.3−0.11.1−0.7)p = A\hat x = \begin{pmatrix} 0.3 \\ 1.1 \\ 1.9 \\ 2.7 \end{pmatrix}, \qquad e = b - p = \begin{pmatrix} -0.3 \\ -0.1 \\ 1.1 \\ -0.7 \end{pmatrix}
In words

p equals capital A x hat equals 0.3; 1.1; 1.9; 2.7, e equals b minus p equals minus 0.3; minus 0.1; 1.1; minus 0.7

Source: 18.06 Lecture 16 transcript (Prof. Strang), pp. 12–13 (the method; the numbers are our own)

The error at t=2t = 2 is 2−2.7=−0.72 - 2.7 = -0.7, and ∥e∥2=0.09+0.01+1.21+0.49=1.8\|e\|^2 = 0.09 + 0.01 + 1.21 + 0.49 = 1.8.

Check

ee is perpendicular to the column of ones, −0.3−0.1+1.1−0.7=0-0.3 - 0.1 + 1.1 - 0.7 = 0, and to the column of times, 0.3+0+1.1−1.4=00.3 + 0 + 1.1 - 1.4 = 0, as in the lecture's example (Lecture 16 transcript, pp. 13–14).

(c)5 points

Now suppose the last measurement had been β\beta instead of 22, with the other three unchanged. Find the best slope DD as a formula in β\beta. Then take the outlier β=12\beta = 12 and give the error of the new best line at t=2t = 2.

Hint

Only ATbA^Tb changes: its entries become the sum of the bb's and the sum of the products tbtb, now with β\beta in them. ATAA^TA is the same as in part (a).

Hint

Solve the same way as in part (a). For the error at t=2t = 2, you also need CC for β=12\beta = 12.

Solution

The idea. A change in bb changes only the right-hand side of the normal equations; the matrix ATAA^TA stays.

The new normal equations

Now ATb=(0+1+3+β,  0+0+3+2β)=(4+β,3+2β)A^Tb = (0 + 1 + 3 + \beta,\; 0 + 0 + 3 + 2\beta) = (4 + \beta, 3 + 2\beta):

Normal equations with an outlier
4C+2D=4+β,2C+6D=3+2β4C + 2D = 4 + \beta, \qquad 2C + 6D = 3 + 2\beta
In words

4 capital C plus 2 capital D equals 4 plus beta, 2 capital C plus 6 capital D equals 3 plus 2 beta

Source: 18.06 Lecture 16 transcript (Prof. Strang), pp. 9–11 (the method; the numbers are our own)

Twice the second minus the first: 10D=2+3β10D = 2 + 3\beta, so D=(2+3β)/10D = (2 + 3\beta)/10; then C=(4+β−2D)/4=(9+β)/10C = (4 + \beta - 2D)/4 = (9 + \beta)/10.

The outlier

For β=12\beta = 12: D=3.8D = 3.8 and C=2.1C = 2.1. The line gives 2.1+2(3.8)=9.72.1 + 2(3.8) = 9.7 at t=2t = 2, so the error there is 12−9.7=2.312 - 9.7 = 2.3. The point moved up by 1010, but its error grew only from −0.7-0.7 to 2.32.3: the line itself tilted to follow the outlier, the slope going from 0.80.8 to 3.83.8. This is the worry about outliers in the lecture (Lecture 16 transcript, pp. 7–8).

Check

At β=2\beta = 2 the formulas give D=0.8D = 0.8 and C=1.1C = 1.1, the line of part (a). For β=12\beta = 12 the line 2.1+3.8t2.1 + 3.8t gives the heights (−1.7,2.1,5.9,9.7)(-1.7, 2.1, 5.9, 9.7) and the errors (1.7,−1.1,−2.9,2.3)(1.7, -1.1, -2.9, 2.3): they add to zero, and so do the errors times the times, −1.7+0−2.9+4.6=0-1.7 + 0 - 2.9 + 4.6 = 0.

(d)3 points

Show that for every least-squares line C+DtC + Dt, through any number of points, the errors add up to zero, and so do the errors each multiplied by its time tt.

This part has no answer box. Write your argument, then open the solution and mark yourself.

Hint

What do the normal equations AT(b−Ax^)=0A^T(b - A\hat x) = 0 say, one row of ATA^T at a time?

Solution

The idea. The normal equations say that ee is perpendicular to each column of AA.

Row by row

The rows of ATA^T are the columns of AA: all ones, and the times. So ATe=0A^Te = 0 says

The errors are perpendicular to the columns
(1,1,…,1) e=0,(t1,t2,…,tm) e=0(1, 1, \dots, 1)\,e = 0, \qquad (t_1, t_2, \dots, t_m)\,e = 0
In words

(1, 1, and so on, 1) e equals 0, ( t one, t two, and so on, t sub m ) e equals 0

Source: 18.06 Lecture 16 transcript (Prof. Strang), pp. 13–14 (the perpendicular error; the general form is our own solution)

The first is the sum of the errors, the second the sum of the errors times their times.

Check

Part (b) found both sums zero for the four points.

Problem 4#

Problem

The other projection and a reflection

16 points

Let PP be the projection matrix onto the line through a=(3,4)a = (3, 4) in R2\mathrm{R}^2.

(a)4 points

Find I−PI - P. Which line does I−PI - P project onto? Give the entry of I−PI - P in row 1, column 2.

Hint

aTa=25a^Ta = 25. I−PI - P keeps the part of a vector that PP removes, the part perpendicular to aa.

Solution

The idea. b=Pb+(I−P)bb = Pb + (I - P)b: the second part is the error, perpendicular to aa.

The matrices

P and I − P for the line through (3, 4)
P=125(9121216),I−P=125(16−12−129)P = \frac{1}{25}\begin{pmatrix} 9 & 12 \\ 12 & 16 \end{pmatrix}, \qquad I - P = \frac{1}{25}\begin{pmatrix} 16 & -12 \\ -12 & 9 \end{pmatrix}
In words

capital P equals 1 over 25 9 12; 12 16, capital I minus capital P equals 1 over 25 16 minus 12; minus 12 9

Source: 18.06 Lecture 16 transcript (Prof. Strang), pp. 3–4 (I − P; the numbers are our own)

Row 1, column 2 of I−PI - P is −12/25=−0.48-12/25 = -0.48.

The line

I−PI - P is nnT/nTnnn^T/n^Tn for n=(−4,3)n = (-4, 3): nnT=(16−12−129)nn^T = \begin{pmatrix} 16 & -12 \\ -12 & 9 \end{pmatrix} and nTn=25n^Tn = 25. And aTn=−12+12=0a^Tn = -12 + 12 = 0, so it is the line perpendicular to aa.

Check

(I−P)a=125(48−48,−36+36)=0(I - P)a = \frac1{25}(48 - 48, -36 + 36) = 0 and (I−P)n=n(I - P)n = n. The line through (4,3)(4, 3) is not perpendicular to aa: 12+12≠012 + 12 \neq 0.

(b)6 points

The matrix R=2P−IR = 2P - I reflects every vector across the line through aa. Give its entry in row 1, column 2, and the second entry of RwRw for w=(1,2)w = (1, 2). Then take the line through (1,m)(1, m) instead, for a number m>0m > 0, and give the entry of its R=2P−IR = 2P - I in row 1, column 2 as a formula in mm.

Hint

Write w=Pw+(I−P)ww = Pw + (I - P)w. Then Rw=2Pw−wRw = 2Pw - w keeps the part along the line and reverses the other part.

Hint

For the line through (1,m)(1, m), the dot product of the vector with itself is 1+m21 + m^2. The −I-I in RR changes only the diagonal.

Solution

The idea. R=P−(I−P)R = P - (I - P): keep the projection, reverse the error.

The reflection

The reflection across the line through (3, 4)
R=2P−I=125(18−25242432−25)=125(−724247)R = 2P - I = \frac{1}{25}\begin{pmatrix} 18 - 25 & 24 \\ 24 & 32 - 25 \end{pmatrix} = \frac{1}{25}\begin{pmatrix} -7 & 24 \\ 24 & 7 \end{pmatrix}
In words

capital R equals 2 capital P minus capital I equals 1 over 25 18 minus 25 24; 24 32 minus 25 equals 1 over 25 minus 7 24; 24 7

Source: 18.06 Lecture 16 transcript (Prof. Strang), pp. 3–4 (b = p + e; the reflection is our own solution)

Row 1, column 2 is 24/25=0.9624/25 = 0.96, and Rw=125(−7+48,24+14)=(1.64,1.52)Rw = \frac1{25}(-7 + 48, 24 + 14) = (1.64, 1.52).

A general line

With a=(1,m)a = (1, m), P=11+m2(1mmm2)P = \frac{1}{1 + m^2}\begin{pmatrix} 1 & m \\ m & m^2 \end{pmatrix}, so row 1, column 2 of R=2P−IR = 2P - I is 2m/(1+m2)2m/(1 + m^2).

Check

The line through (3,4)(3, 4) is the line through (1,4/3)(1, 4/3), and 2(4/3)/(1+16/9)=(8/3)/(25/9)=24/252(4/3)/(1 + 16/9) = (8/3)/(25/9) = 24/25. Lengths stay: ∥Rw∥2=1.642+1.522=2.6896+2.3104=5=∥w∥2\|Rw\|^2 = 1.64^2 + 1.52^2 = 2.6896 + 2.3104 = 5 = \|w\|^2. And Ra=2a−a=aRa = 2a - a = a: the line itself does not move.

(c)3 points

Show that for every projection matrix PP the matrix R=2P−IR = 2P - I satisfies RT=RR^T = R and R2=IR^2 = I, and conclude that RR is an orthogonal matrix.

This part has no answer box. Write your argument, then open the solution and mark yourself.

Hint

Use only PT=PP^T = P and P2=PP^2 = P. Expand (2P−I)(2P−I)(2P - I)(2P - I).

Solution

The idea. The two properties of a projection are all that is needed.

Symmetric

RT=2PT−I=2P−I=RR^T = 2P^T - I = 2P - I = R.

Its square

Reflecting twice
R2=4P2−4P+I=4P−4P+I=IR^2 = 4P^2 - 4P + I = 4P - 4P + I = I
In words

capital R squared equals 4 capital P squared minus 4 capital P plus capital I equals 4 capital P minus 4 capital P plus capital I equals capital I

Source: 18.06 Lecture 15 transcript (Prof. Strang), p. 7 (P² = P; the reflection is our own solution)

Orthogonal

So RTR=R2=IR^TR = R^2 = I: the columns of RR are orthonormal and RR is square, which makes it an orthogonal matrix with R−1=RT=RR^{-1} = R^T = R (Lecture 17 transcript, pp. 3–4). Reflecting twice brings every vector back.

Check

For part (b), the columns (−7,24)/25(-7, 24)/25 and (24,7)/25(24, 7)/25 have length 49+576/25=1\sqrt{49 + 576}/25 = 1 and dot product (−168+168)/625=0(-168 + 168)/625 = 0.

(d)3 points

Let AA be the 3×23 \times 2 matrix with columns (1,1,1)(1, 1, 1) and (1,c,c2)(1, c, c^2), for a number cc. For which cc is ATAA^TA invertible?

Hint

ATAA^TA is invertible exactly when the columns of AA are independent. When is the second column a multiple of the first?

Solution

The idea. Independent columns make ATAA^TA invertible, and dependent columns make it singular.

Independence

Two nonzero columns are dependent only when one is a multiple of the other. (1,c,c2)(1, c, c^2) is a multiple of (1,1,1)(1, 1, 1) only if its three entries are equal: c=1c = 1 and c2=1c^2 = 1, so c=1c = 1. For every other cc the columns are independent and ATAA^TA is invertible (Lecture 16 transcript, pp. 15–17).

The case c=1c = 1

Then x=(1,−1)x = (1, -1) gives Ax=0Ax = 0 and so ATAx=0A^TAx = 0 with x≠0x \neq 0: ATAA^TA is not invertible.

Check

For c=0c = 0 the columns (1,1,1)(1, 1, 1) and (1,0,0)(1, 0, 0) are independent; for c=−1c = -1 the columns (1,1,1)(1, 1, 1) and (1,−1,1)(1, -1, 1) are too. At c=1c = 1, ATA=(3333)A^TA = \begin{pmatrix} 3 & 3 \\ 3 & 3 \end{pmatrix}, whose second row is the first again.

Problem 5#

Problem

Gram–Schmidt and A = QR

18 points

Apply Gram–Schmidt to the columns a=(1,1,1,1)a = (1, 1, 1, 1), b=(1,3,1,3)b = (1, 3, 1, 3) and c=(2,2,0,4)c = (2, 2, 0, 4) of the 4×34 \times 3 matrix MM. As in the lecture, AA, BB and CC are the orthogonal vectors before they are divided by their lengths. (The matrix is called MM here because the letter AA is taken by the first of those vectors.)

(a)7 points

Find AA, BB and CC, and the orthonormal vectors q1,q2,q3q_1, q_2, q_3. Give the first entry of BB, the fourth entry of CC, and the length ∥C∥\|C\|.

Hint

A=aA = a. For BB, subtract from bb its projection onto AA. For CC, subtract from cc its projections onto AA and onto BB, using the BB you found.

Hint

Check each new vector by its dot products with the earlier ones: they must be zero.

Solution

The idea. Each new vector loses its components along the directions already chosen; what is left is perpendicular to them.

A and B

A=(1,1,1,1)A = (1, 1, 1, 1) and ATA=4A^TA = 4. ATb=8A^Tb = 8, so

The second orthogonal vector
B=b−ATbATAA=(1,3,1,3)−2(1,1,1,1)=(−1,1,−1,1)B = b - \frac{A^Tb}{A^TA}A = (1, 3, 1, 3) - 2(1, 1, 1, 1) = (-1, 1, -1, 1)
In words

capital B equals b minus capital A ^ capital T b over the quantity capital A ^ capital T capital A, times capital A equals (1, 3, 1, 3) minus 2(1, 1, 1, 1) equals (-1, 1, minus 1, 1)

Source: 18.06 Lecture 17 transcript (Prof. Strang), pp. 15–16 (the method; the numbers are our own)

C

ATc=8A^Tc = 8, so the coefficient of AA is 8/4=28/4 = 2; BTc=−2+2−0+4=4B^Tc = -2 + 2 - 0 + 4 = 4 and BTB=4B^TB = 4, so the coefficient of BB is 11:

The third orthogonal vector
C=c−ATcATAA−BTcBTBB=(2,2,0,4)−(2,2,2,2)−(−1,1,−1,1)=(1,−1,−1,1)C = c - \frac{A^Tc}{A^TA}A - \frac{B^Tc}{B^TB}B = (2, 2, 0, 4) - (2, 2, 2, 2) - (-1, 1, -1, 1) = (1, -1, -1, 1)
In words

capital C equals c minus capital A ^ capital T c over the quantity capital A ^ capital T capital A, times capital A minus capital B ^ capital T c over the quantity capital B ^ capital T capital B, times capital B equals (2, 2, 0, 4) minus (2, 2, 2, 2) minus (-1, 1, minus 1, 1) equals (1, minus 1, minus 1, 1)

Source: 18.06 Lecture 17 transcript (Prof. Strang), pp. 17–18 (the method; the numbers are our own)

Normalize

All three vectors have length 4=2\sqrt4 = 2, so q1=12(1,1,1,1)q_1 = \frac12(1, 1, 1, 1), q2=12(−1,1,−1,1)q_2 = \frac12(-1, 1, -1, 1), q3=12(1,−1,−1,1)q_3 = \frac12(1, -1, -1, 1).

Check

ATC=1−1−1+1=0A^TC = 1 - 1 - 1 + 1 = 0 and BTC=−1−1+1+1=0B^TC = -1 - 1 + 1 + 1 = 0. C≠0C \neq 0, as it must be for independent a,b,ca, b, c.

(b)5 points

Write M=QRM = QR with Q=[ q1    q2    q3 ]Q = [\,q_1\;\;q_2\;\;q_3\,] and RR upper triangular. Give the entry of RR in row 1, column 2 and the entry in row 2, column 3.

Hint

Since QTQ=IQ^TQ = I, multiplying M=QRM = QR on the left by QTQ^T gives R=QTMR = Q^TM: each entry is a dot product of a qq with a column of MM.

Solution

The idea. Column jj of MM is a combination of q1,…,qjq_1, \dots, q_j only, and the coefficients are the dot products.

The entries

R for this matrix
R=QTM=(q1Taq1Tbq1Tc0q2Tbq2Tc00q3Tc)=(244022002)R = Q^TM = \begin{pmatrix} q_1^Ta & q_1^Tb & q_1^Tc \\ 0 & q_2^Tb & q_2^Tc \\ 0 & 0 & q_3^Tc \end{pmatrix} = \begin{pmatrix} 2 & 4 & 4 \\ 0 & 2 & 2 \\ 0 & 0 & 2 \end{pmatrix}
In words

capital R equals capital Q ^ capital T capital M equals q one ^ capital T a q one ^ capital T b q one ^ capital T c; 0 q two ^ capital T b q two ^ capital T c; 0 0 q three ^ capital T c equals 2 4 4; 0 2 2; 0 0 2

Source: 18.06 Lecture 17 transcript (Prof. Strang), pp. 23–24 (the method; the numbers are our own)

For instance q1Tb=12(1+3+1+3)=4q_1^Tb = \frac12(1 + 3 + 1 + 3) = 4 and q2Tc=12(−2+2−0+4)=2q_2^Tc = \frac12(-2 + 2 - 0 + 4) = 2. The zeros below the diagonal are there because aa is along q1q_1 and bb is a combination of q1q_1 and q2q_2, both perpendicular to the later qq's.

Check

Column 3 of QRQR is 4q1+2q2+2q3=(2,2,2,2)+(−1,1,−1,1)+(1,−1,−1,1)=(2,2,0,4)=c4q_1 + 2q_2 + 2q_3 = (2, 2, 2, 2) + (-1, 1, -1, 1) + (1, -1, -1, 1) = (2, 2, 0, 4) = c. Column 2 is 4q1+2q2=(2,2,2,2)+(−1,1,−1,1)=(1,3,1,3)=b4q_1 + 2q_2 = (2, 2, 2, 2) + (-1, 1, -1, 1) = (1, 3, 1, 3) = b.

(c)6 points

Project d=(1,2,3,4)d = (1, 2, 3, 4) onto the column space of MM, using q1,q2,q3q_1, q_2, q_3: the coefficients are x^i=qiTd\hat x_i = q_i^Td. Give q2Tdq_2^Td, the fourth entry of the projection pp, and ∥d−p∥2\|d - p\|^2.

Hint

p=(q1Td) q1+(q2Td) q2+(q3Td) q3p = (q_1^Td)\,q_1 + (q_2^Td)\,q_2 + (q_3^Td)\,q_3. No system needs to be solved.

Solution

The idea. With orthonormal columns, QTQ=IQ^TQ = I and the normal equations become x^=QTd\hat x = Q^Td.

The coefficients

Components by dot products
x^=QTd=12(1+2+3+4−1+2−3+41−2−3+4)=(510)\hat x = Q^Td = \tfrac12\begin{pmatrix} 1 + 2 + 3 + 4 \\ -1 + 2 - 3 + 4 \\ 1 - 2 - 3 + 4 \end{pmatrix} = \begin{pmatrix} 5 \\ 1 \\ 0 \end{pmatrix}
In words

x hat equals capital Q ^ capital T d equals one half 1 plus 2 plus 3 plus 4; minus 1 plus 2 minus 3 plus 4; 1 minus 2 minus 3 plus 4 equals 5; 1; 0

Source: 18.06 Lecture 17 transcript (Prof. Strang), p. 11 (the method; the numbers are our own)

The projection

p=5q1+q2+0 q3=(2.5,2.5,2.5,2.5)+(−0.5,0.5,−0.5,0.5)=(2,3,2,3)p = 5q_1 + q_2 + 0\,q_3 = (2.5, 2.5, 2.5, 2.5) + (-0.5, 0.5, -0.5, 0.5) = (2, 3, 2, 3). Then d−p=(−1,−1,1,1)d - p = (-1, -1, 1, 1) and ∥d−p∥2=4\|d - p\|^2 = 4.

Check

d−pd - p is perpendicular to all three qq's: −1−1+1+1=0-1 - 1 + 1 + 1 = 0, 1−1−1+1=01 - 1 - 1 + 1 = 0 and −1+1−1+1=0-1 + 1 - 1 + 1 = 0 (times 12\frac12). The same pp comes from P=QQTP = QQ^T applied to dd, without any inverse (Lecture 17 transcript, p. 9).

Problem 6#

Problem

An orthogonal matrix

14 points

Take Q=17(26332−66−32)Q = \frac17\begin{pmatrix} 2 & 6 & 3 \\ 3 & 2 & -6 \\ 6 & -3 & 2 \end{pmatrix}.

(a)4 points

Check that the columns of QQ are orthonormal (this check has no box). Then give the entry of Q−1Q^{-1} in row 1, column 2.

Hint

Each column has entries that are sevenths: add their squares. For the dot products, multiply two columns entry by entry.

Hint

For a square matrix with orthonormal columns, the inverse needs no elimination.

Solution

The idea. QTQ=IQ^TQ = I collects all the dot products of the columns; for a square QQ it makes QTQ^T the inverse.

Orthonormal

Each column has 4+9+36=494 + 9 + 36 = 49 as the sum of the squares of its entries, before the factor 1/491/49: length 11. The dot products: columns 1 and 2, 12+6−18=012 + 6 - 18 = 0; columns 1 and 3, 6−18+12=06 - 18 + 12 = 0; columns 2 and 3, 18−12−6=018 - 12 - 6 = 0.

The inverse

The inverse of an orthogonal matrix
Q−1=QT=17(23662−33−62)Q^{-1} = Q^T = \frac17\begin{pmatrix} 2 & 3 & 6 \\ 6 & 2 & -3 \\ 3 & -6 & 2 \end{pmatrix}
In words

capital Q to the power minus 1 equals capital Q ^ capital T equals one seventh 2 3 6; 6 2 minus 3; 3 minus 6 2

Source: 18.06 Lecture 17 transcript (Prof. Strang), p. 4 (the rule; the numbers are our own)

Row 1, column 2 of Q−1Q^{-1} is row 2, column 1 of QQ: 3/7≈0.42863/7 \approx 0.4286.

Check

Row 1 of QTQ^T times column 2 of QQ is 149(2⋅6+3⋅2+6⋅(−3))=0\frac1{49}(2 \cdot 6 + 3 \cdot 2 + 6 \cdot (-3)) = 0, and row 1 times column 1 is 49/49=149/49 = 1, as QTQ=IQ^TQ = I needs. Row 1, column 2 of QQ itself, 6/76/7, is a different number: QQ is not symmetric.

(b)4 points

Solve Qx=(0,7,0)Qx = (0, 7, 0). Give the third entry of xx.

Hint

Multiply both sides by Q−1Q^{-1}, which you found in part (a) without any work.

Solution

The idea. x=QTbx = Q^Tb: one matrix times a vector, no elimination.

Solve

x=QT(0,7,0)x = Q^T(0, 7, 0) is 77 times column 2 of QTQ^T, which is 77 times row 2 of QQ: x=(3,2,−6)x = (3, 2, -6).

Check

Qx=17(6+12−18,9+4+36,18−6−12)=(0,7,0)Qx = \frac17(6 + 12 - 18, 9 + 4 + 36, 18 - 6 - 12) = (0, 7, 0). And ∥x∥2=9+4+36=49=∥(0,7,0)∥2\|x\|^2 = 9 + 4 + 36 = 49 = \|(0, 7, 0)\|^2: part (c) explains why the lengths agree.

(c)3 points

Show that every orthogonal matrix keeps lengths: ∥Qx∥=∥x∥\|Qx\| = \|x\| for every vector xx.

This part has no answer box. Write your argument, then open the solution and mark yourself.

Hint

Write the length squared as a vector's transpose times the vector, and use (Qx)T=xTQT(Qx)^T = x^TQ^T.

Solution

The idea. QTQ=IQ^TQ = I sits in the middle of ∥Qx∥2\|Qx\|^2.

The length

Orthogonal matrices keep lengths
∥Qx∥2=(Qx)T(Qx)=xTQTQx=xTx=∥x∥2\|Qx\|^2 = (Qx)^T(Qx) = x^TQ^TQx = x^Tx = \|x\|^2
In words

the norm of capital Q x squared equals ( capital Q x)^ capital T ( capital Q x) equals x^ capital T capital Q ^ capital T capital Q x equals x^ capital T x equals the norm of x squared

Source: 18.06 Lecture 17 transcript (Prof. Strang), pp. 2–3 (QᵀQ = I; the length rule is our own solution)

Both lengths are positive or zero, so ∥Qx∥=∥x∥\|Qx\| = \|x\|. Only QTQ=IQ^TQ = I was used, so this holds for orthonormal columns in a rectangular QQ too.

Check

With y=(1,1,1)y = (1, 1, 1): Qy=17(11,−1,5)Qy = \frac17(11, -1, 5) and ∥Qy∥2=(121+1+25)/49=147/49=3=∥y∥2\|Qy\|^2 = (121 + 1 + 25)/49 = 147/49 = 3 = \|y\|^2.

(d)3 points

Which of these are orthogonal matrices?

Three candidates
M1=(0.60.80.8−0.6),M2=12(111−1),M3=13(21122−2)M_1 = \begin{pmatrix} 0.6 & 0.8 \\ 0.8 & -0.6 \end{pmatrix}, \qquad M_2 = \frac12\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad M_3 = \frac13\begin{pmatrix} 2 & 1 \\ 1 & 2 \\ 2 & -2 \end{pmatrix}
In words

capital M sub 1 equals 0.6 0.8; 0.8 minus 0.6, capital M sub 2 equals one half 1 1; 1 minus 1, capital M sub 3 equals one third 2 1; 1 2; 2 minus 2

Source: 18.06 Lecture 17 transcript (Prof. Strang), pp. 3–5 (the definition; the matrices are our own)
Hint

An orthogonal matrix is square and has orthonormal columns. Compute MTMM^TM for each.

Solution

The idea. Check the two conditions: square, and MTM=IM^TM = I.

Each matrix

M1M_1: columns of length 0.36+0.64=1\sqrt{0.36 + 0.64} = 1 and dot product 0.48−0.48=00.48 - 0.48 = 0, and it is square: orthogonal. M2M_2: the columns are perpendicular but of length 1/4+1/4=1/2\sqrt{1/4 + 1/4} = 1/\sqrt2, so M2TM2=12IM_2^TM_2 = \frac12I: not orthogonal (it would need the factor 1/21/\sqrt2, Lecture 17 transcript, p. 5). M3M_3: the columns have length 4+1+4/3=1\sqrt{4 + 1 + 4}/3 = 1 and dot product (2+2−4)/9=0(2 + 2 - 4)/9 = 0, so M3TM3=IM_3^TM_3 = I, but it is 3×23 \times 2, not square: it has orthonormal columns, and M3M3TM_3M_3^T is a projection onto a plane, not II.

Check

M1M_1 is a reflection like the RR of Problem 4: it is symmetric with M12=IM_1^2 = I.

Symbols on this page

Show the 55 symbols used here
β\beta beta.
The changed value of the last measurement in Problem 3(c), at t = 2. Say it: “beta” (sounds like “bay-ta or bee-ta”).
≈\approx approximately equal.
Is approximately equal to. Say it: “is approximately”.
≥\ge greater than or equal.
Is greater than or equal to. Say it: “is greater than or equal to”.
≠\neq not equal.
Is not equal to. Say it: “is not equal to”.
⇒\Rightarrow implies.
Implies: what follows is a consequence of what came before. Say it: “which gives”.
×\times times.
Times (multiplication). Between two vectors: the cross product. Say it: “times”.
⋅\cdot dot.
Times (multiplication). Between two vectors: the dot product. Say it: “times”.
ı^\hat\imath hat.
A unit vector: a vector of length 1 that only gives a direction (î, r̂). Say it: “hat”.
aa a.
A vector that spans a line (Problems 1 and 4); in Problem 5 the first column of M, a = (1, 1, 1, 1). Say it: “a”.
cc c.
A number in the second column (1, c, c²) of Problem 4(d); in Problem 5 the third column of M. Say it: “c”.
TT T.
As a superscript, the transpose: rows become columns (aᵀb is the dot product of a and b). Say it: “capital T”.
xx x.
The unknown vector of Ax = b or Qx = b; x̂ (with a hat) is the best choice, the least-squares solution. Say it: “x”.
yy y.
The test vector (1, 1, 1) of Problem 6(c). Say it: “y”.
tt t.
The time of a measurement, the variable of the line C + Dt. Say it: “t”.
dd d.
The vector (1, 2, 3, 4) projected in Problem 5(c). Say it: “d”.
ii i.
A row number, or the index of an orthonormal vector. Say it: “i”.
jj j.
A column number, or the index of an orthonormal vector. Say it: “j”.
nn n.
In Problem 2, a nonzero vector perpendicular to the plane; elsewhere the number of orthonormal vectors. Say it: “n”.
ee e.
The error e = b − p, the part of b perpendicular to the line, plane or column space. Say it: “e”.
mm m.
In Problem 4(b), the slope of the line through (1, m); in Problem 3(d), the number of measurements. Say it: “m”.
vv v.
In Problem 2(c), the vector A(x̂ − x). Say it: “v”.
PP P.
A projection matrix: Pb is the projection of b. Say it: “capital P”.
QQ Q.
A matrix with orthonormal columns; in Problem 6 a square one, an orthogonal matrix. Say it: “capital Q”.
DD D.
The slope of the fitted line C + Dt. Say it: “capital D”.
AA A.
The matrix whose columns span the subspace; in Problem 5 (Gram–Schmidt) the first orthogonal vector, A = a. Say it: “capital A”.
BB B.
In Problem 5, the second orthogonal vector of Gram–Schmidt, before it is divided by its length. Say it: “capital B”.
CC C.
The intercept of the fitted line C + Dt (Problem 3); in Problem 5 the third orthogonal vector of Gram–Schmidt. Say it: “capital C”.
bb b.
The vector being projected or the right-hand side of Ax = b; in Problem 3 the measured values, and in Problem 5 the second column of M. Say it: “b”.
qq q.
One of the orthonormal vectors q₁, q₂, q₃. Say it: “q”.
NN N.
N(Aᵀ) is the nullspace of Aᵀ: all vectors perpendicular to the column space of A. Say it: “capital N”.
pp p.
The projection of b (or of d): the point of the line, plane or column space closest to it. Say it: “p”.
MM M.
The 4 × 3 matrix of Problem 5, with columns a, b, c. Say it: “capital M”.
RR R.
The upper triangular matrix of M = QR (Problem 5); in Problem 4 the reflection R = 2P − I. Say it: “capital R”.
t1t_{1} t one.
The time of the first measurement. Say it: “t one”.
t2t_{2} t two.
The time of the second measurement. Say it: “t two”.
a1a_{1} a one.
The first column of A in Problem 2. Say it: “a one”.
a2a_{2} a two.
The second column of A in Problem 2. Say it: “a two”.
ww w.
A second vector, projected (Problem 1) or reflected (Problem 4). Say it: “w”.
x1x_{1} x 1.
The first entry of x̂ (the coefficient of the first column). Say it: “x one”.
x2x_{2} x 2.
The second entry of x̂ (the coefficient of the second column). Say it: “x two”.
M1M_{1} M one.
The first candidate matrix of Problem 6(d). Say it: “capital M sub 1”.
M2M_{2} M two.
The second candidate matrix of Problem 6(d). Say it: “capital M sub 2”.
II I.
The identity matrix. Say it: “capital I”.
xix_{i} x i.
The i-th entry of x̂, the coefficient along the i-th orthonormal vector. Say it: “x sub i”.
q1q_{1} q one.
The first orthonormal vector, A divided by its length. Say it: “q one”.
q2q_{2} q two.
The second orthonormal vector, B divided by its length. Say it: “q two”.
qiq_{i} q sub i.
The i-th orthonormal vector, the i-th column of Q. Say it: “q sub i”.
qjq_{j} q sub j.
The j-th orthonormal vector. Say it: “q sub j”.
q3q_{3} q three.
The third orthonormal vector, C divided by its length. Say it: “q three”.
qnq_{n} q n.
The last orthonormal vector of the list. Say it: “q n”.
n1n_{1} n 1.
The first entry of the vector n. Say it: “n one”.
n2n_{2} n 2.
The second entry of the vector n. Say it: “n two”.
n3n_{3} n 3.
The third entry of the vector n. Say it: “n three”.
tmt_{m} t sub m.
The time of the last of m measurements. Say it: “t sub m”.
M3M_{3} M three.
The third candidate matrix of Problem 6(d). Say it: “capital M sub 3”.

Tap or click a symbol in a formula to see the same explanation. All symbols: symbols and notation.

Words on this page

Show the 38 words used here

Also used

projection.
The shadow of a vector on a line or plane: the nearest point to it there, found by dropping a perpendicular. Explained in Projections onto subspaces.
subspace.
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.
projection matrix.
A matrix that sends every vector to its projection onto a fixed line, plane or subspace. Explained in Projection matrices and least squares.
least squares.
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.
orthogonal matrix.
A square matrix whose columns are perpendicular unit vectors; it rotates or reflects without changing lengths, and its inverse is its transpose. Explained in Orthogonal matrices and Gram–Schmidt.
Gram–Schmidt.
A step-by-step method that turns independent vectors into perpendicular unit vectors that span the same space. Explained in Orthogonal matrices and Gram–Schmidt.
orthogonal.
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.
determinant.
A single number worked out from a square array of numbers (a matrix), which measures how the matrix stretches areas or volumes. Explained in Determinants and the cross product.
MIT.
Massachusetts Institute of Technology: the university in Cambridge, USA, whose free courses this site rewrites.
matrix.
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.
vector.
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.
perpendicular.
At right angles to a line, a surface or another direction. Explained in Inclined planes.
basis.
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.
normal equations.
The equations whose solution gives the least-squares best fit, found by making the error perpendicular to every column.
column space.
All the vectors made by combining the columns of a matrix; Ax = b can be solved exactly when b lies in it. Explained in Matrix multiplication and inverse matrices.
p..
Page, in a reference to a source; pp. means pages, as in pp. 3–5.
invertible.
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.
orthonormal.
Of a set of vectors: each has length one and each is at right angles to all the others. Explained in Projection matrices and least squares.
inverse.
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.
dot product.
A way of multiplying two vectors that gives a number: multiply matching components and add, or lengths times the cosine of the angle between them. Explained in Vectors and the dot product.
triangular matrix.
A square matrix with only zeros below its diagonal (upper triangular) or only zeros above it (lower triangular). Explained in Elimination with matrices.
rank one.
Of a matrix: having rank exactly one, so it is a column times a row and every column is a multiple of one column. Explained in Matrix spaces, rank one and small-world graphs.
zero vector.
The vector whose components are all zero; adding it to any vector changes nothing. Explained in Transposes, permutations and vector spaces.
symmetric.
Unchanged by some swap, reflection or turn; for an expression in two quantities, unchanged when they are exchanged. Explained in Introduction to Fourier series.
diagonal.
In a square matrix, the entries running from the top left corner to the bottom right; a diagonal matrix has zeros everywhere else. Explained in The four fundamental subspaces.
span.
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.
elimination.
Solving equations by subtracting multiples of one from another until each unknown can be found in turn. Explained in The geometry of linear equations.
outlier.
A data point far from the pattern of the others, often from a mistake, which can pull a least-squares fit badly off. Explained in Projection matrices and least squares.
singular.
Of a square matrix: having no inverse, because its determinant is zero and some nonzero vector is sent to zero. Explained in The geometry of linear equations.
transpose.
The matrix made by writing the rows of a matrix as columns, flipping it across its main diagonal. Explained in Planes through three points, and matrices.

Academic

problem set.
A weekly sheet of exercises that students work through and hand in, to practise what the lectures taught.
transcript.
A written record of exactly what was said in a recorded lecture, word for word.
citation.
A note saying exactly where a statement, number or formula comes from, so readers can check it.
on paper.
In theory or in a calculation, as opposed to in a real experiment or in reality.
argument.
A chain of reasoning that leads to a conclusion; in maths also the input of a function, such as x in sin x.
error.
The difference between a measured or computed value and the true one; often how large that difference may be.
numerically.
In terms of actual numbers rather than symbols; often worked out step by step, by computer, instead of from an exact formula.
satisfy.
To make an equation or condition true.

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).