projections and distances

 >up
figure showing the projection of b onto a
figure 1: a, b, and the projection of b onto a.

We've now spent some time talking about projections and distances. This is an attempt to summarize that in some way or another. Recall how we found the vector projection of a vector b onto a vector a (figure 1, to the right): we said that the length of the projection is |b| cos(theta), and so, because

|a| |b| cos(theta) = a . b,
we can divide both sides by |a| to get
|b| cos(theta) = the length of the projection = a . b / |a|
The actual vector projection is therefore a unit vector in the correct direction times this length, that is,
projab = (a / |a|)(a . b / |a|).

Next consider the other (unlabeled) vector in the figure. This is the orthogonal projection of b onto a, and its length is (hopefully obviously) |b| sin(theta). Recalling that

|a x b| = |a| |b| sin(theta),
we can find this length by dividing both sides by |a|:
|b| sin(theta) = |a x b| / |a|.
(Note that we can also find this by subtracting vectors: the orthogonal projection orthab = b - projab. Make sure this makes sense!)

Points and Lines

Now, suppose we want to find the distance between a point and a line (top diagram in figure 2, below). That is, we want the distance d from the point P to the line L. The key thing to note is that, given some other point Q on the line, the distance d is just the length of the orthogonal projection of the vector QP onto the vector v that points in the direction of the line! That is, we notice that the length d = |QP| sin(theta), where theta is the angle between QP and v. So

d = |QP x v| / |v|.
figure showing distance from a point to a line and from a point to a plane
figure 2: distances from a point to a line, and from a point to a plane.

Let's do an example. Suppose we want to know the distance between the point P = (1,3,8) and the line x(t) = -2 + t, y(t) = 1 - 2t, z(t) = -3 - t. We need some point ("Q") on the line—let's take the point (-2, 1, -3). Then a vector from this point on the line to the point P is <3, 2, 11>. This is the vector QP in the figure. We want the length d, which is

d = |QP| sin(theta) = |QP x v| / |v|
What's v? It's the vector that points along the line, which is just <1, -2, -1>. So
QP x v = 20 i + 14 j - 8 k
(work it out to be sure), so
|QP x v| = sqrt(400 + 196 + 64) = sqrt(660) = 2 sqrt(165)
and |v| = sqrt(1 + 4 + 1) = sqrt(6), so d = 2 sqrt(165) / sqrt(6) which is approximately 10.49.

Points and Planes

Ok, how about the distance from a point to a plane? We'll do the same type of thing here. Consider the lower diagram in figure 2. Here we're trying to find the distance d between a point P and the given plane. Again, finding any point on the plane, Q, we can form the vector QP, and what we want is the length of the projection of this vector onto the normal vector to the plane. But this is really easy, because given a plane we know what the normal vector is. So we can say

d = |QP| cos(theta)
but
|QP| cos(theta) = QP . n / |n|,
so
d = QP . n / |n|
(taking the absolute value as necessary to get a positive distance). Cool!

An example: find the distance from the point P = (1,3,8) to the plane x - 2y - z = 12. We need a point on the plane. Hmm. There sure are a lot of them to choose from. :) Let's pick something easy: I'll pick x = 3, y = -3 and z = -3. (Why? Just because they have to satisfy the equation x - 2y - z = 12, and I was picking numbers to try and keep x, y and z moderately small.) Then our point Q = (3,-3,-3). A vector from the plane to P is QP = <-2, 6, 11>, so

d = <-2, 6, 11> . <1, -2, -1> / |<1, -2, -1>|
(because we know that the components of n are the coefficients of x, y, and z in the equation for the plane), or
d = (-2 - 12 - 11) / sqrt(6)
= -25 / sqrt(6)
except that a distance should be positive, so we'll take the absolute value of this: d = 25 / sqrt(6), which is approximately 10.21.

Why did we use the angle theta opposite the component of the vector giving the distance in the case of the line, and the angle adjacent for the plane? It all has to do with what we know: in the case of the line, we already know the vector that points along the line, so if we start doing dot or cross products with this vector, the angle that's involved will be the angle we used. Similarly for a plane, the vector associated with the plane that we know is the normal, so we're interested in angles from this vector to other vectors.

 >up



Last modified: Mon Aug 31 9:40:00 EDT 2015
Comments to:glarose@umich.edu
©2004 Gavin LaRose, UM Math Dept.