• Foundation
  • About 22 min
  • 5 practice questions

Shortest distance between two lines

Tell intersecting, parallel and skew lines apart, and find the shortest distance between skew lines and between parallel lines using vector formulas.

If something looks wrong, please tell us.

In a plane two lines either meet or are parallel. In space there is a third possibility. Think of a flyover road crossing above a railway line at an angle: the two never meet, yet they are not parallel. Such lines are called skew lines. This lesson finds how close two lines in space come to each other.

Three kinds of pairs of lines

Two lines in space

  • Intersecting
    • Meet at a point
    • Coplanar
    • Shortest distance = 0
  • Parallel
    • Same direction, never meet
    • Coplanar
    • Distance = perpendicular distance
  • Skew
    • Not parallel and never meet
    • Not coplanar
    • Shortest distance along the common perpendicular

The shortest distance between two lines is the length of the shortest segment joining a point of one line to a point of the other. For skew lines this segment is perpendicular to both lines.

Distance between skew lines

Let l₁: r = a₁ + λb₁ and l₂: r = a₂ + μb₂ be skew. Let S (position vector a₁) be on l₁ and T (position vector a₂) be on l₂, so ST = a₂ − a₁. The line of shortest distance PQ is perpendicular to both b₁ and b₂, so it is parallel to b₁ × b₂, with unit vector n̂ = (b₁ × b₂)/|b₁ × b₂|. The shortest distance d is the length of the projection of ST on this common perpendicular: d = |ST · n̂|. Hence:

Skew lines r = a₁ + λb₁ and r = a₂ + μb₂: d = |(b₁ × b₂) · (a₂ − a₁)| / |b₁ × b₂|. If this is 0 (and the lines are not parallel), the lines intersect.

In Cartesian form, for (x − x₁)/a₁ = (y − y₁)/b₁ = (z − z₁)/c₁ and (x − x₂)/a₂ = (y − y₂)/b₂ = (z − z₂)/c₂, the numerator is the absolute value of the 3 × 3 determinant with rows (x₂ − x₁, y₂ − y₁, z₂ − z₁), (a₁, b₁, c₁), (a₂, b₂, c₂), and the denominator is √[(b₁c₂ − b₂c₁)² + (c₁a₂ − c₂a₁)² + (a₁b₂ − a₂b₁)²]. This is the same formula written with coordinates.

Distance between parallel lines

If l₁: r = a₁ + λb and l₂: r = a₂ + μb are parallel (same b), then b₁ × b₂ = 0 and the formula above fails. Instead, drop a perpendicular TP from T (on l₂) to l₁. If θ is the angle between ST and b, then the distance is |ST| sin θ = |b × ST|/|b|. So:

Parallel lines r = a₁ + λb and r = a₂ + μb: d = |b × (a₂ − a₁)| / |b|.

Finding the shortest distance

  1. Read a₁, b₁, a₂, b₂ from the equations
  2. Are b₁ and b₂ parallel?
  3. If not: compute b₁ × b₂ and (b₁ × b₂) · (a₂ − a₁)
  4. If parallel: compute b × (a₂ − a₁)
  5. Divide by the right magnitude and take the absolute value

Worked examples

Worked example 1: skew lines in vector form

Find the shortest distance between r = (î + 2ĵ + k̂) + λ(î − ĵ + k̂) and r = (2î − ĵ − k̂) + μ(2î + ĵ + 2k̂). Here b₁ = (1, −1, 1), b₂ = (2, 1, 2). b₁ × b₂ = î[(−1)(2) − (1)(1)] − ĵ[(1)(2) − (1)(2)] + k̂[(1)(1) − (−1)(2)] = −3î + 0ĵ + 3k̂, with |b₁ × b₂| = √18 = 3√2. a₂ − a₁ = î − 3ĵ − 2k̂. (b₁ × b₂) · (a₂ − a₁) = −3 + 0 − 6 = −9. So d = |−9|/(3√2) = 3/√2 = (3√2)/2 units.

Worked example 2: skew lines in Cartesian form

