If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Finding projection onto subspace with orthonormal basis example

Example of finding the transformation matrix for the projection onto a subspace with an orthonormal basis. Created by Sal Khan.

Want to join the conversation?

Video transcript

We saw on the last video that if I have some sort of orthonormal basis, I should have a shorthand for this-- if I have an orthonormal basis, then to find for a subspace V, and if I want to find the projection of some vector x in Rn onto V, the transformation matrix simplifies to A times A transpose times x. Where A is equal to essentially, or exactly, the matrix with the basis vectors as columns. So lets say v1, v2, all the way through vk, these are the basis vectors. Basis orthonormal, maybe I'll write it like this, orthonormal basis vectors for V. We saw this in the last video, and that was another reason why we like orthonormal bases. Let's do this with an actual concrete example. So let's say V is equal to the span of the vector 1/3, 2/3, and 2/3. And the vector 2/3, 1/3, and minus 2/3. Now, we've already seen that these two guys are linearly independent and they both have length 1, and then they're both orthogonal to each other. So we could say b, so we can say the set-- let me write it this way-- we'll call this vector 1 for shorthand, if that's v1 and that this is v2, we know that the set of v1 and v2, is an orthonormal basis for V. Now, we want to use this result to find the projection. We want to find the transformation matrix for the projection of any vector x in R-- well in this case, it's going to be in R3, onto our subspace, onto V. And the subspace is going to be a plane in R3. What's it going to be? Well, we found the result that we just have to construct-- we have to construct a matrix A, which is equal to-- which has these guys as a column vectors. So 1/3, 2/3, 2/3, and 2/3, 1/3, and minus 2/3. And if we construct A in that way, then the projection of x onto V, this linear transformation can be represented as A times A transpose times x. So to find our transformation matrix, we just have to multiply this guy times his transpose. So let's do that. Let me just copy and paste this. OK, let me do it right here. So that's A. I need to multiply that times A transpose. A transpose is just going to be 1/3, 2/3, 2/3, 1/3, and then 2/3, minus 2/3. That's A transpose. So what is this going to be equal to? We have a 3 by 2, times a 2 by 3 matrix, so it's going to result in a 3 by 3 matrix. Which makes sense, because this thing right here should be a mapping from R3 to R3. Right? You give me some member of R3, and I'm going to give you another member of R3 that is in my subspace V, and is the projection of x onto V, and we've also seen, the closest member of V to x. So what is this going to be? It's going to be a 3 by 3 matrix. We have a 3 by 3 matrix. And so this first term, right here, we're going to dot this guy with this guy. So it's going to be 1/3 times 1/3, which is 1/9, plus 2/3 times 2/3. So it's going to be 1/9 plus 4/9. So I think we're going to be dealing with a lot of ninths here, so let me just divide everything by nine. So it's going be 1/9 plus 4/9 which is 5/9, but I'll just write a 5 here. And just know that we're going to divide everything by 9 at the end. So that's that guy dotted with that guy. Now let's take the dot of this guy with this guy. I'm going to get 2/9 plus 2/9, right? That's 4/9. Now I'm going to dot this guy with this guy. 2/9 minus 4/9, that is minus 2/9. Now let's take the dot of the this row, we're in the second row and we're going to have to-- the dot of 2/3 and 1/3 is 2/9 plus 2/9, that is 4/9. Let's put a 4 there, we have 4/9. Then we have 2/9 plus 1/9 is 3/9. Let me get make sure I got that right. 2/9-- oh sorry, 2/3 times 2/3 is 4/3, so it's 4- sorry, 2/3 times 2/3 is 4/9, plus 1/9, is 5/9. And then we have 4/9 minus 2/9 is 2/9. And then, let's do this last one, we're almost there. I hope you already appreciate that this is a lot less painful than we had to take A transpose A, and then inverse it in between. We're just taking A times A transpose. So 2/3 times 1/3, that's 2/9 minus 4/9, so that's minus 2/9. And then we have 4/9 minus 2/9, that's 2/9. And then we have 4/9 plus 4/9, so that is 8/9. So just like that we were able to figure out the transformation matrix for the projection of any vector in R3 onto our subspace V. And this was a lot less painful than the ways that we've done it in the past.