Distance between skew lines in 3D
About this app
Explore the common perpendicular, its feet on both lines and their distance. Adjust the geometry with sliders and examine the parallel case.
What skew means
Two lines g: x = A + s·u and h: x = B + t·v are skew if they are neither parallel nor intersecting, which is only possible in three dimensions. Their distance is the length of the shortest connecting segment. That segment is perpendicular to both lines and therefore points along the cross product n = u × v. With AB = B − A the distance is the projection of AB onto this direction: d = |AB·n|/|n|. If d = 0 the lines intersect.
What the app shows
The scene shows both lines, the normal vector n and the common perpendicular between the foot points F_g and F_h. Sliders change the base points A, B and the directions u, v. The values panel lists all vectors, n, |n|, both foot points and the distance d. When the directions become parallel there is no unique foot point; the app says so and computes the distance as |AB × u|/|u| instead.
Try it yourself
Rotate one direction slowly until u and v are parallel and watch the formula switch. Move B so that d approaches zero: the lines then intersect. Notice that the perpendicular segment is always at right angles to both lines, however you place them. “Reset example” brings back the starting configuration.
Frequently asked questions
- How do you calculate the distance between two skew lines?
- Form the normal n = u × v from the direction vectors and the vector AB between the base points. The distance is d = |AB·n|/|n|. It equals the length of the common perpendicular.
- How can you tell that two lines are skew?
- The direction vectors are not parallel, so u × v ≠ 0, and the lines do not intersect, which shows as AB·(u × v) ≠ 0. If this triple product is zero, both lines lie in one plane and intersect.
- How do you find the closest points on two skew lines?
- Look for parameters s and t such that the segment from A + s·u to B + t·v is perpendicular to both u and v. This gives two linear equations in s and t. Substituting them yields the two foot points, whose distance is d.
- What does the app do with parallel lines?
- With parallel directions n = 0 and there is no unique foot point. The app shows a note and uses the point-to-line formula |AB × u|/|u| for the distance.
Subject: Analytic geometry
More from Analytic geometry
- Point-to-line distance in 3D
- Planes in space
- Coordinates after Descartes: geometry becomes algebra (3D)
- Right-handed systems in 2D and 3D
- Shoelace method: the cross product
- Dot product: coordinate formula from the definition
- Cross and scalar triple products in 3D
- Angles between vectors in 3D
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps