d = ∣ b 1 × b 2 ∣ ∣ ( a 2 − a 1 ) ⋅ ( b 1 × b 2 ) ∣
On this page
Before you start
This page is easier if you are comfortable with:
What Shortest distance between skew lines means
Skew lines are not parallel and do not meet. The shortest distance is measured along the direction perpendicular to both, which is the cross product of the two direction vectors .
Project the vector joining a point on each line onto this common perpendicular. The scalar product with the unit normal n /∣ n ∣ does exactly that, giving the formula.
If n is the zero vector, the lines are parallel and you use the point-to-line distance instead. If the projection is zero the lines meet.
What is it used for? Skew lines pass each other without meeting. The shortest distance between them is along the segment that is perpendicular to both.
Finding the clearance between two pipes, cables or flight paths. Checking that lines in a 3D model do not collide. Understanding the 3D version of point-to-line distance .
How to use shortest distance between skew lines
Write each line in the form a + λ d . Compute n = d 1 × d 2 . Find a 2 − a 1 and its scalar product with n . Divide the absolute value by ∣ n ∣ .
Graph Two lines passing at height 3 (viewed from above) crossing: 3 units apart -3 -2 -1 0 1 2 3 4 5 -3 -2 -1 0 1 2 3 4 5 Two lines passing at height 3 (viewed from above) x y line 1 Graph with x from -3 to 5 and y from -3 to 5. Shows the curve line 1; point crossing: 3 units apart at (2, 0). Viewed from above the lines appear to cross, but one is 3 units above the other, so the shortest distance is 3.
Worked examples
These examples are worked by hand, step by step, so you can compare your own working.
Example 1: perpendicular lines Find the distance between r = λ ( 1 , 0 , 0 ) and r = ( 0 , 0 , 1 ) + μ ( 0 , 1 , 0 ) .
Worked example
n = (1,0,0) × (0,1,0)
( 0 , 0 , 1 )
a₂ − a₁ = (0,0,1)
∣ ( 0 , 0 , 1 ) ⋅ ( 0 , 0 , 1 ) ∣ = 1
Example 2: lines at height 3 Find the distance between r = ( 1 , 0 , 0 ) + λ ( 0 , 1 , 0 ) and r = ( 0 , 0 , 3 ) + μ ( 1 , 0 , 0 ) .
Worked example
n = (0,1,0) × (1,0,0)
( 0 , 0 , − 1 )
a₂ − a₁ = (−1,0,3)
∣ ( − 1 , 0 , 3 ) ⋅ ( 0 , 0 , − 1 ) ∣ = 3
Example 3: a slanted pair Find the distance between r = λ ( 1 , 1 , 0 ) and r = ( 1 , 0 , 0 ) + μ ( 0 , 1 , 1 ) .
Worked example
Answer
1 3 ≈ 0.577 \dfrac{1}{\sqrt3}\approx0.577 3 1 ≈ 0.577 n = (1,1,0) × (0,1,1)
( 1 , − 1 , 1 )
a₂ − a₁ = (1,0,0)
Special cases
A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.
d₁ = (1, 0, 0), d₂ = (0, 1, 0) n = d₁ × d₂ third component
1.
a₂ − a₁ = (0, 0, 3) (a₂ − a₁)·n
3.
distance 3/|n|
3.
a₂ − a₁ = (1, 2, 5) distance
5.
Word problems
Distance = |(a₂ − a₁)·n|/|n| where n = d₁ × d₂ is perpendicular to both lines.
n d₁ × d₂ = (0, 0, 1).
1 Check: ✓ 1
Dot product (0, 0, 3)·(0, 0, 1).
3 Check: ✓ 3
Distance Higher 3/1.
3 Check: ✓ 3
Other offset Higher a₂ − a₁ = (1, 2, 5).
|5|/1 Check: ✓ 5
Common mistakes
Forgetting to divide by |n| dot only ✗
divide by |n| ✓
Unit normal.
Using d₁ + d₂ sum ✗
cross product ✓
Perpendicular.
Parallel lines use this formula ✗
n = 0, use another method ✓
Degenerate.
Forgetting absolute value negative ✗
|…| ✓
Distance.
Exam tips
n = d₁ × d₂.
Project a₂ − a₁ onto n.
|·|/|n|.
n = 0 ⇒ parallel lines.
Check with a diagram.
Practice questions
Try each one on paper, then open the answer. Use the solver above to see the full working.
1. Distance: a₂ − a₁ = (0, 0, 7), n = (0, 0, 1) Foundation 7
2. Distance: a₂ − a₁ = (2, 0, 4), n = (0, 0, 2) Foundation 4
3. Distance: a₂ − a₁ = (1, 1, 6), n = (0, 0, 3) Foundation 6
4. n_z for d₁ = (1, 0, 0), d₂ = (0, 2, 0) Higher 2
5. Distance: a₂ − a₁ = (3, 4, 0), n = (0, 0, 1) Higher 0
6. Distance: (a₂ − a₁)·n = −12, |n| = 4 Higher 3
Practice generator Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.
Foundation Higher Mixed New question
Solve: …
The practice generator needs JavaScript.
Key terms
Skew lines Non-parallel, non-intersecting. Common perpendicular Shortest connector. Cross product d₁ × d₂. Direction vector d. Projection (a₂ − a₁)·n̂. Position vector a.
Frequently asked questions
What is the shortest distance between skew lines? |(a₂ − a₁)·n|/|n| with n = d₁ × d₂.
What are skew lines? Lines that are neither parallel nor intersecting.
What if n = 0? The lines are parallel.
Why a cross product? The common perpendicular is perpendicular to both directions.
Which page covers point-to-line distance? distance from a point to a line.
Which page covers the vector form? vector equation of a line.