Find the shortest distance between (x − 1)/1 = (y + 1)/2 = (z − 2)/(−1) and (x − 2)/2 = (y − 1)/1 = (z + 1)/1. Points: (1, −1, 2) and (2, 1, −1), so a₂ − a₁ = (1, 2, −3). Directions: b₁ = (1, 2, −1), b₂ = (2, 1, 1). b₁ × b₂ = î[(2)(1) − (−1)(1)] − ĵ[(1)(1) − (−1)(2)] + k̂[(1)(1) − (2)(2)] = 3î − 3ĵ − 3k̂, magnitude 3√3. Dot product with (1, 2, −3): 3 − 6 + 9 = 6. So d = 6/(3√3) = 2/√3 = (2√3)/3 units.

Worked example 3: parallel lines

Find the distance between r = (î + ĵ) + λ(2î − ĵ + 2k̂) and r = (2î + ĵ − k̂) + μ(2î − ĵ + 2k̂). They are parallel with b = 2î − ĵ + 2k̂, |b| = 3. a₂ − a₁ = î + 0ĵ − k̂. b × (a₂ − a₁) = î[(−1)(−1) − (2)(0)] − ĵ[(2)(−1) − (2)(1)] + k̂[(2)(0) − (−1)(1)] = î + 4ĵ + k̂, magnitude √18 = 3√2. So d = 3√2/3 = √2 units.

Worked example 4: lines that meet

Show that r = λ(î + ĵ + k̂) and r = (î + k̂) + μĵ intersect. b₁ × b₂ = (1, 1, 1) × (0, 1, 0) = −î + 0ĵ + k̂, and a₂ − a₁ = î + k̂. The dot product is −1 + 0 + 1 = 0, so d = 0 and, since the lines are not parallel, they intersect. Indeed λ = 1 and μ = 1 both give the point (1, 1, 1).

Key takeaways

  • Lines in space intersect, are parallel, or are skew (neither).
  • Skew lines: d = |(b₁ × b₂) · (a₂ − a₁)| / |b₁ × b₂|.
  • Parallel lines: d = |b × (a₂ − a₁)| / |b|.
  • A zero shortest distance between non-parallel lines means they intersect.
  • Check the cross product by confirming it is perpendicular to both direction vectors.

Check your understanding

  1. 1. What is the shortest distance between two lines that intersect?

    1. 0
    2. 1
    3. It cannot be found
    4. It is infinite
    Show answer

    Answer: A. Intersecting lines share a point, so the shortest segment joining them has length 0.

  2. 2. For skew lines r = a₁ + λb₁ and r = a₂ + μb₂, the shortest distance is

    1. |(a₂ − a₁) × b₁| / |b₁|
    2. |b₁ · b₂| / (|b₁| |b₂|)
    3. |a₂ − a₁|
    4. |(b₁ × b₂) · (a₂ − a₁)| / |b₁ × b₂|
    Show answer

    Answer: D. The common perpendicular is along b₁ × b₂, and the distance is the length of the projection of a₂ − a₁ on it. |(a₂ − a₁) × b₁| / |b₁| is the formula for parallel lines, and |b₁ · b₂| / (|b₁| |b₂|) gives cos θ.

  3. 3. What is the distance between the parallel lines r = λk̂ and r = 3î + 4ĵ + μk̂?

    1. 7
    2. 5
    3. 25
    4. √7
    Show answer

    Answer: B. b = k̂ with |b| = 1, and a₂ − a₁ = 3î + 4ĵ. b × (a₂ − a₁) = k̂ × (3î + 4ĵ) = 3ĵ − 4î, of magnitude 5. So d = 5/1 = 5 units.

  4. 4. What is the shortest distance between the x-axis and the line r = 3k̂ + μĵ?

    1. 0
    2. √3
    3. 3
    4. 9
    Show answer

    Answer: C. b₁ = î, b₂ = ĵ, b₁ × b₂ = k̂ with magnitude 1; a₂ − a₁ = 3k̂. d = |k̂ · 3k̂|/1 = 3. The second line runs parallel to the y-axis at height 3 above the x-axis.

  5. 5. Assertion (A): Two lines in space that do not intersect must be parallel. Reason (R): Skew lines are lines in space that are neither parallel nor intersecting.

    1. Both A and R are true, and R is the correct explanation of A
    2. Both A and R are true, but R is not the correct explanation of A
    3. A is true, but R is false
    4. A is false, but R is true
    Show answer

    Answer: D. R is the definition of skew lines. Their existence shows that A is false: in space, non-intersecting lines may be skew rather than parallel. A holds only for lines in a plane.

Privacy · Terms · Refunds · Delivery