Recitation 12 · Week 12· 48:19
Problem Sheet 12, worked through
The marked problems of Sheet 12, solved step by step on screen. Try them first; the rest of the sheet is for practice on your own, with full written solutions. Covers Lectures 45 to 48.
Saved in this browser only. No account needed.
TranscriptThe full text of the recitation. Click any sentence to play the video from there.
Introduction and plan
Welcome to recitation twelve. This week we measured lengths, angles and distances in any vector space. Lecture forty five defined inner products and norms, and proved the Cauchy Schwarz inequality. Lecture forty six studied orthogonal complements and orthogonal projections. Lecture forty seven built orthonormal bases with the Gram Schmidt process, and the QR factorisation. And lecture forty eight solved least squares problems. Problem Sheet twelve covers lectures forty five to forty eight. We will solve the thirteen problems marked with the play symbol: problems one to eleven, and problems thirteen and fourteen. The other three are for practice on your own, with full solutions in the solutions booklet. As always, pause the video before each problem, and try it yourself first. Then watch how we do it, and compare.
First, a quick recap. An inner product takes two vectors and gives a number. It is linear in the first slot, conjugate symmetric, and positive: the inner product of a nonzero vector with itself is positive. The norm of v is the square root of the inner product of v with itself. The Cauchy Schwarz inequality says that the absolute value of the inner product of u and v is at most the norm of u, times the norm of v. The orthogonal complement of a subspace U, written U perp, holds every vector that is orthogonal to all of U. Every vector y splits in exactly one way into a vector of U, plus a vector of U perp. The part in U is the projection of y onto U, and it is the point of U closest to y.
With an orthogonal basis of U, the projection is a sum of one term for each basis vector w j: the inner product of y and w j, over the inner product of w j with itself, times w j. The Gram Schmidt process turns any basis into an orthogonal one: from each new vector, subtract its projections onto the vectors already built. Done on the columns of A, and normalised, it gives A equals Q R, where Q has orthonormal columns and R is upper triangular. When A x equals b has no solution, a least squares solution x hat makes A x hat as close to b as possible. It solves the normal equations: A transpose A x hat equals A transpose b. The residual, b minus A x hat, is orthogonal to the columns of A.
One picture carries us through today: a vector, its projection, and the residual, at a right angle to the subspace.
Problem 1: a new inner product on the plane
Problem one puts a new inner product on the plane. Recall from lecture forty five: an inner product on a real vector space is symmetric, linear in the first slot, and positive, which means that the inner product of v with itself is positive for every nonzero v. On R two, the inner product of x and y is three x one y one, minus x one y two, minus x two y one, plus two x two y two. Part a asks us to show that this is an inner product. Swap x and y. The inner product of y and x is three y one x one, minus y one x two, minus y two x one, plus two y two x two. The two middle terms have traded places, and the other two are unchanged, so this is the inner product of x and y: the rule is symmetric.
For linearity in the first slot, put a x plus b z in the first slot. Every term holds exactly one entry of the first vector, so each term splits in two, and the sum is a times the inner product of x and y, plus b times the inner product of z and y. So the rule is linear in the first slot. Positivity takes a little algebra. Put y equal to x. The inner product of x with itself is three x one squared, minus two x one x two, plus two x two squared. Split three x one squared into two x one squared plus x one squared, and two x two squared into x two squared plus x two squared. The middle three terms are x one minus x two, squared.
So the inner product of x with itself is two x one squared, plus, x one minus x two, squared, plus x two squared. That is a sum of squares, and it is zero only when x one and x two are both zero. So the rule is positive, and it is an inner product. Part b takes u equal to the vector (one, one), and v equal to the vector (one, minus two). It asks us to show that u and v are orthogonal for this inner product, although their dot product is not zero, to find their norms, and to check Pythagoras for u plus v. Term by term, the inner product of u and v is three times one times one, minus one times minus two, minus one times one, plus two times one times minus two. That is three, plus two, minus one, minus four, which is zero. So u and v are orthogonal for this inner product.
But their dot product is one minus two, which is minus one. Whether two vectors are orthogonal depends on the inner product. The inner product of u with itself is three minus one minus one plus two, which is three, so the norm of u is root three. For v, it is three plus two plus two plus eight, which is fifteen, so the norm of v is root fifteen. And u plus v is the vector (two, minus one). Its inner product with itself is twelve, plus two, plus two, plus two, which is eighteen. And eighteen is three plus fifteen: the squared norms add up, as Pythagoras says for orthogonal vectors.
Part c asks why two other rules are not inner products: x one y one, plus three x one y two, plus three x two y one, plus x two y two, and the rule x one y two plus x two y one. Both rules are symmetric and linear, so it is positivity that must fail. Put y equal to x. The first rule becomes x one squared, plus three x one x two, plus three x two x one, plus x two squared, and the second becomes x one x two, plus x two x one. Now take x equal to the vector (one, minus one). The first rule gives one minus three minus three plus one, which is minus four. The second gives minus one minus one, which is minus two. Both are negative for a nonzero vector, so neither rule is an inner product.
Problem 2: an inner product on complex vectors
Problem two works in C two. Recall from lecture forty five: the standard inner product on C n multiplies each entry of u by the conjugate of the matching entry of v, and adds. Swapping u and v conjugates the result. Here u is the vector (one plus i, two i), and v is the vector (two, one minus i). Part a asks for the inner product of u and v, the inner product of v and u, and the norms of u and v. In the first entry, one plus i, times the conjugate of two, which is two, gives two plus two i. In the second entry, two i, times the conjugate of one minus i, which is one plus i, gives two i plus two i squared, which is minus two plus two i. Adding, the inner product of u and v is four i.
In the other order, the conjugates fall on the entries of u. Two, times one minus i, is two minus two i, and one minus i, times minus two i, is minus two minus two i. Adding, the inner product of v and u is minus four i: the conjugate of four i, as it should be. The squared norm of u is the absolute value of one plus i, squared, plus the absolute value of two i, squared: two plus four, which is six. For v it is four plus two, also six. So both norms are root six. Part b asks us to check the Cauchy Schwarz inequality and the triangle inequality. The absolute value of four i is four, and that is at most root six times root six, which is six.
For the triangle inequality, u plus v is the vector (three plus i, one plus i). Its squared norm is ten plus two, which is twelve, so its norm is two root three, about three point four six. That is at most root six plus root six, which is two root six, about four point nine. Part c asks for the inner product of u and i v, and the inner product of i u and v. First, i v is the vector (two i, i plus one). So the inner product of u and i v is one plus i, times the conjugate of two i, which is minus two i, plus two i, times the conjugate of i plus one, which is one minus i. That is two minus two i, plus two plus two i, which is four.
Compare with four i. Four is minus i, times four i: the scalar i came out of the second slot as its conjugate. And the inner product of i u and v is i, times four i, which is minus four: from the first slot, a scalar comes out as it is. Part d asks for the complex number c for which u minus c v is orthogonal to v, and for u minus c v. The inner product of u minus c v with v is the inner product of u and v, minus c times the inner product of v with itself, because the first slot is linear, so c comes out as it is: four i, minus six c. That is zero when c is four i over six, which is two i over three. So c is the inner product of u and v, over the inner product of v with itself, and c v is the projection of u onto v. The order matters: the vector being projected goes in the first slot.
Then c v is the vector (four i over three, two thirds plus two i over three). So u minus c v is the vector (one minus i over three, minus two thirds plus four i over three).
Problem 3: an inner product from three values
Problem three puts an inner product on polynomials of degree at most two. The inner product of p and q is p of zero times q of zero, plus p of one times q of one, plus p of three times q of three. Part a asks us to show that this is an inner product. Swapping p and q gives q of zero times p of zero, and so on, the same three products, so the formula is symmetric. For linearity in p, put a p plus b r in the first slot. Its value at each point is a times the value of p, plus b times the value of r, so each product splits in two, and the sum is a times the inner product of p and q, plus b times the inner product of r and q.
For positivity, the inner product of p with itself is p of zero squared, plus p of one squared, plus p of three squared, which is never negative. If it is zero, then p vanishes at zero, one and three. But a nonzero polynomial of degree at most two has at most two roots. So p is the zero polynomial, and the rule is positive. Part b asks for the inner product of one plus x and x squared minus three x, for their norms, and for the angle between them. Work with the values at zero, one and three. One plus x takes the values one, two and four, and x squared minus three x takes the values zero, minus two and zero. So their inner product is zero, minus four, plus zero, which is minus four.
The norm of one plus x is the square root of one plus four plus sixteen, which is root twenty one. The norm of x squared minus three x is root four, which is two. So the cosine of the angle is minus four, over two root twenty one, about minus zero point four three six. The angle is about one hundred and sixteen degrees. Part c asks us to show that the same formula is not an inner product on polynomials of degree at most three.
Take h of x equal to x, times x minus one, times x minus three. It is a nonzero cubic, but it vanishes at zero, one and three, so the inner product of h with itself is zero. Positivity fails: three values no longer pin down a polynomial of degree three. Part d asks for all q of degree at most two that are orthogonal to both one and x. Call the values of q at zero, one and three y one, y two and y three. The polynomial one has the values one, one and one, and x has the values zero, one and three. So the inner product of q with one is y one plus y two plus y three, and its inner product with x is y two plus three y three.
Both are zero when y two is minus three y three, and y one is two y three. With y three equal to t, the values are two t, minus three t and t. Take t equal to three, which keeps every number whole: the values are six, minus nine and three. Write q as a, plus b x, plus c x squared. The value at zero gives a equal to six. The values at one and three give b plus c equal to minus fifteen, and three b plus nine c equal to minus three. Subtracting three times the first from the second gives six c equal to forty two, so c is seven, and b is minus twenty two. A polynomial of degree at most two is fixed by its values at three points, so the answer is every multiple of this one: q equals s times, seven x squared minus twenty two x plus six. It is a line: the orthogonal complement of the span of one and x, of dimension three minus two, which is one.
Problem 4: an orthogonal complement in four dimensions
Problem four finds an orthogonal complement. Recall from lecture forty six: U perp is the set of vectors orthogonal to every vector of U. In R four, U is spanned by the vector (one, two, zero, minus one), and the vector (zero, one, one, one). Part a asks for a basis of U perp. A vector is orthogonal to every vector of U exactly when it is orthogonal to the two spanning vectors: then, by linearity, it is orthogonal to every combination of them. So U perp is the null space of the matrix A whose rows are the two spanning vectors.
Subtract two times the second row from the first row. The first row becomes (one, zero, minus two, minus three), and the second row stays (zero, one, one, one). The free variables are x three, equal to s, and x four, equal to t. Then x one is two s plus three t, and x two is minus s minus t. So x is s times the vector (two, minus one, one, zero), plus t times the vector (three, minus one, zero, one), and these two vectors are a basis of U perp.
A check: the first basis vector dotted with the first spanning vector is two minus two, which is zero, and with the second it is minus one plus one, also zero. The second basis vector gives three minus two minus one, zero, and minus one plus one, zero. Part b asks us to check that the dimensions of U and U perp add up to four. The two spanning vectors of U are independent, since neither is a multiple of the other, and so are the two basis vectors of U perp. And two plus two is four. Part c asks us to decide, using part a, whether the vector (one, three, one, zero), and the vector (one, zero, zero, zero), lie in U.
Recall from lecture forty six that U perp perp is U. So a vector lies in U exactly when it is orthogonal to both basis vectors of U perp. The vector (one, three, one, zero), dotted with the first basis vector, is two minus three plus one, which is zero, and with the second, three minus three, also zero. So it lies in U: in fact, it is the sum of the two spanning vectors. But the vector (one, zero, zero, zero), dotted with the first basis vector, is two, which is not zero. So it does not lie in U.
Problem 5: projecting onto a plane
Problem five projects a vector onto a plane. Recall from lecture forty six: if w one to w k is an orthogonal basis of U, then the projection of y onto U is the sum of the terms, y dot w j, over w j dot w j, times w j. Here w one is the vector (one, zero, minus one), w two is the vector (one, four, one), U is their span, and y is the vector (two, three, four). Part a asks us to check that w one and w two are orthogonal, and to find the projection of y onto U. w one dotted with w two is one plus zero minus one, which is zero. So w one and w two are an orthogonal basis of U, and the formula applies.
The first coefficient is y dotted with w one, two minus four, which is minus two, over w one dotted with itself, which is two. That is minus one. The second is y dotted with w two, two plus twelve plus four, which is eighteen, over w two dotted with itself, also eighteen. That is one. So the projection of y onto U is minus w one, plus w two, which is the vector (zero, four, two). Part b asks us to show that y minus its projection is orthogonal to U. y minus the projection is the vector (two, minus one, two). Its dot product with w one is two minus two, zero, and with w two it is two minus four plus two, also zero. Orthogonal to both spanning vectors, it is orthogonal to all of U.
Part c asks for the distance from y to U, and an equation of the plane U. By the best approximation theorem, the projection is the point of U closest to y. So the distance is the norm of the vector (two, minus one, two): the square root of four plus one plus four, which is three. That vector is orthogonal to the plane, so the plane U has the equation two x one minus x two plus two x three equals zero. Both w one and w two satisfy it. Part d asks for a sketch. Here is the plane U, with w one and w two in it. The projection, the vector (zero, four, two), lies in the plane, and y stands above it.
The residual, y minus the projection, joins them. It meets the plane at a right angle, and its length, three, is the distance from y to the plane.
Problem 6: Gram–Schmidt and QR in four dimensions
Problem six runs the Gram Schmidt process in R four. Recall from lecture forty seven: each w j is v j, minus its projections onto the w's already built. Here v one is the vector (one, one, one, one), v two is the vector (three, one, one, minus one), v three is the vector (one, minus one, three, one), and A has the columns v one, v two and v three. Part a asks for an orthogonal basis w one, w two, w three of the column space of A. We keep w one equal to v one. v two dotted with w one is three plus one plus one minus one, which is four, and w one dotted with itself is four. So w two is v two, minus four fourths of w one: the vector (three, one, one, minus one), minus the vector (one, one, one, one), which is the vector (two, zero, zero, minus two).
v three dotted with w one is one minus one plus three plus one, which is four, so we subtract four fourths of w one again. v three dotted with w two is two plus zero plus zero minus two, which is zero, so there is nothing to subtract along w two. So w three is v three minus w one, which is the vector (zero, minus two, two, zero). A quick check: w one dotted with w two is two minus two, zero, w one dotted with w three is minus two plus two, zero, and w two dotted with w three is zero. None of the three is the zero vector, so v one, v two and v three are independent, and the w's are an orthogonal basis of the column space. Part b asks for an orthonormal basis. The norms are two, root eight, which is two root two, and two root two again. So q one is one half of the vector (one, one, one, one), q two is one over root two times the vector (one, zero, zero, minus one), and q three is one over root two times the vector (zero, minus one, one, zero).
Part c asks for the QR factorisation, and a check of one column of Q R. Q has the columns q one, q two and q three. The entry of R in row j and column k is v k dotted with q j. Every entry comes from parts a and b. On the diagonal are the norms from part b: two, two root two, and two root two. Above it, v two dotted with q one is v two dotted with w one, which was four, over the norm of w one, two. So it is two. In the same way, v three dotted with q one is four over two, also two, and v three dotted with q two is zero over two root two, which is zero. Let's check the second column of Q R: two q one, plus two root two q two. That is the vector (one, one, one, one), plus the vector (two, zero, zero, minus two), which is the vector (three, one, one, minus one): exactly v two.
Problem 7: least squares through QR
Problem seven solves a least squares problem with Q R. A has first column (two, three, six), and second column (eight, five, three), and b is the vector (seven, fourteen, seven). Part a asks for the QR factorisation of A. The first column has norm the square root of four plus nine plus thirty six, which is seven. So q one is one seventh of the vector (two, three, six). Then r one two is the second column dotted with q one: sixteen plus fifteen plus eighteen, over seven, which is seven. Subtract seven q one from the second column: the vector (eight, five, three), minus the vector (two, three, six), is the vector (six, two, minus three). Its norm is the square root of thirty six plus four plus nine, which is seven again.
So q two is one seventh of the vector (six, two, minus three), and R has first row (seven, seven), and second row (zero, seven). Part b asks us to show that A x equals b has no solution, and to find the least squares solution x hat from R x hat equals Q transpose b. Attach b to A as a third column, and expand the determinant along the first row: two times, thirty five minus forty two, minus eight times, twenty one minus eighty four, plus seven times, nine minus thirty. That is minus fourteen, plus five hundred and four, minus one hundred and forty seven, which is three hundred and forty three. It is not zero, so b is not a combination of the columns of A, and there is no exact solution.
Where does R x hat equals Q transpose b come from? Start from A x hat equals the projection of b, which is Q Q transpose b, and write A as Q R. Multiplying by Q transpose, and using Q transpose Q equals I, gives R x hat equals Q transpose b. Q transpose b has the entries q one dotted with b, which is fourteen plus forty two plus forty two, over seven, so fourteen, and q two dotted with b, which is forty two plus twenty eight minus twenty one, over seven, so seven. Back substitution: the second row says seven x hat two equals seven, so x hat two is one. The first row says seven x hat one, plus seven, equals fourteen, so x hat one is one. So x hat is the vector (one, one).
Part c asks for b hat, the residual r, and the least squares error, and for a check that r is orthogonal to the columns. b hat is A x hat, the sum of the two columns, which is the vector (ten, eight, nine). The residual is b minus b hat, the vector (minus three, six, minus two), and its norm is the square root of nine plus thirty six plus four, which is seven. That is the least squares error. Check: r dotted with the first column is minus six plus eighteen minus twelve, which is zero, and with the second column, minus twenty four plus thirty minus six, also zero.
Problem 8: the normal equations
Problem eight uses the normal equations. A has first row (one, zero), second row (one, one), third row (two, one), and fourth row (zero, two), and b is the vector (minus two, three, four, one). Part a asks us to show that A x equals b is inconsistent. The first equation says x one is minus two. The second, x one plus x two equals three, then gives x two equal to five. But the third equation, two x one plus x two equals four, would need minus four plus five to be four, and it is one. So there is no solution. Part b asks for the normal equations, A transpose A x hat equals A transpose b, for their solution, and for why it is unique.
The entries of A transpose A are the dot products of the columns of A. The first column with itself gives one plus one plus four, which is six. The first with the second gives one plus two, which is three. And the second with itself gives one plus one plus four, six again. The vector A transpose b holds the dot products of the columns with b: minus two plus three plus eight, which is nine, and three plus four plus two, also nine. So the normal equations are six x hat one plus three x hat two equals nine, and three x hat one plus six x hat two equals nine. Subtracting, x hat one equals x hat two, and then nine x hat one equals nine. So x hat is the vector (one, one).
It is the only solution, because the determinant of A transpose A is thirty six minus nine, which is twenty seven, not zero. That happens exactly because the columns of A are independent. Part c asks for b hat, the residual, and the least squares error, and for a check that A transpose r is zero. b hat is A x hat, the vector (one, two, three, two), so the residual is the vector (minus three, one, one, minus one). The vector A transpose r has the entries minus three plus one plus two, which is zero, and one plus one minus two, also zero. The least squares error is the norm of r: the square root of nine plus one plus one plus one, which is root twelve, or two root three.
Part d takes x equal to zero, and asks us to check that the squared norm of b is the squared norm of r, plus the squared norm of A x hat, and to explain why the identity holds for every x. The squared norm of b is four plus nine plus sixteen plus one, which is thirty. The squared norm of r is twelve, and the squared norm of A x hat is one plus four plus nine plus four, which is eighteen. And thirty is twelve plus eighteen. In general, b minus A x is r, plus A times, x hat minus x. The second part lies in the column space of A, and r is orthogonal to it, so Pythagoras gives the identity. It shows again that no x comes closer to b than x hat.
Problem 9: fitting a line to data
Problem nine fits a line to data. A seedling is measured once a week. In weeks minus one, zero, one, two and three, its heights are zero, one, one, three and three centimetres. Part a asks for the design matrix A, the observation vector y, and the normal equations for the line y equals c zero plus c one x. Each data point gives one equation. For example, the first point, at week minus one with height zero, gives c zero, minus c one, equals zero. In general, the point x j, y j gives c zero, plus c one times x j, equals y j. So each row of A is one and x j, and the first row is (one, minus one). And y lists the heights: it is the vector (zero, one, one, three, three).
The matrix A transpose A has the entries five, the number of points; the sum of the x j, which is five; and the sum of their squares, one plus zero plus one plus four plus nine, which is fifteen. The vector A transpose y has the entries the sum of the heights, which is eight, and the sum of x j times y j: zero plus zero plus one plus six plus nine, which is sixteen. So the normal equations are five c hat zero plus five c hat one equals eight, and five c hat zero plus fifteen c hat one equals sixteen.
Part b asks for the least squares line. Subtracting the first equation from the second, ten c hat one is eight, so c hat one is zero point eight. Then five c hat zero is eight minus four, so c hat zero is zero point eight too. The line is y equals zero point eight plus zero point eight x. Part c asks for the residuals, for a check that they add up to zero, with the reason, and for the sum of their squares. At weeks minus one to three, the line gives zero, zero point eight, one point six, two point four and three point two. So the residuals are zero, zero point two, minus zero point six, zero point six and minus zero point two. They add up to zero, and they must: the residual vector is orthogonal to every column of A, and the first column is all ones, so its dot product with the residual is the sum of the residuals.
The sum of their squares is zero, plus zero point zero four, plus zero point three six, plus zero point three six, plus zero point zero four, which is zero point eight. Part d asks for a drawing, and a prediction for week five. Here are the data and the line, with the residuals as short vertical segments. In week five, the line gives zero point eight plus four, which is four point eight centimetres.
Problem 10: Gram–Schmidt for polynomials
Problem ten runs the Gram Schmidt process on polynomials. On polynomials of degree at most two, the inner product of p and q is the integral of p times q from zero to one. All the integrals we need are of powers of x: the inner product of x to the j and x to the k is one over, j plus k plus one. Part a asks us to apply the Gram Schmidt process to one, x and x squared. w one is one, and the inner product of one with itself is one. The inner product of x and one is one half, so w two is x minus one half.
For w three, the inner product of x squared and one is one third. The inner product of x squared and x minus one half is one quarter minus one sixth, which is one twelfth. And the inner product of x minus one half with itself is one third, minus one half, plus one quarter, also one twelfth. So w three is x squared, minus one third, minus, one twelfth over one twelfth, times, x minus one half. One twelfth over one twelfth is one, so w three is x squared minus x plus one sixth. Part b asks for the norms of the three polynomials. The norm of one is one. The squared norm of x minus one half is one twelfth, so its norm is one over two root three.
The squared norm of w three equals its inner product with x squared, because w three is orthogonal to one and to x minus one half. That is one fifth, minus one quarter, plus one eighteenth, which is one over one hundred and eighty. So the norm is one over six root five. Part c asks for the polynomial of degree at most two closest to x cubed. By the best approximation theorem, it is the projection of x cubed onto this space, and the orthogonal basis of part a gives it term by term. The inner products of x cubed with the three basis polynomials are one quarter; one fifth minus one eighth, which is three fortieths; and one sixth, minus one fifth, plus one twenty fourth, which is one over one hundred and twenty.
Dividing by the squared norms, the coefficients are one quarter; three fortieths over one twelfth, which is nine tenths; and one over one hundred and twenty, over one over one hundred and eighty, which is three halves. So the projection is one quarter, plus nine tenths times, x minus one half, plus three halves times, x squared minus x plus one sixth. Collecting terms, it is three halves x squared, minus three fifths x, plus one twentieth. Part d asks for the distance from x cubed to this space, and for a check that the error is orthogonal to one, x and x squared. Call the error e: x cubed, minus three halves x squared, plus three fifths x, minus one twentieth.
Its inner product with one is one quarter, minus one half, plus three tenths, minus one twentieth, which is zero. With x, it is one fifth, minus three eighths, plus one fifth, minus one fortieth, zero again. And with x squared, it is one sixth, minus three tenths, plus three twentieths, minus one sixtieth, also zero. The distance is the norm of e. Since e is orthogonal to the projection, its squared norm is its inner product with x cubed: one seventh, minus one quarter, plus three twenty fifths, minus one eightieth, which is one over two thousand eight hundred. So the distance is one over twenty root seven, about zero point zero one nine.
Problem 11: the matrix of a projection
Problem eleven finds the matrix of a projection. A has first row (one, zero), second row (one, one), and third row (zero, one), and U is its column space in R three. Recall from lecture forty eight: when the columns of A are independent, A, times the inverse of A transpose A, times A transpose, is the standard matrix of the projection onto U. Here we call it B. Part a asks us to compute B. The matrix A transpose A has first row (two, one), and second row (one, two). Its determinant is three, so its inverse is one third of the matrix with first row (two, minus one), and second row (minus one, two). A times that inverse is one third of the matrix with first row (two, minus one), second row (one, one), and third row (minus one, two). Multiplying by A transpose, B is one third of the matrix with first row (two, one, minus one), second row (one, two, one), and third row (minus one, one, two).
Part b asks us to check that B squared is B, and B transpose is B, and to explain B squared equals B geometrically. B is symmetric, so B transpose is B. In B squared, the first row is one ninth of, four plus one plus one, then two plus two minus one, then minus two plus one minus two. That is one ninth of six, three and minus three, which is the first row of B. The other rows work the same way. Geometrically, B x already lies in U, and projecting a vector of U onto U leaves it where it is. Projecting twice is the same as projecting once.
Part c asks for a basis of U perp, the eigenvalues of B with a basis of each eigenspace, and the trace of B. U perp is the null space of A transpose: x one plus x two equals zero, and x two plus x three equals zero. So U perp is spanned by the vector (one, minus one, one). B fixes every vector of U, and sends every vector of U perp to zero. Indeed, B times the vector (one, minus one, one), is one third of, two minus one minus one, then one minus two plus one, then minus one minus one plus two: the zero vector. Why are these the only eigenvalues? B leaves each vector of U where it is, so each one is an eigenvector with eigenvalue one. And B sends each vector of U perp to zero, so each one is an eigenvector with eigenvalue zero. U has dimension two and U perp has dimension one, so together they give three independent eigenvectors, a basis of R three. So there is no room for any other eigenvalue.
So the eigenvalue one has the eigenspace U, with the basis vectors (one, one, zero), and (zero, one, one), the columns of A. The eigenvalue zero has the eigenspace U perp, with the basis vector (one, minus one, one). The trace of B is one third of, two plus two plus two, which is two. That is the sum of the eigenvalues, one plus one plus zero, and the dimension of U. Part d asks for the reflection across U, with standard matrix two B minus I, and for a check that its square is I. Two B minus I is one third of the matrix with first row (one, two, minus two), second row (two, one, two), and third row (minus two, two, one).
Its square is four B squared, minus four B, plus I. Since B squared is B, the first two terms cancel, and the square is I. So reflecting across U twice puts every vector back where it started: the reflection undoes itself. Part e asks for the projection of e one onto U, and the distance from e one to U. The projection is B e one, the first column of B: the vector (two thirds, one third, minus one third). Then e one minus its projection is the vector (one third, minus one third, one third), which lies in U perp. Its norm, one over root three, is the distance.
Problem 13: the parallelogram law and polarisation
Problem thirteen proves two identities in any inner product space, over the real or the complex numbers. Part a asks us to prove the parallelogram law: the squared norm of u plus v, plus the squared norm of u minus v, equals two times the squared norm of u, plus two times the squared norm of v. Expand each squared norm as an inner product. By linearity in the first slot and conjugate linearity in the second, the squared norm of u plus or minus v is the squared norm of u, plus or minus the inner product of u and v, plus or minus the inner product of v and u, plus the squared norm of v. Add the plus version and the minus version. The middle terms cancel, and what remains is two times the squared norm of u, plus two times the squared norm of v.
In the plane, this says that the squares of the two diagonals of a parallelogram add up to the squares of its four sides. Part b asks us to prove the polarisation identities, which get the inner product back from norms. Subtract the minus version from the plus version instead: the squared norms of u and v cancel, and we get two times the inner product of u and v, plus two times the inner product of v and u. Over the real numbers, the inner product of v and u equals the inner product of u and v, so this is four times the inner product of u and v. So the inner product of u and v is one quarter of, the squared norm of u plus v, minus the squared norm of u minus v.
Over the complex numbers, expand u plus or minus i v the same way. The scalar i comes out of the second slot as minus i. So the squared norm of u plus i v, minus the squared norm of u minus i v, is minus two i times the inner product of u and v, plus two i times the inner product of v and u. Multiply this by i: it becomes two times the inner product of u and v, minus two times the inner product of v and u. Add the difference we had before, and the terms with v and u cancel, leaving four times the inner product of u and v. That is the complex polarisation identity. Part b also asks us to check it on u and v from problem two. There, u plus v is the vector (three plus i, one plus i), and u minus v is the vector (minus one plus i, minus one plus three i). Both have squared norm twelve.
u plus i v is the vector (one plus three i, one plus three i), with squared norm twenty, and u minus i v is the vector (one minus i, minus one plus i), with squared norm four. So the right side is one quarter of, twelve minus twelve, plus twenty i, minus four i, which is four i: exactly the inner product of u and v from problem two. Part c takes the norm on R two that adds the absolute values of the entries, and asks us to show that no inner product gives this norm.
If an inner product gave it, the parallelogram law would hold. But for e one and e two, the left side is two squared plus two squared, which is eight, while the right side is two times one, plus two times one, which is four. So no inner product has this norm.
Problem 14: which matrices are orthogonal projections
Problem fourteen asks which matrices are orthogonal projections. B is a real n by n matrix. Part a takes B to be the standard matrix of the projection onto a subspace U, and asks why B squared is B, and B transpose is B. If U is the zero subspace, B is the zero matrix, and both hold. Otherwise, recall from lecture forty six: with an orthonormal basis q one to q k of U, B is q one q one transpose, plus and so on, up to q k q k transpose. Each term is symmetric, so B transpose is B. And projecting twice changes nothing, because a vector of U is its own projection. So B squared is B.
Part b proves the converse: if B squared is B and B transpose is B, then B v is the projection of v onto the column space of B, for every v. Certainly B v lies in the column space. Every vector of the column space is B w for some w. The dot product of v minus B v with B w equals the dot product of B transpose times, v minus B v, with w. This step uses a rule that holds for every matrix: x dot B y equals B transpose x, dot y. Indeed, x dot B y is x transpose B y, and x transpose B is the transpose of B transpose x.
Since B transpose is B, that is B v minus B squared v, dotted with w. And since B squared is B, it is B v minus B v, dotted with w, which is zero. So v minus B v is orthogonal to the column space. Then v is B v, plus, v minus B v: a vector of the column space, plus a vector of its orthogonal complement. That splitting is unique, and its first part is the projection. So B v is the projection of v onto the column space of B. Together with part a: a real square matrix is the matrix of an orthogonal projection exactly when B squared is B, and B transpose is B. The matrix B of problem eleven is an example.
Part c takes F, with first row (two, minus one), and second row (two, minus one). It asks us to check that F squared is F, to find the column space and the null space of F, to compare F v with the projection of v for v equal to the vector (three, one), and to draw them. In F squared, the first entry of the first row is four minus two, which is two, and the second is minus two plus one, which is minus one. The second row is the same, so F squared is F. Both columns of F are multiples of the vector (one, one), so that line is the column space. And F x is zero when two x one minus x two is zero, so the null space is the line through the vector (one, two).
F v is six minus one, twice: the vector (five, five). The projection of v onto the column space is v dotted with the vector (one, one), which is four, over two, times the vector (one, one): the vector (two, two). In the picture, F moves v to the column space along the null space, and the orthogonal projection moves it at a right angle. The two points are different, so F is not an orthogonal projection, and indeed F transpose is not F. F projects onto its column space along its null space, and those two lines are not perpendicular.
What we practised
Let's collect what we used today. Problems one to three checked inner products on the plane, on complex vectors and on polynomials. Positivity is the property that usually fails, and whether two vectors are orthogonal depends on the inner product. Problems four, five and eleven found orthogonal complements and projections, and problem fourteen showed that the orthogonal projections are exactly the symmetric matrices with B squared equal to B.
Problems six, seven and ten ran the Gram Schmidt process and built Q R. Problems seven to nine solved least squares problems, with the residual at a right angle to the column space. And problem thirteen got the inner product back from norms. For practice, try problems twelve, fifteen and sixteen. Problem twelve fits a parabola, problem fifteen proves inequalities with Cauchy Schwarz, and problem sixteen approximates a function by cosines. Next week, the spectral theorem: symmetric matrices, quadratic forms, and the singular value decomposition. See you then.
In this recitation
- Problem 1: a new inner product on the plane
- Problem 2: an inner product on complex vectors
- Problem 3: an inner product from three values
- Problem 4: an orthogonal complement in four dimensions
- Problem 5: projecting onto a plane
- Problem 6: Gram–Schmidt and QR in four dimensions
- Problem 7: least squares through QR
- Problem 8: the normal equations
- Problem 9: fitting a line to data
- Problem 10: Gram–Schmidt for polynomials
- Problem 11: the matrix of a projection
- Problem 13: the parallelogram law and polarisation
- Problem 14: which matrices are orthogonal projections
- What we practised