Main content
Course: Linear algebra > Unit 3
Lesson 2: Orthogonal projections- Projections onto subspaces
- Visualizing a projection onto a plane
- A projection onto a subspace is a linear transformation
- Subspace projection matrix example
- Another example of a projection matrix
- Projection is closest vector in subspace
- Least squares approximation
- Least squares examples
- Another least squares example
© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice
Visualizing a projection onto a plane
Visualizing a projection onto a plane. Showing that the old and new definitions of projections aren't that different. Created by Sal Khan.
Want to join the conversation?
- Thank you for the video it was very helpfull.
what I fail to understand is that is it mathematically correct to say that the projection of a vector V into another W is the length of the component of V in the direction of W?(2 votes)- Yes, the projection of V onto W is just the projection of V's component in the direction of W.
You can think about this easier as the dot product of V▪W which measures how much of V is projected along W.(2 votes)
- Is the vector X parallel to plane V? I'm getting confused here..(2 votes)
- No. Vector x passes through the origin and heads up out of the plane V at perhaps a 40 degree angle as drawn. Don't feel bad. Understanding anything in 3-space from a drawing that of course has to be flat like your computer screen is difficult. In this case I should also add that what I called the origin should be thought of as the zero vector.(1 vote)
- What do you mean by orthogonal to everything in L? I think there is only one thing (one vector) in L which the residual vector can be orthogonal to.(2 votes)
- For a question relating orthogonal projection and linear regression, why does the orthogonal projection of the training data into the column space of X minimize the total error in the predictions of the model?(2 votes)
- sorry I might have a misunderstanding on a detail the schema of1:46on the vector substraction.
the Vector: x - projection_of_X_in_L
shouldn't it start from the x beginning and end in the tip of -projection_of_X_in_L ?
It seemd like it is starting from the tip of X and finishes on the tip of projection_of_X_in_L .
What do I get wrong ? :/
ps thanks for tha amazing videos(2 votes)- The diagram in the video is correct. Since it is x MINUS proj_L(x), this is why.
If the vector were x PLUS proj_L(x), and the vectors were placed with the beginning of proj_L(x) at the end of the vector x (think of proj_L(x) as just another vector, maybe u), then the sum of the vectors would indeed be from the beginning of x to the end of the projection.
Since we have x - proj_L(x), we could think about flipping the projection vector 180 degrees from its tip (to turn it into the negative version of itself, so we can add it to x), and then placing this at the top of the x- vector. Then moving from the start of x to the tip of the (flipped) projection, we see that this movement is identical to the yellow vector (x-proj_L(x)) in the diagram.
In general, a trick that I use (but always good to be comfortable with the basic method) is if I have vectors a and b, both starting at a common origin (like we have in this diagram), then the vector b-a will move from the tip of a to the tip of b. (You can check that this is what we have in the diagram).
Hope this helped!(1 vote)
- Thank you for the videos! When I watch them it all makes sense, but I am having some problems with translating this sense into actual problem solving.
My problem (That I wish to both compute and understand the solution of) is i´m having four vectors in R3. I use two of the vectors to create a plane and the normal vector for that plane.
Now I want to project the remaining two vectors onto my newly created plane and calculate the angle between the projected vectors.
I feel like this should be possible using what I have learned in the videos so far, but I cant figure out what the coordinates of the projected lines are, and without the coordinates I dont know how to compute the angle between the projected vectors.
I guess there is no easy explanation to my problem, but can you direct me to some videos where I can learn this and some assignments where I can practice what I learn?
Thanks in advance.(1 vote)- I think I have a way to find the projections onto the plane.
You know the normal vector to the plane. Therefore, you know the orthogonal complement to the plane, which is a line. We already know how to project vectors onto a line.
We also know that an arbitrary vector x can be expressed as a unique sum of a vector in a subspace v and a vector in its orthogonal complement w.
You are given x. You can find w. Therefore, you can find v, the projection of x onto the plane.
You should be able to work from there.(2 votes)
- Hello,
Can someone explain me in 3D geometry most basic version?? For example, if say two points X and Y are given and are joined to form a line..(3 D line). Then how we know the length of the projection of the line segment XY in the plane, say x + y + z=d ?
{Unfortunately, I could understand some part of the video}(1 vote)- What you've described is actually a relatively intensive problem, but let's give it a shot.
We have two arbitrary points in space, (p₁, q₁, r₁) and (p₂, q₂, r₂), and an arbitrary plane, ax+by+cz=d. We want the distance between the projections of these points into this plane.
A strategy might look like this:
1) Find the normal vector to the plane
2) Find equations of lines perpendicular to this plane through the given points.
3) Find the intersections of these lines with our plane (these are the projected points)
4) Compute the distance between them.(2 votes)
- this might sound pedantic, but we should say that x - projvx is also unique?(1 vote)
- Just curious: When we see a plane and an orthogonal line in R3, how can we tell if those are rowspace and nullspace of a 3x3 transformation, or of a 2x3 transformation?(1 vote)
- In projection formula, (x.v)/(v.v), what if x is bigger than v?(1 vote)
Video transcript
I'm going to do one more video
where we compare old and new definitions of a projection. Our old definition of a
projection onto some line, l, of the vector, x, is the vector
in l, or that's a member of l, such that x minus
that vector, minus the projection onto l of x,
is orthogonal to l. So the visualization is, if
you have your line l like this, that is your line
l right there. And then you have some other
vector x that we're take the projection of it on to l. So that's x. The projection of x onto l,
this thing right here, is going to be some vector in l. Such that when I take the
difference between x and that vector, it's going to
be orthogonal to l. So it's going to be
some vector in l. This was our old definition when
we took the projection onto a line. Some vector in l. Maybe it's there. And if I take the difference
between that and that, this difference vector's going
to be orthogonal to everything in l. Just like that. So, this right here would be
it's difference vector. That would be x minus the
projection of x onto l. And then, of course, this
vector right here. This is the one we
were defining it. That was the projection
onto l of x. Now, what's a different
way that we could have written this? We could have written this
exact same definition. We could have said it is the
vector in l such that-- so we could say, let me write
it here in purple. Is the vector v in l such that
v-- let me write it this way-- such that x minus v, right? x minus the projection of l is
orthogonal is equal to w, which is orthogonal to
everything in l. Being orthogonal to l literally
means being orthogonal to every
vector in l. So I just rewrote it a little
bit different, instead of just leaving it as a projection
of x onto l. I said hey, that's some vector,
v, in l such that x minus v is equal to some other
vector, w, which is orthogonal to everything in l. Or we can rewrite that statement
right there as x is equal to v plus w. So we can just say that the
projection of x onto l is the unique vector v in l, such that
x is equal to v plus w, where w is a unique vector-- I
mean it is going to be unique vector-- in the orthogonal
complement of l. Right? This is got to be orthogonal
to everything in l. So that's going to be a member
of the orthogonal complement of l. So this definition is actually
completely consistent with our new subspace definition. And we could just extend
it to arbitrary subspaces, not just lines. Let me help you visualize
that. So let's say we're dealing
with R3 right here. And I've got some
subspace in R3. And let's say that subspace
happens to be a plane. I'm going to make it a plane
just so that it becomes clear that we don't have to take
projections just onto lines. So this is my subspace
v right there. Let me draw its orthogonal
compliment. Let's say its orthogonal
complement looks something like that. Let's say it's a line. And then it goes-- it intersects
right there. Then it goes back. And, of course, it would have to
intersect at the 0 vector. That's the only place where a
subspace and its orthogonal complement overlap. And then it goes behind
and you see it again. Obviously you wouldn't be able
to you again because this plane would extend in
every direction. But you get the idea. So this right here
is the orthogonal complement of v, that line. Now, let's have some other
arbitrary vector in R3 here. So let's say I have some vector
that looks like that. Let's say that that is x. Now our new definition for the
projection of x onto v is equal to the unique vector v. This is a vector v. That's a subspace v. The unique vector v, that is a
member of v, such that x is equal to v plus w, where w
is a unique member of the orthogonal complement of v. This is our new definition. So, if we say x is equal to
some member of v and some member of its orthogonal
complement-- we can visually understand that here. We could say, OK it's going to
be equal to, on v, it'll be equal to that vector
to right there. And then on v's orthogonal
complement, you add that to it. So, if you were to shift it
over, you would get that vector, just like that. This right here is v. That right there is v. And then this is vector that
goes up like this, out of the plane, orthogonal to
the plane, is w. You could see if you take v plus
w, you're going to get x. And you could see that v is
the projection onto the subspace capital v-- so this
is a vector, v-- is the projection onto the subspace
capital V of the vector x. So the analogy to a shadow
still holds. If you imagine kind of a light
source coming straight down onto our subspace, kind of
orthogonal to our subspace, the projection onto our subspace
is kind of the shadow of our vector x. Hopefully that help you
visualize it a little better. But what we're doing here is
we're going to generalize it. Earlier in this video
I showed you a line. This is a plane. But we can generalize
it to any subspace. This is in R3. We can generalize it
to Rn, to R100. And that's really the power
of what we're doing here. It's easy to visualize it here,
but it's not so easy to visualize it once you get
to higher dimensions. And actually, one other thing. Let me show that this new
definition is pretty much almost identical to exactly
what we did with lines. This is identical to saying that
the projection onto the subspace x is equal to some
unique vector in V such that x minus the projection onto v of
x is orthogonal to every member of V. Because this statement, right
here, is saying any vector that's orthogonal to any member
of v says that it's a member of the orthogonal
complement of v. So that statement could be
written as x minus the projection onto v of x is a
member of v's orthogonal complement. Or we could call some w. So if you call this your v,
and if you call this whole thing your w, you get this exact
definition right there. You would have w is equal
to x minus v. And then if you add v to both
sides, you get w plus v is equal to x. We defined v to be, the
orthogonal-- the projection of x onto v. w is a member of our orthogonal
complement. And I don't want you
to get confused. The vector v is the orthogonal
projection of our vector x onto the subspace capital V. I probably should use different
letters instead of using a lowercase and
a uppercase v. It makes the language
a little difficult. But I just wanted to give you
another video to give you a visualization of projections
onto subspaces other than lines. And to show you that our old
definition, with just a projection onto a line which was
a linear transformation, is essentially equivalent
to this new definition. On the next video, I'll show
you that this, for any subspace is, indeed, a linear
transformation.