eguruchela

Shortest Distance Between Two Lines Calculator


Enter the values for : Line passing through the point A(a1,b1,c1) parallel to the vector V1(p1,q1,r1)and line passing through the point B(a2,b2,c2) parallel to the vector V2(p2,q2,r2)

Calculator

Point A

Vector V1

Point B

Vector V3

How to Find the Shortest Distance Between Two Lines

In a three-dimensional Cartesian system, two lines can be parallel, intersecting, or skew. Skew lines are unique to 3D geometry—they are lines that are not parallel but never intersect because they lie in different planes.

3D Visualization: Skew Lines & Shortest Path

Line L1 Line L2 d (Shortest Distance)

The shortest distance is the unique line segment perpendicular to both L1 and L2.

We are considering the two line in space as line1 and line2. The line1 is passing though point A (a1,b1,c1) and parallel to vector V1 and The line2 is passing though point B(a2,b2,c2) and parallel to vector V2. We can find out the shortest distance between given two lines using following formulas: $$ d=| \frac {( \overrightarrow{V_{\,1}} \times \overrightarrow{V_{\,2}}) \cdot \overrightarrow{P_{\,1} P_{\,2}}}{| \overrightarrow{V_{\,1}} \times \overrightarrow{ V_{\,2}} | } | , at | \overrightarrow{V_{\,1}} \times \overrightarrow{ V_{\,2}} | \neq {0}$$ $$ =| \frac {( q_{\,1}r_{\,2} - q_{\,2}r_{\,1})a_{\,12} + (r_{\,1}p_{\,2} - r_{\,2}p_{\,1})b_{\,12} + (p_{\,1}q_{\,2} - p_{\,2}q_{\,1})c_{\,12} } { \sqrt{(q_{\,1}r_{\,2} - q_{\,2}r_{\,1})^{2}+(r_{\,1}p_{\,2} - r_{\,2}p_{\,1})^{2} + (p_{\,1}q_{\,2} - p_{\,2}q_{\,1})^{2} }} |$$ $$ d=| \frac { \overrightarrow{V_{\,1}} \cdot \overrightarrow{P_{\,1} P_{\,2}}}{| \overrightarrow{V_{\,1}} | } | , at | \overrightarrow{V_{\,1}} \times \overrightarrow{ V_{\,2}} | = {0}$$ $$ =|\frac{ \sqrt{ (b_{\,12}r_{\,1} - c_{\,12}q_{\,1})^{2} + (c_{\,12}p_{\,1} - a_{\,12}r_{\,1})^{2} + (a_{\,12}q_{\,1} - b_{\,12}p_{\,1})^{2} } } { \sqrt{ p_{\,1}^{2} + q_{\,1}^{2} + r_{\,1}^{2} } }|$$

where a12 = (a1 - a2), b12 = (b1 - b2) and c12 = (c1 - c2).

The distance between two straight lines on a plan is the minimum distance between any two points lying on the lines. 
The distance between two parallel lines is the perpendicular distance from any point on one line to the other line.
The distance between two intersecting lines is eventually comes to zero and
The distance between two skew lines is equal to the length of the perpendicular between the lines.

Step-by-Step Calculation Guide

$$ \text{Find Direction Vectors: Identify} \, \vec{b_1} \, and \,\vec{b_2} \, \text{from the line equations.} $$ $$ \text{Calculate Cross Product: Find } \,\vec{b_1} \times \vec{b_2} \,\text{. This vector is perpendicular to both lines.}$$ $$ \text{Find the Point Vector: Subtract the starting point of Line 1 from Line 2}\, (\vec{a_2} - \vec{a_1})$$

Apply Dot Product: Multiply the result of Step 2 and Step 3.

Divide by Magnitude: Divide the absolute value by the length of the cross product vector.

Note: If the shortest distance d = 0, it means the two lines intersect at a specific point in 3D space.