Mathwords logoMathwords

Point-Line Distance in 3 Dimensions — Definition, Formula & Examples

Point-line distance in 3 dimensions is the shortest (perpendicular) distance from a point to a line in three-dimensional space. It is computed using the cross product of two vectors derived from the line's direction and the point's position.

Given a line passing through a point P0P_0 with direction vector d\mathbf{d}, and an external point P1P_1, the distance from P1P_1 to the line is defined as d=P0P1×ddd = \frac{\|\overrightarrow{P_0P_1} \times \mathbf{d}\|}{\|\mathbf{d}\|}, where ×\times denotes the vector cross product and \|\cdot\| denotes the Euclidean norm.

Key Formula

d=P0P1×ddd = \frac{\|\overrightarrow{P_0P_1} \times \mathbf{d}\|}{\|\mathbf{d}\|}
Where:
  • dd = Shortest (perpendicular) distance from the point to the line
  • P0P_0 = A known point on the line
  • P1P_1 = The external point whose distance to the line you want
  • P0P1\overrightarrow{P_0P_1} = Vector from P₀ to P₁, computed as P₁ − P₀
  • d\mathbf{d} = Direction vector of the line
  • ×\times = Cross product
  • \|\cdot\| = Euclidean (L²) norm of a vector

How It Works

To find the distance from a point to a line in 3D, you need two things: a direction vector d\mathbf{d} for the line and a vector P0P1\overrightarrow{P_0P_1} from any known point on the line to the external point. The cross product P0P1×d\overrightarrow{P_0P_1} \times \mathbf{d} produces a vector whose magnitude equals the area of the parallelogram spanned by those two vectors. Dividing that area by the base length d\|\mathbf{d}\| gives the height of the parallelogram, which is exactly the perpendicular distance. This approach works regardless of how the line is parameterized — symmetric form, parametric form, or two-point form all yield the same direction vector.

Worked Example

Problem: Find the distance from the point P₁ = (1, −2, 3) to the line passing through P₀ = (2, 1, −1) with direction vector d = ⟨1, 2, 2⟩.
Step 1: Compute the vector from P₀ to P₁: Subtract the coordinates of P₀ from P₁.
P0P1=(12,  21,  3(1))=(1,  3,  4)\overrightarrow{P_0P_1} = (1-2,\;-2-1,\;3-(-1)) = (-1,\;-3,\;4)
Step 2: Compute the cross product: Use the determinant formula for the cross product of the two vectors.
P0P1×d=ijk134122=(68)i(24)j+(2+3)k=(14,  6,  1)\overrightarrow{P_0P_1} \times \mathbf{d} = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ -1 & -3 & 4 \\ 1 & 2 & 2 \end{vmatrix} = (-6-8)\mathbf{i} - (-2-4)\mathbf{j} + (-2+3)\mathbf{k} = (-14,\;6,\;1)
Step 3: Find the magnitude of the cross product: Compute the Euclidean norm of the resulting vector.
(14,6,1)=196+36+1=233\|(-14, 6, 1)\| = \sqrt{196 + 36 + 1} = \sqrt{233}
Step 4: Divide by the magnitude of d: This gives the perpendicular distance.
d=23312+22+22=23335.085d = \frac{\sqrt{233}}{\sqrt{1^2+2^2+2^2}} = \frac{\sqrt{233}}{3} \approx 5.085
Answer: The distance is 23335.09\dfrac{\sqrt{233}}{3} \approx 5.09 units.

Another Example

Problem: Find the distance from the origin (0, 0, 0) to the line through (3, 0, 0) with direction vector d = ⟨0, 1, 0⟩.
Step 1: Vector from P₀ to P₁: P₀ = (3, 0, 0) and P₁ = (0, 0, 0).
P0P1=(3,0,0)\overrightarrow{P_0P_1} = (-3, 0, 0)
Step 2: Cross product: Compute the cross product with d = ⟨0, 1, 0⟩.
(3,0,0)×(0,1,0)=(0001,  00(3)0,  (3)100)=(0,0,3)(-3, 0, 0) \times (0, 1, 0) = (0\cdot0 - 0\cdot1,\; 0\cdot0 - (-3)\cdot0,\; (-3)\cdot1 - 0\cdot0) = (0, 0, -3)
Step 3: Compute the distance: The magnitude of the cross product is 3, and the magnitude of d is 1.
d=31=3d = \frac{3}{1} = 3
Answer: The distance is 3 units, which makes geometric sense: the line runs along the y-axis shifted 3 units in the x-direction.

Why It Matters

This formula appears routinely in multivariable calculus and linear algebra courses, particularly when studying lines and planes in R3\mathbb{R}^3. In computer graphics and robotics, it is used to test clearances, detect collisions, and compute ray-object distances. Physics applications include finding the closest approach between a charged particle's trajectory and a wire carrying current.

Common Mistakes

Mistake: Using the dot product instead of the cross product
Correction: The dot product gives a scalar projection along the line, not the perpendicular distance. You need the cross product, which captures the component orthogonal to the direction vector.
Mistake: Forgetting to divide by the magnitude of the direction vector
Correction: The cross product magnitude alone gives the area of a parallelogram. You must divide by ‖d‖ to convert that area into the perpendicular height (the distance). If d happens to be a unit vector, this step has no visible effect, which is why some students miss it.

Related Terms