
Distances
Distance Between a Point and a Line
To calculate the shortest distance between a point and a line we use the perpendicular perp(based on the projection proj).
Given a point Q(q1,q2,…,qn) and a line in vector form l: x=P+t d, the distance from point Q to line l is given by:
Steps
- Find the vector PQ=Q−P
- Find the projection of PQ onto the line's direction vector d: projd PQ = (d⋅dPQ⋅d)d
- Find the perpendicular vector: perpd PQ = PQ−projd PQ
- The shortest distance from point Q to line l is the norm of the perpendicular: distance(Q,l)=perpdPQ
Geometrically

Distance Between a Point and a Hyperplane
We use a slightly different method to find the shortest distance between a point and a hyperplane in Rn.
Given a point Q(q1,q2,…,qn) and a plane in standard form Π: a1x1+a2x2+⋯+anxn=b, the distance from point Q to plane Π is given by:
Steps
- Find any point P on the plane (it's often easiest to let all but one component be 0 and solve for the third).
- Find the vector PQ=Q−P
- Find the projection of PQ onto the hyperplane's normal vector n=⟨a1,a2,…,an⟩ : projn PQ = (n⋅nPQ⋅n)n
- The shortest distance from point Q to hyperplane Π is the norm of the projection: distance(Q,Π)=projn PQ
Geometrically


Example: Distance Between Parallel Lines
Find the shortest distance between the parallel lines:
l1: ⟨x,y,z⟩=⟨4,11,5⟩+t⟨1,1,−2⟩
l2: ⟨x,y,z⟩=⟨0,9,8⟩+s⟨−1,−1,2⟩
Distance Between Parallel Lines
Note that the direction vector d2=−d1, so the lines are indeed collinear. ✓
Since the lines are parallel, we can use any point on l2: choose Q(0,9,8).
Then the problem boils down to finding the distance between point Q and line l1. (We can forget about l2 entirely!)
Distance Between a Point and a Line
Choose any point on l1: P(4,11,5)
PQ=⟨0,9,8⟩−⟨4,11,5⟩=⟨−4,−2,3⟩
Find the projection of PQ onto the direction vector of the line d=⟨1,1,−2⟩:
projd PQ=(d⋅dPQ⋅d)d=(⟨1,1,−2⟩⋅⟨1,1,−2⟩⟨−4,−2,3⟩⋅⟨1,1,−2⟩)⟨1,1,−2⟩=6−12⟨1,1,−2⟩=⟨−2,−2,4⟩
Subtract the projection from PQ to find the perpendicular vector:
perpd PQ = PQ−projd PQ= ⟨−4,−2,3⟩−⟨−2,−2,4⟩= ⟨−2,0,−1⟩
The norm of this vector is the shortest distance between the parallel lines:
perpd PQ=∥⟨−2,0,−1⟩∥=(−2)2+02+(−1)2=5

Example: Distance Between a Point and a Plane
Find the shortest distance between the plane Π: x−3y−z=−6 and the point A(1,1,2).
The normal vector to the plane can be read from the LHS: n=⟨1,−3,−1⟩
1. Choose any point on the plane:
Setting y=z=0 we can easily solve to find x=−6 . This gives us the point P(−6,0,0).
2. Find PA=⟨1,1,2⟩−⟨−6,0,0⟩=⟨7,1,2⟩
3. Project PA onto n:
projn PA=(n⋅nPA⋅n)n=(⟨1,−3,−1⟩⋅⟨1,−3,−1⟩⟨7,1,2⟩⋅⟨1,−3,−1⟩)⟨1,−3,−1⟩=112⟨1,−3,−1⟩=⟨112, −116, −112⟩
4. The norm of this vector is the distance between A and the plane:
distance(A,Π)=====⟨112,−116,−112⟩(112)2+(−116)2+(−112)21214+36+4114411211
Practice: Distance Between Parallel Planes
Find the distance between the two parallel planes 5x−y−2z=6 and 5x−y−2z=−4.