 Suppose we have a vector y that lives inside of our vector space fn for some field f, and we have a subspace w inside of fn, and then consider the orthogonal basis u1, u2 up to ur right here. Again, this is orthogonal basis for w. Then we say that the orthogonal projection of y onto w is given by the following. We'll call this projw of y, so p-r-o-j, short for projection there. We're projecting the vector y onto the subspace w here. Now projw of y is somewhat of a mouthful, so when the subspace w is clear from context, we'll just abbreviate this as y hat. The definition of y hat is going to be we're going to take the linear combination of the vectors u1 up to ur, right? So we take the basis for w. We're going to take a combination, a linear combination of these vectors. So this will belong to w. That's important to realize there. And then the coefficients are going to be the foyer coefficients. So ui dot y over ui dot ui. So those are going to be those foyer coefficients right there. In which case, then if you write that in more compact form, we would take the sum where i ranges from 1 to r, and we take the combination, we take all of the basis elements with the corresponding foyer coefficients. And so let me give you, and so this is called the orthogonal projection onto the subspace. Now in the very special case where w is just the span of a single non-zero vector, this would give you a one-dimensional subspace. We can talk about the projection of a vector onto a line. And so oftentimes in that situation, we'll call it projw of y as opposed to projw of w. And so you can do this, you can put like a spanning set for your space right down there. And so if it's just a single vector, we'll talk about the projection of a vector onto another vector. And this is a common occurrence here. And intuitively the idea is the following. You have some vector y right here, u, excuse me, and then you have your other vector y. In which case, then y casts a shadow on the direction of u. And the orthogonal projection is going to be that shadow. It's the vector that goes in the direction of u. That's the shadow cast here. And the reason why I call it orthogonal projection, we'll see very shortly that the angles between these vectors here is in fact a right angle. So let's see a quick example of this. Let's take y to be 173 and u to be the vector 211. So let's compute the orthogonal projection of y onto the vector u. Or we'll call it y hat for short. So the formula, since there's just a single vector here, the formula is we take the foyer coefficient u.y over u.u and times it by u. So the projection of y onto u will be a scalar multiple of u. It will be in the same direction that u is. So that sounds like horrible grammar, but let's go on anyways. So doing this calculation, we have to do u.y. So we get 2 plus 7 plus 3. And for the denominator, we're going to do u.u, which is going to be 4 plus 1 plus 1. Times that by u, which is 211. Like so. Simplifying here, 2 plus 7 plus 3 is a 12. 4 plus 1 plus 1 is a 6. And then we times that by 211. Like so. Well, 6 goes into 12 two times. So we get 2 times 211. And so the orthogonal projection y hat is going to look like the vector 4, 2, and 2. And so this gives us the projection of the vector right there. Again, drawing our picture. It's like we have our vector y right here. We had our vector u a little bit shorter. Like this, we had u. And then y hat would be this vector that's twice as long. So this is our y hat, which turned out to be 2 times u. What about this vector right here? I claim this is a right triangle after all. So what would this other vector be? So if I draw it so that the arrowhead is pointing up, this should be the vector y minus y hat. So let's quickly compute what that's going to look like. Y is off the screen right now. But if we take y minus y hat, y remember was 173. And then we're going to subtract from the vector we just found, which before 2 and 2. So this ends up giving us negative 3, 5, and 1. So let's consider this vector for a moment. It's very clear to see that if I take y hat and I add to it y minus y hat, clearly this is going to add up back to y, right? So you take your 4, 2, 2 plus negative 3, 5, 1. Again, that goes back to 173. That should be no surprise here, right? Because I mean, that's not for all how we computed y minus y hat. We subtracted. So if you put it back, the inverse operations and play here. But look at these two vectors. If I take y hat and I take the dot product with this y minus y hat. This is where it gets interesting. We get negative 3, 5, 1 dot the other vector. Oh, I wrote that. I wrote in the wrong order. Again, this doesn't make much of a difference for real vectors. But with complex vectors, you should be much more careful. So I do want to make sure I put this in the right order 4, 2, 2 dot negative 3, 5, 1. And I should also mention that for complex vectors, even if you switch the order around, if they were orthogonal, you'll get zero in both situations. So the dot product, we get a negative 12 plus two times five, which is a 10 plus two times one, which is a two. So we do in fact see we get a zero right here. So what this tells us is that if w is equal to the span of this vector you, then clearly our vector y hat was inside of w. I mean, remember, we noticed that y hat was just two times you. That's pretty clear. But to add to that, we see the following y minus y hat. This vector negative 3, 5, and 1, this belongs to the orthogonal complement of w because this vector was in fact, it was orthogonal to y hat, which also implies it'll be orthogonal to you. So when we found this orthogonal projection, this actually verifies the picture we had in mind right here that these two vectors y hat and y minus y hat are perpendicular to each other because their dot product turns out to be zero. It turns out that this principle is generally true. I mean, this is true all the time. If we have some vector y inside of vector space fn, and you take any subspace w of fn, then the orthogonal complement of y onto w, if you subtract it from the original vector y, this will always produce something in the orthogonal complement. In particular, the orthogonal projection of y is orthogonal to the difference of y with its orthogonal projection. These two vectors will always be perpendicular with each other.