Distances and projection (HL)

The notation of projections will not appear in exams, but knowledge of scalar projections may still be assessed. Knowing why the formulas work makes them so much easier to remember.

The formulas should be used only after the intersections between the lines and/or planes have been characterized in the question, or through previous parts. Lines or planes that intersect have distance 0.

Last edited: 2026-06-21 make equations of lines more consistent

Contents

Projection

The scalar projection of vector a\bm a onto vector b\bm b, where the angle between the vectors is θ\theta, is

s=acosθ=abcosθb=abb\begin{align*} s &= \left\lvert\bm a \right\rvert \cos\theta \\ &= \frac{\left\lvert\bm a \right\rvert \lvert \bm b \rvert \cos\theta}{\lvert \bm b\rvert} \\ & = \frac{\bm a \cdot \bm b}{\lvert\bm b\rvert} \end{align*}
 	
magnitude of A times cos theta is along vector B
Wikipedia: Scalar projection of A onto B

For distance, we want the absolute value so

D=abbD = \frac{\left\lvert\bm a \cdot \bm b\right\rvert}{\lvert\bm b\rvert}

In most of the formulas below, we project a displacement vector of two points onto the direction of the distance, which is colored in purple.

Point and plane

Given some point (position vector) PP and vector equation of plane

rn=an=ax+by+cz=d\bm r \cdot \bm n = \bm a \cdot \bm n = ax + by + cz = d

We want to project OPa\overrightarrow{OP} - \bm a onto n\bm n

D=(OPa)nn=OPnann=OPndn\begin{align*} D &= \frac{\left\lvert(\overrightarrow{OP} - \bm a) \cdot \bm n\right\rvert}{\lvert\bm n\rvert} \\ &= \frac{\left\lvert\overrightarrow{OP} \cdot \bm n - \bm a \cdot \bm n\right\rvert}{\lvert\bm n\rvert} \\ &= \frac{\left\lvert\overrightarrow{OP}\cdot \bm n - d\right\rvert}{\lvert\bm n\rvert} \end{align*}

So we don’t actually need to find a point on the plane.

Note, distance between a line and a parallel plane is also this, where PP is a given point on the line.

 	
With a point A on a plane, the distance is projecting AP onto n
projecting AP onto n

Two parallel planes

Similar to above, but using both constants on the right side.

rn=d1\bm r \cdot \bm n = d_1
rn=d2\bm r \cdot \bm n = d_2
D=d2d1nD = \frac{\left\lvert d_2 - d_1\right\rvert}{\lvert\bm n\rvert}

Note the two normal vectors must be identical, not just parallel.

Two skew lines

Given two lines

r1=a+λd1\bm {r_1} = \bm a + \lambda \bm {d_1}
r2=b+μd2\bm {r_2} = \bm b + \mu \bm {d_2}

Even if the same parameter is given for both lines, you need to assume they are different if you want distance between two lines not two paths.

Distance is always perpendicular to the line. So we want to project AB=ba\overrightarrow{AB} = \bm b - \bm a onto the cross product d1×d2\bm{d_1} \times \bm{d_2}

D=(ba)(d1×d2)d1×d2D = \frac{\left\lvert(\bm b - \bm a) \cdot (\bm{d_1} \times \bm{d_2})\right\rvert}{\lvert \bm{d_1} \times \bm{d_2}\rvert}

This works because r1\bm {r_1} and r2\bm {r_2} are on parallel planes, then the problem becomes equivalent to projecting AB\overrightarrow{AB} along the normal to find the distance between the two planes.

 	
r1 and r2 are on parallel planes. distance of the skew lines is the distance between the planes.
projecting AB onto the cross product

Two parallel lines

Given two lines

r1=a+λd\bm {r_1} = \bm a + \lambda \bm d
r2=b+μd\bm {r_2} = \bm b + \mu \bm d

The cross product of scalar multiples of vectors, is 0\vec 0. So we cannot use the skew lines formula. The two direction vectors we have are AB=ba\overrightarrow{AB} = \bm b - \bm a and d\bm d. Instead of finding cosθ\cos \theta and adjacent side, we need to find the sinθ\sin \theta and opposite side. So we use instead the cross product

D=(ba)×ddD = \frac{\left\lvert(\bm b - \bm a) \times \bm d\right\rvert}{\lvert \bm d \rvert}
 	
distance is perpendicular to the given direction, so we want the opposite side
distance is along the opposite side in the right triangle

We can use the same formula for distance between a point and a line.

Two linear trajectories

Or nearest approach between two objects in linear, constant-velocity, motion.

This is different from distance of skew lines because the nearest approach may not necessarily be the shortest distance between the lines.

Given two trajectories

r1(t)=a+tv1\bm {r_1}(t) = \bm a + t\bm {v_1}
r2(t)=b+tv2\bm {r_2}(t) = \bm b + t\bm {v_2}

Where v1\bm {v_1} and v2\bm {v_2} are velocity vectors. The parameters are the same, and are often tt for time.

With r2(t)r1(t)\lvert\bm {r_2}(t) - \bm {r_1}(t)\rvert as the distance, solve

 d dtr2(t)r1(t)=0\frac{\d}{\d t}\lvert\bm {r_2}(t) - \bm {r_1}(t)\rvert = 0

This is minimizing a square root function. However, mathematically speaking, it is easier to minimize the square of the distance

 d dtr2(t)r1(t)2=0\frac{\d}{\d t} \lvert\bm {r_2}(t) - \bm {r_1}(t)\rvert^2 = 0

with each component a function of time. Then take the square root for the distance.