The shortest distance between two lines · Mathematics… | StemPy Lab
Course 15.2·Lesson 2 of 3
The shortest distance between two lines
The shortest distance between two skew lines is measured along their common perpendicular. Its direction is b1×b2
Lesson 2 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
What you will be able to do
find the shortest distance between two skew lines in vector and in Cartesian form;
find the distance between two parallel lines;
find the direction of the common perpendicular.
The closest two cables come
Take two skew cables. Pick a point on each and measure how far apart they are. Different pairs of points give different distances. Is there a smallest distance? Yes, and it is the length of the segment that is perpendicular to both cables. This segment is the common perpendicular, and the shortest distance is its length.
A three-dimensional picture of two skew lines. A blue line lies along the x-axis. A green line runs above it at a height h in another horizontal direction. A short red segment joins the two lines at right angles to both. It is the common perpendicular. Its length is the shortest distance d.
The formula for skew lines
The direction of the common perpendicular must be at right angles to b1 and to b2. The cross product n=b1×b2 has exactly this property. The vector a2−a1 joins a point of line 1 to a point of line 2. The shortest distance is the length of the projection of a2−a1 along n:
d=∣b1×b2∣∣(a2−a1)⋅(b1×b2)∣.
The numerator is the triple product from the last lesson. So d=0 exactly when the lines are coplanar and not parallel, which means that the lines meet.
In Cartesian form, with the lines of the last lesson, the numerator is the determinant with rows (x2−x1,y2−y1,z2−z1), (a1,b1,c1) and (a2,b2,c2). The denominator is the length of the cross product b1×b2. Its components are P=b1c2−b2c1, Q=c1a2−c2a1 and R=a1b2−a2b1, so the length is P2+Q2+R2.
A-Level and IB books reach the same number in another way. They write a general vector PQ between a point P of one line and a point Q of the other, and make it perpendicular to both directions. The two methods give the same distance.
The formula for parallel lines
If the lines are parallel, then b1×b2=0 and the formula above fails. Now both lines have the direction b, and the distance between them is the distance of a point of one line from the other line:
d=∣b∣∣(a2−a1)×b∣.
A worked example
Find the shortest distance between r=(i^−j^+2k^)+λ(i^+2j^+2k^) and r=(−i^+3j^+2k^)+μ(2i^+j^−2k^).
The directions and the points.b1=(1,2,2), b2=(2,1,−2). Then a2−a1=(−2,4,0).
The cross product.b1×b2=(2×(−2)−2×1,2×2−1×(−2),1×1−2×2)=(−6,6,−3).
Its length.36+36+9=9.
The dot product.(−2,4,0)⋅(−6,6,−3)=12+24+0=36.
The distance.d=936=4 units.
A parallel pair. The lines 2x−1=3y−2=6z−3 and 2x−6=3y+1=6z−11 have b=(2,3,6), ∣b∣=7 and a2−a1=(5,−3,8). The cross product (5,−3,8)×(2,3,6) is (−42,−14,21), whose length is 49. So d=749=7 units.
Practise with new numbers
Try it in Python
The program finds the shortest distance between two lines. It uses the formula for skew lines, and it switches to the formula for parallel lines when the cross product is zero.
Common mistakes
Forgetting the length of n. The triple product alone is a volume, not a distance.
Using the skew formula for parallel lines. The denominator becomes 0. Use the parallel formula.
Dropping the modulus. A distance is never negative.
Mixing up the two cross products. In the skew formula the cross product is b1×b2. In the parallel formula it is (a2−a1)×b.
Remember these
Skew lines: d=∣b1×b2∣∣(a2−a1)⋅(b1×b2)∣.
Parallel lines: d=∣b∣∣(a2−a1)×b∣.
The direction of the common perpendicular is b1×b2.
d=0 for lines that are not parallel means that they meet.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Find the shortest distance between the x-axis and the line through (2,0,5) parallel to the y-axis.
Find the distance between the x-axis and the line through (0,3,4) parallel to the x-axis.
Find the shortest distance between the line through the origin with direction (1,1,0) and the line through (2,0,1) with direction (0,1,1).
Why does the cross product b1×b2 give the direction of the common perpendicular?
Two lines that are not parallel have shortest distance 0. What can you say about them?
References
OpenStax, Calculus Volume 3, Chapter 2, section on equations of lines and planes in space (distance between skew lines).
NCERT, Mathematics Part II for Class XII, Chapter 11, section on the shortest distance between two lines.
Enroll free in Skew Lines and Shortest Distances
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.