◀ Back to Note

Tony's Intertwingled Memex • Reference Manual

Distance Between a Point and a Line in Space

Formulas & Definitions
Core Definition

In three-dimensional space (R3\mathbb{R}^3R3), the shortest (perpendicular) distance ddd from an external point M(xM,yM,zM)M(x_M, y_M, z_M)M(xM​,yM​,zM​) to a line passing through point P(x0,y0,z0)P(x_0, y_0, z_0)P(x0​,y0​,z0​) with direction vector v⃗=⟨a,b,c⟩\vec{v} = \langle a, b, c \ranglev=⟨a,b,c⟩ is given by the cross product formula:

d=∥PM⃗×v⃗∥∥v⃗∥d = \frac{\|\vec{PM} \times \vec{v}\|}{\|\vec{v}\|}d=∥v∥∥PM×v∥​
where PM⃗=⟨xM−x0,yM−y0,zM−z0⟩\vec{PM} = \langle x_M - x_0, y_M - y_0, z_M - z_0 \ranglePM=⟨xM​−x0​,yM​−y0​,zM​−z0​⟩ is the displacement vector from the line reference point PPP to the external point MMM.

Concept Explanation

Geometric Derivation via Parallelogram Area

In 3D space, we cannot use simple 2D slope-perpendicular equations. Instead, we leverage the geometric property of the Cross Product:

                 M (External Point)
                /|
               / |
        PM    /  |  d (Perpendicular Distance = Height)
             /   |
            /    |
           P-----+------------> v (Base)
             (Line Reference)
  1. Parallelogram Spanned by Vectors: The displacement vector PM⃗\vec{PM}PM and the line's direction vector v⃗\vec{v}v define a parallelogram in 3D space.
  2. Cross Product Area: The magnitude of the cross product equals the area of this parallelogram:
    Area=∥PM⃗×v⃗∥\text{Area} = \|\vec{PM} \times \vec{v}\|Area=∥PM×v∥
  3. Geometric Area Formula: The area of any parallelogram is also given by Base×Height\text{Base} \times \text{Height}Base×Height:
    Area=∥v⃗∥⋅d\text{Area} = \|\vec{v}\| \cdot dArea=∥v∥⋅d
  4. Equating and Solving for ddd:
    ∥v⃗∥⋅d=∥PM⃗×v⃗∥  ⟹  d=∥PM⃗×v⃗∥∥v⃗∥\|\vec{v}\| \cdot d = \|\vec{PM} \times \vec{v}\| \implies d = \frac{\|\vec{PM} \times \vec{v}\|}{\|\vec{v}\|}∥v∥⋅d=∥PM×v∥⟹d=∥v∥∥PM×v∥​

Step-by-Step Calculation Recipe

  1. Extract Line Data: Identify a point on the line P(x0,y0,z0)P(x_0, y_0, z_0)P(x0​,y0​,z0​) and the direction vector v⃗=⟨a,b,c⟩\vec{v} = \langle a, b, c \ranglev=⟨a,b,c⟩ from the given vector, parametric, or symmetric equations.
  2. Construct Displacement Vector PM⃗\vec{PM}PM:
    PM⃗=⟨xM−x0,yM−y0,zM−z0⟩\vec{PM} = \langle x_M - x_0, y_M - y_0, z_M - z_0 \ranglePM=⟨xM​−x0​,yM​−y0​,zM​−z0​⟩
  3. Compute Cross Product Matrix Determinant:
    PM⃗×v⃗=∣i^j^k^xM−x0yM−y0zM−z0abc∣\vec{PM} \times \vec{v} = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ x_M - x_0 & y_M - y_0 & z_M - z_0 \\ a & b & c \end{vmatrix}PM×v=​i^xM​−x0​a​j^​yM​−y0​b​k^zM​−z0​c​​
  4. Calculate Magnitudes & Evaluate Distance:
    d=(PM⃗×v⃗)x2+(PM⃗×v⃗)y2+(PM⃗×v⃗)z2a2+b2+c2d = \frac{\sqrt{(\vec{PM}\times\vec{v})_x^2 + (\vec{PM}\times\vec{v})_y^2 + (\vec{PM}\times\vec{v})_z^2}}{\sqrt{a^2 + b^2 + c^2}}d=a2+b2+c2​(PM×v)x2​+(PM×v)y2​+(PM×v)z2​​​

Engineering Applications

  • Robotic Arm Motion Planning: Computing real-time spatial clearance between moving manipulator links (modeled as line segments) and static factory fixtures or worker exclusion zones.
  • Structural Clearance & Utility Routing: Verifying that high-tension building stabilization cables maintain required air gap separations from high-voltage electrical conduits to prevent electrical arcing.
  • Air Traffic Separation Envelopes: Determining minimum approach distances between linear aircraft flight paths and fixed terrain or radio towers.

Example Problems

Example 1: Point to Line in Symmetric Form

Find the shortest distance from the point M(1,1,3)M(1, 1, 3)M(1,1,3) to the line x−34=y+12=z−3\frac{x-3}{4} = \frac{y+1}{2} = z-34x−3​=2y+1​=z−3.

Solution
  1. Extract Point and Direction Vector:
    • Point on line: P(3,−1,3)P(3, -1, 3)P(3,−1,3)
    • Direction vector: v⃗=⟨4,2,1⟩\vec{v} = \langle 4, 2, 1 \ranglev=⟨4,2,1⟩
  2. Construct PM⃗\vec{PM}PM:
    PM⃗=⟨1−3,1−(−1),3−3⟩=⟨−2,2,0⟩\vec{PM} = \langle 1 - 3, 1 - (-1), 3 - 3 \rangle = \langle -2, 2, 0 \ranglePM=⟨1−3,1−(−1),3−3⟩=⟨−2,2,0⟩
  3. Cross Product:
    PM⃗×v⃗=∣i^j^k^−220421∣=i^(2)−j^(−2)+k^(−4−8)=⟨2,2,−12⟩\vec{PM} \times \vec{v} = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ -2 & 2 & 0 \\ 4 & 2 & 1 \end{vmatrix} = \hat{i}(2) - \hat{j}(-2) + \hat{k}(-4 - 8) = \langle 2, 2, -12 \ranglePM×v=​i^−24​j^​22​k^01​​=i^(2)−j^​(−2)+k^(−4−8)=⟨2,2,−12⟩
  4. Calculate Magnitudes:
    ∥PM⃗×v⃗∥=22+22+(−12)2=152=238\|\vec{PM} \times \vec{v}\| = \sqrt{2^2 + 2^2 + (-12)^2} = \sqrt{152} = 2\sqrt{38}∥PM×v∥=22+22+(−12)2​=152​=238​
    ∥v⃗∥=42+22+12=21\|\vec{v}\| = \sqrt{4^2 + 2^2 + 1^2} = \sqrt{21}∥v∥=42+22+12​=21​
  5. Evaluate Distance:
    d=23821=279821≈2.69d = \frac{2\sqrt{38}}{\sqrt{21}} = \frac{2\sqrt{798}}{21} \approx 2.69d=21​238​​=212798​​≈2.69

Connections & References

  • Parent Concepts: Vectors in 2D and 3D | Cross Product
  • Related Notes: Equations of Lines in 3D | Relationships Between Lines in Space
  • Course Sessions: Calc-3 Session 04