Lecture 46 · Week 12· 16:31

Orthogonality and projections

Orthogonal complements, orthogonal projection.

Play: Lecture 46: Orthogonality and projections
Lecture · 16:31 · Open on YouTube · Report a problem with this video
TranscriptThe full text of the lecture. Click any sentence to play the video from there.

Dropping a perpendicular

Welcome back. Last lecture we met inner products: a way to measure lengths and angles in any vector space, from R n and C n to spaces of polynomials and functions. Today we use them for one of the most useful constructions in geometry: dropping a perpendicular. In lecture thirteen we dropped a perpendicular from a point onto a line through the origin. Here is an example in the plane: the point (three, four), and the line through the vector (two, one).

The foot of the perpendicular is the point (four, two). The first point minus its foot is minus one, two, which is at right angles to the line, and the foot is the point of the line closest to the first point. Today we replace the line by any subspace U, such as a plane in space, and the dot product by any inner product. Is there still a foot of the perpendicular? Is it still the closest point? And how do we compute it? Here is the plan. First, orthogonal lists, and why they make coordinates easy. Then the orthogonal complement of a subspace. Then the orthogonal projection onto it and its properties. And finally, the closest point.

Orthogonal lists

Throughout, V is an inner product space over F, where F is the real or the complex numbers. Recall that two vectors are orthogonal when their inner product is zero. A list of vectors is orthogonal if any two different vectors in it are orthogonal. It is orthonormal if, in addition, every vector in it has norm one. For example, in R three with the dot product, take the vectors w one and w two: the first is (one, one, zero), and the second is (one, minus one, one).

Their dot product is one times one, plus one times minus one, plus zero times one. That is one, minus one, plus zero, which is zero. So the list is orthogonal. Dividing each vector by its norm makes the list orthonormal: the first by the square root of two, and the second by the square root of three. The first fact is Pythagoras for a whole list. If the list is orthogonal, then the squared norm of the sum is the sum of the squared norms.

Here is why. Expand the inner product of the sum with itself. We get the inner product of every vector in the list with every vector in the list. The terms with two different vectors are zero, and what is left are the squared norms. Second fact. An orthogonal list of nonzero vectors is linearly independent. Suppose a combination of them is zero. Take the inner product of both sides with one of the vectors, w l. On the left, every term except one vanishes, and we are left with c l times the squared norm of w l. On the right we get zero. Since w l is not zero, its squared norm is positive, so c l is zero. That holds for every l.

The third fact is why orthogonal bases are so convenient. If v lies in the span of an orthogonal list of nonzero vectors, then the coefficient of w j is the inner product of v with w j, divided by the squared norm of w j. The proof is the same trick. Write v as a combination, and take the inner product with w l. Only the l th term survives, and it is c l times the squared norm of w l. For an orthonormal list, the denominators are one, and the coefficients are just inner products. Let's try it on the vector x equal to (three, minus one, two), which lies in the plane spanned by our two vectors. Its dot product with the first vector is three, minus one, plus zero, which is two, and the first vector has squared norm two. So the first coefficient is one.

Its dot product with the second vector is three, plus one, plus two, which is six, and the second vector has squared norm three. So the second coefficient is two. So x is one times the first vector, plus two times the second. Check: the vector (one, one, zero), plus the vector (two, minus two, two), is the vector (three, minus one, two). No system of equations was solved.

The orthogonal complement

Now from single vectors to whole subspaces. Let U be a subspace of V. The orthogonal complement of U, written U perp, is the set of all vectors in V that are orthogonal to every vector of U. Three facts about it. First, U perp is a subspace of V. Second, U and U perp have only the zero vector in common. And third, to test whether v is in U perp, it is enough to test v against a spanning list of U. Here are the reasons. The zero vector is orthogonal to everything. And if v and v prime are orthogonal to u, then so is c v plus v prime, because the inner product is linear in its first slot. So U perp is a subspace.

If v lies in both, then v is orthogonal to itself. So the inner product of v with v is zero, and by positivity, v is the zero vector. And if v is orthogonal to each vector of a spanning list, it is orthogonal to every combination of them, by conjugate linearity in the second slot. Those combinations make up all of U. Back in R three, take the plane U spanned by w one and w two. By the third fact, a vector x is in U perp exactly when its dot products with w one and w two are both zero.

Written out, these are two equations. In the first, x one plus x two equals zero. In the second, x one minus x two plus x three equals zero. The first gives x two equal to minus x one. In the second, x one minus minus x one is two x one, so two x one plus x three equals zero, and x three is minus two x one. So the vector x is x one, minus x one, minus two x one, which is x one times the vector (one, minus one, minus two). U perp is the line spanned by it: the normal line of the plane, at right angles to it.

