In short
Two lines in 3D can be skew — neither parallel nor intersecting. The shortest distance between skew lines \vec{r} = \vec{a}_1 + \lambda\vec{b}_1 and \vec{r} = \vec{a}_2 + \mu\vec{b}_2 is d = \frac{|(\vec{a}_2 - \vec{a}_1) \cdot (\vec{b}_1 \times \vec{b}_2)|}{|\vec{b}_1 \times \vec{b}_2|}. Two lines intersect when this distance is zero, and the distance between parallel lines uses the cross-product formula d = \frac{|\vec{AP} \times \vec{b}|}{|\vec{b}|}. The image of a point in a line is found by reflecting through the foot of the perpendicular.
Two metro tunnels run under a city. One goes northeast at a shallow depth; the other goes northwest at a deeper level. They never meet — they are not parallel (they point in different directions), but they also do not cross (they are at different depths). They just pass each other in space, one above the other, without touching.
Lines that behave like this are called skew lines — the uniquely three-dimensional phenomenon that has no analogue in 2D. In a flat plane, two distinct lines either meet or are parallel. In space, there is a third option: they can twist past each other.
The natural question is: how close do the two tunnels get? What is the shortest distance between them? This question — and the formulas that answer it — is the centerpiece of this article.
Image of a point in a line
Before tackling two lines at once, here is a simpler problem that builds on the foot-of-perpendicular technique from the previous article.
The problem. Given a line L and a point P, find the image of P in L — the point P' such that L is the perpendicular bisector of the segment PP'.
The method. Two steps:
- Find the foot of perpendicular M from P to L (using the technique from the previous article).
- Since M is the midpoint of PP', use the midpoint formula: M = \frac{P + P'}{2}, so P' = 2M - P.
In coordinates: if P = (\alpha, \beta, \gamma) and M = (m_1, m_2, m_3), then
That is all there is to it. The image is the reflection of the point through the foot of perpendicular.
Why this works
The logic is clean: if L is the perpendicular bisector of PP', then two conditions must hold simultaneously. First, the midpoint of PP' must lie on L. Second, the segment PP' must be perpendicular to L. Both conditions are satisfied by construction: M is on L (it is the foot of perpendicular), PM is perpendicular to L (by definition of the foot of perpendicular), and M is the midpoint of PP' (because we defined P' to make this true).
The image has a physical interpretation. If you placed a mirror along the line L (imagine the line as a thin, flat mirror edge in 3D space), the image P' is where the reflection of P would appear. This is the 3D analogue of reflecting a point across a line in 2D — a technique you may have encountered when studying Locus problems.
A common exam pattern
Many JEE problems ask: "Find the image of the point (a, b, c) in the line \frac{x - x_1}{l} = \frac{y - y_1}{m} = \frac{z - z_1}{n}." The recipe is always the same three steps: (1) parametrise the line, (2) find \lambda using perpendicularity, (3) reflect through the foot. There is no shortcut formula to memorise — the method itself is fast enough.
Shortest distance between two skew lines
This is the main formula of this article, and it is one of the most important results in 3D geometry for entrance exams.
The setup
Two lines in space:
These lines are skew — not parallel (\vec{b}_1 is not proportional to \vec{b}_2) and not intersecting (they have no common point).
The shortest distance between them is the length of the segment that is perpendicular to both lines simultaneously. There is exactly one such segment for skew lines, and its direction is along \vec{b}_1 \times \vec{b}_2 — the vector perpendicular to both directions.
Deriving the formula
The direction perpendicular to both lines is \vec{n} = \vec{b}_1 \times \vec{b}_2.
Pick any point A_1 on L_1 (with position vector \vec{a}_1) and any point A_2 on L_2 (with position vector \vec{a}_2). The vector joining them is \vec{A_1 A_2} = \vec{a}_2 - \vec{a}_1.
The shortest distance is the component of \vec{A_1 A_2} along \vec{n}. To find this component, project \vec{A_1 A_2} onto \vec{n}:
Why does this work? Think of building a parallelepiped from the three vectors \vec{b}_1, \vec{b}_2, and \vec{A_1 A_2}. The volume of this parallelepiped is |[\vec{A_1 A_2}\;\vec{b}_1\;\vec{b}_2]| = |(\vec{a}_2 - \vec{a}_1) \cdot (\vec{b}_1 \times \vec{b}_2)|. The base of the parallelepiped is the parallelogram spanned by \vec{b}_1 and \vec{b}_2, with area |\vec{b}_1 \times \vec{b}_2|. The height of the parallelepiped — perpendicular to the base — is the shortest distance. So d = \frac{\text{Volume}}{\text{Base area}}.
The numerator is the absolute value of a scalar triple product. The denominator is the magnitude of a cross product. Both should be familiar from the scalar triple product article.
Shortest distance between skew lines
If L_1: \vec{r} = \vec{a}_1 + \lambda\vec{b}_1 and L_2: \vec{r} = \vec{a}_2 + \mu\vec{b}_2 are skew lines, the shortest distance between them is
The Cartesian version
If the lines are given in symmetric form as
then \vec{a}_2 - \vec{a}_1 = (x_2 - x_1)\hat{i} + (y_2 - y_1)\hat{j} + (z_2 - z_1)\hat{k}, and the formula becomes
The numerator is the absolute value of a 3 \times 3 determinant — the scalar triple product in determinant form. The denominator is the magnitude of \vec{b}_1 \times \vec{b}_2.
Condition for two lines to intersect
Two lines intersect if and only if the shortest distance between them is zero:
In the determinant form:
Why this works. If the scalar triple product is zero, the three vectors \vec{A_1 A_2}, \vec{b}_1, \vec{b}_2 are coplanar — they lie in a common plane. When the join vector from L_1 to L_2 lies in the plane spanned by the two direction vectors, the lines must meet (assuming they are not parallel). The parallelepiped collapses to a flat shape with zero height, meaning the lines are in the same plane — and two non-parallel lines in the same plane always intersect.
This condition is equivalent to saying: there exist values of \lambda and \mu such that \vec{a}_1 + \lambda\vec{b}_1 = \vec{a}_2 + \mu\vec{b}_2. You can check this condition by solving the resulting system of three equations in two unknowns (\lambda and \mu). If the system is consistent — if all three equations are satisfied by the same \lambda and \mu — the lines intersect. The determinant condition is a faster test.
Distance between parallel lines
When \vec{b}_1 and \vec{b}_2 are proportional (the lines are parallel), the cross product \vec{b}_1 \times \vec{b}_2 = \vec{0}, so the skew-lines formula gives \frac{0}{0} — undefined. Parallel lines need a different formula.
The idea. If the two lines are parallel with common direction \vec{b}, pick any point A_2 on L_2 and find its perpendicular distance to L_1. This distance is the same regardless of which point on L_2 you choose (because the lines are parallel).
Using the cross-product formula from the previous article, with \vec{AP} = \vec{a}_2 - \vec{a}_1 and direction \vec{b} (common to both lines):
Distance between parallel lines
This is exactly the perpendicular-distance-from-point-to-line formula, applied with A_2 as the point and L_1 as the line.
Two worked examples
Example 1: Shortest distance between skew lines
Find the shortest distance between the lines
Step 1. Identify the points and direction vectors.
Why: the point comes from the numerators in the symmetric form, and the direction ratios from the denominators.
Step 2. Compute \vec{a}_2 - \vec{a}_1.
Why: this is the vector joining the two known points, one on each line.
Step 3. Compute \vec{b}_1 \times \vec{b}_2.
Why: the cross product gives the direction perpendicular to both lines. Since it is non-zero, the lines are not parallel.
Step 4. Compute the scalar triple product (numerator).
Why: this is the volume of the parallelepiped formed by the three vectors.
Step 5. Compute the magnitude of the cross product (denominator).
Why: the base area of the parallelepiped.
Result: d = \dfrac{|1|}{\sqrt{6}} = \dfrac{1}{\sqrt{6}} = \dfrac{\sqrt{6}}{6}.
The shortest distance is small — about 0.41 units. The two lines are nearly parallel (their direction vectors differ only by (\hat{i} + \hat{j} + \hat{k}), making them close in direction) and they pass close to each other.
Example 2: Checking intersection and finding the image of a point
Two lines are given:
(a) Do the lines intersect? (b) Find the image of the point P = (5, -2, 1) in the line L_1.
(a) Intersection check.
Step 1. Set up the data.
Why: read off from the symmetric forms.
Step 2. Compute \vec{b}_1 \times \vec{b}_2.
Why: the cross product is non-zero, so the lines are not parallel.
Step 3. Compute the scalar triple product.
Why: if this is zero, the lines are coplanar and must intersect.
The scalar triple product is zero, so yes, the lines intersect.
(b) Image of P = (5, -2, 1) in L_1.
Step 3. A general point on L_1 is M = (1 + \lambda,\; -\lambda,\; -1 + \lambda).
Why: \vec{PM} = M - P.
Step 4. Apply \vec{PM} \cdot \vec{b}_1 = 0.
Why: the foot of perpendicular must satisfy perpendicularity with the direction of the line.
Step 5. Find M and then P'.
Why: the image is the reflection through the foot — M is the midpoint of PP', so P' = 2M - P.
Result: (a) The lines intersect. (b) The image of (5, -2, 1) in L_1 is \left(\dfrac{7}{3},\; -\dfrac{10}{3},\; \dfrac{7}{3}\right).
Verification. Check that M is the midpoint of PP': \frac{5 + 7/3}{2} = \frac{22/3}{2} = \frac{11}{3}, \frac{-2 + (-10/3)}{2} = \frac{-16/3}{2} = \frac{-8}{3}, \frac{1 + 7/3}{2} = \frac{10/3}{2} = \frac{5}{3}. All components match M. The image is correct.
Common confusions
-
"If two lines don't intersect, they are parallel." This is true in 2D, but false in 3D. In three dimensions, non-intersecting lines can be skew — pointing in different directions and simply missing each other. The skew-line formula handles this case.
-
"The shortest distance between two lines is the distance between their known points." Almost never. The shortest distance is along the common perpendicular, which typically joins points different from the ones given in the equations. |\vec{a}_2 - \vec{a}_1| is just the distance between two particular points, not the minimum distance.
-
"The formula \frac{|(\vec{a}_2 - \vec{a}_1) \cdot (\vec{b}_1 \times \vec{b}_2)|}{|\vec{b}_1 \times \vec{b}_2|} works for parallel lines too." It does not — when lines are parallel, \vec{b}_1 \times \vec{b}_2 = \vec{0}, and the denominator is zero. Use the parallel-lines formula d = \frac{|(\vec{a}_2 - \vec{a}_1) \times \vec{b}|}{|\vec{b}|} instead.
-
"Two lines that are coplanar must intersect." True only if they are not parallel. Two parallel lines are coplanar (they lie in a common plane) but do not intersect. The determinant condition [\vec{A_1A_2}\;\vec{b}_1\;\vec{b}_2] = 0 says the lines are coplanar. If they are also not parallel, they intersect. If they are parallel, they might be the same line or distinct parallel lines.
-
"The image of a point in a line is on the line." No — the image is on the opposite side of the line from the original point, at the same distance. The foot of perpendicular is on the line; the image is not (unless the original point was already on the line, in which case the image is the point itself).
Going deeper
If you came here to learn the key formulas and how to apply them, you have everything you need — you can stop here. The rest explores why these formulas work from a deeper geometric viewpoint, and what happens in degenerate cases.
Finding the actual closest points
The shortest-distance formula gives you the distance but not the points where the common perpendicular meets the two lines. To find these points, set up the parametric equations:
The vector \vec{Q_1 Q_2} must be perpendicular to both \vec{b}_1 and \vec{b}_2:
Expanding \vec{Q_1 Q_2} = (\vec{a}_2 + \mu\vec{b}_2) - (\vec{a}_1 + \lambda\vec{b}_1) = (\vec{a}_2 - \vec{a}_1) + \mu\vec{b}_2 - \lambda\vec{b}_1, the two dot-product conditions give two linear equations in \lambda and \mu. Solve for both, and substitute back to get Q_1 and Q_2.
The parallelepiped picture
The derivation used the fact that |(\vec{a}_2 - \vec{a}_1) \cdot (\vec{b}_1 \times \vec{b}_2)| is the volume of the parallelepiped built on three edges. This is worth visualising.
The base of the parallelepiped is the parallelogram spanned by \vec{b}_1 and \vec{b}_2, with area |\vec{b}_1 \times \vec{b}_2|. The third edge is \vec{a}_2 - \vec{a}_1. The height of the parallelepiped — the component of \vec{a}_2 - \vec{a}_1 perpendicular to the base — is the shortest distance. So the shortest distance is not pulled out of thin air; it is the natural measure of how much the two lines fail to be coplanar.
When the two lines are coplanar (they intersect or are parallel), the parallelepiped collapses to zero volume, and the shortest distance is zero — which is exactly the intersection condition.
Finding the closest points: a worked derivation
Take the skew lines from Example 1: L_1 through (1,2,3) with direction (2,3,4), and L_2 through (2,4,5) with direction (3,4,5). The closest points are Q_1 = (1 + 2\lambda,\; 2 + 3\lambda,\; 3 + 4\lambda) on L_1 and Q_2 = (2 + 3\mu,\; 4 + 4\mu,\; 5 + 5\mu) on L_2.
The vector \vec{Q_1 Q_2} = (1 + 3\mu - 2\lambda)\hat{i} + (2 + 4\mu - 3\lambda)\hat{j} + (2 + 5\mu - 4\lambda)\hat{k}.
The condition \vec{Q_1 Q_2} \cdot \vec{b}_1 = 0 gives:
The condition \vec{Q_1 Q_2} \cdot \vec{b}_2 = 0 gives:
From (i): 38\mu = 29\lambda - 16, so \mu = \frac{29\lambda - 16}{38}. Substitute into (ii):
Multiply through by 38: 798 + 1450\lambda - 800 - 1444\lambda = 0, so 6\lambda = 2, giving \lambda = \frac{1}{3}.
Then \mu = \frac{29/3 - 16}{38} = \frac{(29 - 48)/3}{38} = \frac{-19}{114} = -\frac{1}{6}.
The closest points are Q_1 = (1 + \frac{2}{3},\; 2 + 1,\; 3 + \frac{4}{3}) = (\frac{5}{3}, 3, \frac{13}{3}) and Q_2 = (2 - \frac{1}{2},\; 4 - \frac{2}{3},\; 5 - \frac{5}{6}) = (\frac{3}{2}, \frac{10}{3}, \frac{25}{6}).
You can verify: |Q_1 Q_2| = \sqrt{(\frac{5}{3} - \frac{3}{2})^2 + (3 - \frac{10}{3})^2 + (\frac{13}{3} - \frac{25}{6})^2} = \sqrt{\frac{1}{36} + \frac{1}{9} + \frac{1}{36}} = \sqrt{\frac{1 + 4 + 1}{36}} = \frac{\sqrt{6}}{6}, matching the distance found in Example 1.
When one direction ratio is zero
If a direction ratio is zero — say c_1 = 0 in the first line — the symmetric form is often written as \frac{x - x_1}{a_1} = \frac{y - y_1}{b_1} = \frac{z - z_1}{0}. This is shorthand for z = z_1 (the z-coordinate is constant along the line). The formulas for shortest distance, intersection, and perpendicular distance work exactly the same way — plug in c_1 = 0 and compute. No special treatment is needed.
The matrix viewpoint
The intersection condition [\vec{A_1A_2}\;\vec{b}_1\;\vec{b}_2] = 0 is a coplanarity condition. In the language of matrices, the three vectors \vec{A_1 A_2}, \vec{b}_1, \vec{b}_2 are linearly dependent — they do not span all of 3D space. The determinant of the 3 \times 3 matrix with these vectors as rows is zero. This connects the geometry of lines to the algebra of determinants — a recurring theme in 3D geometry.
The three relationships between two lines in 3D
It is worth collecting the complete classification. Two distinct lines in 3D are in exactly one of these three relationships:
| Relationship | \vec{b}_1 \times \vec{b}_2 | Scalar triple product | Distance |
|---|---|---|---|
| Intersecting | \neq \vec{0} | = 0 | 0 |
| Parallel | = \vec{0} | (not applicable) | > 0 (or = 0 if same line) |
| Skew | \neq \vec{0} | \neq 0 | > 0 |
This table is the complete decision tree. First check if the cross product is zero (parallel or not). If not parallel, check the scalar triple product (intersecting or skew). Each case has its own distance formula.
Where this leads next
You have now seen how two lines in 3D interact — through angles, distances, and intersection conditions. The next natural step is to study the plane, where a flat surface replaces a one-dimensional line.
- Plane — Basic Equations — vector and Cartesian equations of a plane, including the normal form and the intercept form.
- Straight Line in 3D — Angles and Distances — the prerequisite article covering angle between two lines, perpendicular distance from a point to a line, and the foot of perpendicular.
- Scalar Triple Product — the operation that powers the shortest-distance formula, with its full geometric interpretation as volume.
- Cross Product — the tool that gives you the direction perpendicular to two vectors.
- Locus — the general theory of sets of points satisfying geometric conditions, with applications in 3D.