What this calculator does
This tool computes the shortest (minimum) distance between two straight lines in three-dimensional space. Each line is described by a point it passes through, \(P = (a, b, c)\), and a direction vector \(V = (p, q, r)\) parallel to it — exactly the data in the symmetric form \(\frac{x-a}{p} = \frac{y-b}{q} = \frac{z-c}{r}\). It is a pure analytic-geometry tool that applies universally, with no units or country-specific rules.
How to use it
Enter the three coordinates of point P1 and the three components of direction vector V1 for the first line, then do the same for the second line. Press calculate. The result shows the shortest distance and classifies the pair as intersecting, skew, parallel, or coincident. Any direction vector of \((0, 0, 0)\) is rejected because it does not define a line.
The formula explained
Let \(\vec{W} = \text{P2} - \text{P1}\) be the vector connecting a point on each line, and \(\vec{N} = \vec{V_1} \times \vec{V_2}\) the cross product of the directions. When the lines are not parallel, the shortest distance is the absolute value of the scalar triple product divided by the magnitude of \(\vec{N}\):
$$d = \frac{\left| \vec{W} \cdot \vec{N} \right|}{\left| \vec{N} \right|}$$If this equals zero the lines intersect; otherwise they are skew (they never meet but are not parallel). When \(\vec{V_1}\) and \(\vec{V_2}\) are scalar multiples, \(\vec{N}\) is the zero vector, so the calculator switches to the point-to-line formula
$$d = \frac{\left| \vec{W} \times \vec{V_1} \right|}{\left| \vec{V_1} \right|}$$a result of zero there means the lines are coincident.
Worked example
Take \(\text{P1} = (-1, 2, 0)\), \(\vec{V_1} = (2, 3, 1)\) and \(\text{P2} = (3, -4, 1)\), \(\vec{V_2} = (1, 2, 1)\). Then \(\vec{W} = (4, -6, 1)\) and \(\vec{N} = \vec{V_1} \times \vec{V_2} = (1, -1, 1)\) with \(\left| \vec{N} \right| = \sqrt{3} = 1.7320508\). The dot product \(\vec{W} \cdot \vec{N} = 4 + 6 + 1 = 11\), so
$$d = \frac{11}{\sqrt{3}} = 6.350853$$Since \(d\) is nonzero, the two lines are skew.
FAQ
What does "skew" mean? Skew lines are lines in 3D that are neither parallel nor intersecting — they pass each other at a fixed minimum distance.
Why is the distance zero? A zero distance means the lines share at least one point: either they intersect or, if parallel, they are the same line.
Do the direction vector lengths matter? No. Scaling a direction vector does not change the line, and the formula normalizes by the relevant magnitude, so the distance is unaffected.