This is an old friend. In R n with the dot product, a vector x is orthogonal to every row of a matrix A exactly when A x is zero, by the row rule. So the orthogonal complement of the row space of A is the null space of A. Applied to A transpose, the orthogonal complement of the column space of A is the null space of A transpose. These are the right angles we saw between the four fundamental subspaces, in lecture twenty seven.

The orthogonal decomposition

Now the main theorem. Let U be a finite dimensional subspace of V. Then for every vector v in V, there is exactly one vector u in U, such that v minus u lies in U perp. So v splits in exactly one way as u plus w, with u in U and w in U perp. In the picture, u is the foot of the perpendicular from v to the plane, and w points along the normal line. The space V itself may be infinite dimensional. Only U has to be finite dimensional.

The existence proof is the demanding part of the lecture, so take it slowly, and pause or rewatch it if you need to. Choose a basis b one, up to b k, of U, and look for u as a combination, c one b one, up to c k b k. By the third fact about U perp, v minus u lies in U perp exactly when it is orthogonal to each basis vector b l. That is, the inner product of v with b l equals the inner product of u with b l. Now write u as its combination of the basis vectors. Since the inner product is linear in its first slot, the right side splits into the sum over j of c j times the inner product of b j with b l. So for each l from one to k, this sum must equal the inner product of v with b l.

That is a system of k linear equations in the k unknowns c one up to c k. Its matrix G, whose entries are the inner products of the basis vectors, is called the Gram matrix. The system is G c equals d. A square system has exactly one solution when its homogeneous system has only the zero solution. So suppose G c is zero, and let x be the combination of the basis vectors with these coefficients. Then x is orthogonal to every b l, so x lies in U perp. It also lies in U, so x is the zero vector. Since the basis is linearly independent, all the c j are zero.

So the system has exactly one solution, and u exists. Uniqueness is short. If u and u prime both work, then u minus u prime is the difference of v minus u prime and v minus u. It lies in U, and it lies in U perp, so it is zero.

The orthogonal projection

This vector u is the orthogonal projection of v onto U, written proj U of v. The map that sends each v to it is the orthogonal projection onto U. When U is a line spanned by one nonzero vector w, the system is a single equation, and the projection is the inner product of v with w, over the inner product of w with itself, times w. In R n with a unit vector, this is the formula of lecture thirteen. With an orthogonal basis, the Gram matrix is diagonal, and the system solves itself. The projection of v is the sum over j of the inner product of v with w j, over the squared norm of w j, times w j.

With an orthonormal basis, the denominators are one, and the projection is the sum of the inner products of v with q j, times q j. For example, project the vector v equal to (two, zero, four), onto our plane. Its dot product with the first vector is two, and over two, that is one. Its dot product with the second is two, minus zero, plus four, which is six, and over three, that is two. So the projection is one times the first vector, plus two times the second, which is the vector (three, minus one, two). It lies in the plane.

Check: v minus its projection is (minus one, one, two), which is minus one times the vector (one, minus one, minus two). So it lies on the normal line, U perp, at right angles to the plane. Now turn the picture around. Seen along the plane, the plane becomes a line, and v drops straight onto it, at a right angle. Seen from above, v sits exactly over its projection. So this is the projection you know from geometry. What we have done is write it with inner products, and in that form it works the same way in spaces we cannot draw, such as spaces of functions, where the picture no longer guides us. Every finite dimensional inner product space has an orthonormal basis: the Gram Schmidt process of the next lecture builds one from any basis. Until then, the Gram matrix does the job for any basis.

Properties of the projection

The projection map has the properties you would expect, and each one comes from uniqueness: a vector of U whose difference from v lies in U perp is the projection of v. It is linear. If u and u prime are the projections of v and v prime, then c u plus u prime lies in U, and the difference from c v plus v prime lies in U perp. So c u plus u prime is the projection of c v plus v prime. It fixes every vector of U, and sends a vector to zero exactly when it lies in U perp. So its image is U, its kernel is U perp, and applying it twice is the same as applying it once. It is a projection in the sense of lecture forty four.

Since every v is its projection plus a vector of U perp, and the two subspaces meet only in zero, V is the direct sum of U and U perp. So when V has dimension n, U perp has dimension n minus the dimension of U. In our example, the plane has dimension two and the normal line has dimension one, which add up to three. Finally, every vector of U is orthogonal to U perp, so U lies in the complement of U perp. Both have the same dimension, so the complement of U perp is U again.

The closest point

Now our second question. Let U be a finite dimensional subspace, and v a vector of V. Then the projection of v is the point of U closest to v. For every u in U, the distance from v to u is at least the distance from v to its projection, with equality only when u is the projection. The proof is Pythagoras once more. Write v minus u as v minus its projection, plus the projection minus u. The first part lies in U perp, and the second lies in U. So they are orthogonal.

By Pythagoras, the squared distance from v to u is the squared distance from v to its projection, plus the squared norm of the projection minus u. The second term is never negative, and it is zero only when u is the projection. The distance from v to its projection is called the distance from v to U. In our example, it is the norm of (minus one, one, two), the square root of one plus one plus four, which is the square root of six. The same theorem works in spaces of functions. Take the continuous functions on the interval from minus one to one, with the inner product given by the integral of f times g. Which function a plus b x is closest to x squared?

Here U is spanned by the functions one and x, and they are orthogonal, since the integral of x from minus one to one is zero. So we can use the formula for an orthogonal basis. The inner product of x squared with one is the integral of x squared, which is two thirds, and the squared norm of one is two. So the first coefficient is one third. The inner product of x squared with x is the integral of x cubed, which is zero. So the best approximation is the constant function one third. The parabola is symmetric, so the best line has no slope.

Check: the error, x squared minus one third, is orthogonal to one, since its integral is two thirds minus two thirds, which is zero. And x times it is an odd function, so that integral is zero too. In lecture forty eight, we turn this theorem into a method: when a linear system has no solution, we project the right hand side onto the column space, and solve with the projection instead. That is the method of least squares.

Try it yourself

You can try this yourself, on this lecture's page at Open Semester dot com. The coral graph is a function f on the interval from minus one to one. The green line is its projection onto the lines, and the dashed blue line is a line g of your own. For x squared, the projection is the constant one third, as in our example. Drag the handles of g, and its squared distance to f is always bigger: it is the squared error, plus the squared distance from g to the projection. That is Pythagoras again. Move g onto the projection, and the two distances agree. No line comes closer.

Now choose e to the x. Its best line tilts upwards, and the shaded error is small. Try the other functions, and the constants, and see that nothing beats the projection.

Summary

Let's sum up. In an orthogonal list of nonzero vectors, Pythagoras holds, the list is independent, and each coefficient is an inner product divided by a squared norm. The orthogonal complement U perp is a subspace that meets U only in zero. For a matrix, the complement of the row space is the null space. For a finite dimensional subspace U, every v splits in exactly one way as its projection onto U, plus a vector of U perp. The projection is linear, and it is the point of U closest to v.

Before the next lecture, read section ten point two of the course book, try the problems on sheet twelve about orthogonal complements and projections, and do the lecture check on this lecture's page at Open Semester dot com. Next time, we build orthonormal bases from any basis with the Gram Schmidt process. See you there.

Try it

The closest function on [−1, 1]

f =
U =

The inner product is ⟨f, g⟩ = ∫ f g dx over [−1, 1]. Pick a function f and the subspace U. The green graph is projUf, computed from the orthogonal basis 1, x; the shaded area shows the error f − projUf. Drag the blue handles to try your own g in U: ‖f − g‖2 is never smaller than ‖f − projUf‖2, and the difference is ‖projUf − g‖2.

Check yourself

3 questions, from warm-up to stretch

Work each one out on paper, type your answer and press Check. Stuck? Open a hint; the worked solution is there when you need it.

  1. Question 1 of 3 Warm-up

    In with the dot product, and are orthogonal, and lies in . Find and with , without solving a linear system.

    Hint 1 of 2

    In an orthogonal basis each coefficient is an inner product divided by a squared norm (Theorem 10.2.4): .

    Hint 2 of 2

    and . For : and .

    Worked solution
    1. , so is an orthogonal list of nonzero vectors, and Theorem 10.2.4 gives each coefficient as .
    2. and , so .
    3. and , so .
    4. Check: .
  2. Question 2 of 3 Core

    In with the dot product, let with and , and let . Find , and the squared distance from to .

    Hint 1 of 2

    , so is an orthogonal basis of , and Theorem 10.2.13 gives .

    Hint 2 of 2

    and ; and . Once you have the projection, subtract it from and take the squared norm of the rest.

    Worked solution
    1. , so Theorem 10.2.13 applies with the orthogonal basis .
    2. and , so the first coefficient is . and , so the second is .
    3. .
    4. Check: , and , , so it lies in .
    5. The squared distance from to is (the distance is ).
  3. Question 3 of 3 Stretch

    Use the inner product on the continuous functions on . Which function is closest to ? Find and .

    Hint 1 of 2

    The closest function of is (Theorem 10.2.17). The functions and are orthogonal, since , so the formula for an orthogonal basis applies.

    Hint 2 of 2

    and , with and .

    Worked solution
    1. , and , so is an orthogonal basis of . By Theorem 10.2.17 the closest function is , and Theorem 10.2.13 computes it.
    2. , since is odd. So .
    3. and , so .
    4. So the best approximation is . Check: the error is odd, so its inner product with is , and .

Found a mistake, or something not working on this page? Report it and we'll fix it. See what we've corrected.