Calculus 3 • Vectors & 3D Geometry

Distance Formulas in 3D — Distances: Point-to-Point, Point-to-Line, Point-to-Plane (Intro)

Master the vector-based techniques for measuring distances between points, lines, and planes in three-dimensional space.

Three-dimensional axes with spatial movement and a multivariable function.
Inside this lesson 10 sections 5 questions 8 figures

SECTION 1

Historical Context & Motivation

The problem of measuring distances in space is as old as geometry itself, but extending these measurements into three dimensions required centuries of conceptual development. Ancient Greek mathematicians understood how to compute the distance between two points on a plane, yet the leap to three-dimensional space demanded both algebraic tools and a coordinate framework that simply did not exist until the early modern period. The evolution from Euclid's ruler-and-compass constructions to the elegant vector formulas you will learn in this lesson represents one of the most powerful unifications in mathematical history—merging geometry with algebra and, ultimately, with calculus.

Understanding distances in 3D is not merely an academic exercise. Engineers compute point-to-plane distances to determine clearances in mechanical assemblies, physicists calculate point-to-line distances when analyzing the closest approach of a particle to a beam axis, and computer graphics programmers rely on all three distance types for collision detection, ray tracing, and mesh simplification. The formulas you develop here serve as the foundation for optimization, surface theory, and multivariable calculus more broadly.

~300 BCE • Euclid's Elements

Euclid formalized the Pythagorean theorem and planar distance, establishing the geometric bedrock upon which all distance formulas ultimately rest.

1637 • Descartes' Coordinate Geometry

René Descartes introduced the Cartesian coordinate system in La Géométrie, enabling algebraic representation of geometric objects and paving the way for analytic geometry in any number of dimensions.

1844 • Grassmann's Extension Theory

Hermann Grassmann published his theory of n-dimensional vector spaces, providing the abstract algebraic framework—including the cross product and exterior algebra—needed for distance computations involving lines and planes.

1881 • Gibbs' Vector Analysis

Josiah Willard Gibbs distilled the vector algebra used in physics into the dot-product and cross-product notation still standard today, making point-to-line and point-to-plane distance formulas both compact and computationally practical.

20th C. • Computational Geometry & Beyond

With the rise of computer-aided design and numerical methods, 3D distance computations became algorithmic primitives—executed billions of times per second in applications ranging from GPS navigation to robotic path planning.

The central question this lesson addresses is deceptively simple: given a point in ℝ³, how do we measure its shortest distance to another point, to a line, or to a plane? Each scenario requires a distinct geometric insight—projection, rejection, or orthogonal decomposition—but all three share a common language: vectors and their operations.

SECTION 2

Core Principles & Definitions

Before diving into formulas, it is essential to crystallize the geometric principles that unify all three distance types. Every distance problem in 3D reduces to finding the length of a specific vector—the one that connects the given point to the nearest point on the target object (another point, a line, or a plane). That connecting vector is always perpendicular to the target object, a fact rooted in the variational principle that the shortest path from a point to a set is always orthogonal to the set at the closest point.

1

Orthogonal Projection

The component of a vector v along a direction u is projuv = ((v · u) / (u · u)) u. This captures 'how far along' u the vector v extends.
2

Vector Rejection

The component of v perpendicular to u is the rejection: v − projuv. Its magnitude equals the point-to-line distance when u is the line's direction vector.
3

Normal Vectors & Planes

A plane ax + by + cz = d has normal vector n = ⟨a, b, c⟩. The signed distance from any point to the plane is the scalar projection of an arbitrary connecting vector onto n, divided by ‖n‖.
4

Cross Product & Area Interpretation

The magnitude ‖u × v‖ equals the area of the parallelogram spanned by u and v. Dividing by ‖u‖ recovers the height—the perpendicular distance—linking cross products directly to point-to-line distance.
5

Minimization Viewpoint

Each distance formula can be derived by minimizing ‖P − Q(t)‖² over a parameterized family Q(t) on the target object. Setting the derivative to zero yields the same perpendicularity condition the geometric approach provides.
✦

KEY TAKEAWAY

Think of distance measurement like dropping a plumb line from a helicopter to the ground, to a road, or to a rooftop. The plumb line always hangs perfectly vertical—perpendicular to whatever surface it meets. In 3D distance problems, the 'plumb line' is the rejection or normal projection vector, and its length is the distance you seek. The different formulas simply encode different ways of isolating that perpendicular component.

SECTION 3

Visual Explanation — Geometry of the Three Distance Types

Three Distance Types in 3DPOINT-TO-POINTP₁P₂dd = ‖P₂ − P₁‖Direct Euclidean lengthof the connecting vectorPOINT-TO-LINEℓPvd⊥Q₀d = ‖v × û‖Cross-product magnitudegives perpendicular dist.POINT-TO-PLANEπPd⊥n̂d = |n̂ · v|Scalar projection ontothe unit normal
Left: the point-to-point distance is simply the magnitude of the vector connecting P₁ to P₂. Center: for a point P and line ℓ, the perpendicular distance d⊥ is the rejection of v = P − Q₀ off the line's direction, computed via the cross product. Right: for a point P above a plane π, the distance is the absolute scalar projection of v onto the unit normal n̂.

The diagram above encapsulates the geometric essence of each distance type. In every case, the distance is the length of the perpendicular component of a vector connecting the external point to some convenient reference point on the target object. For point-to-point, the entire connecting vector is the answer since there is no direction to 'project along.' For point-to-line, we decompose the connecting vector into a component parallel to the line (which we discard) and a component perpendicular to it (whose magnitude is the distance). For point-to-plane, we decompose the connecting vector into a component lying in the plane (discarded) and a component along the normal (whose absolute value is the distance).

Notice the progression in dimensionality of the target object: a point has dimension 0, a line has dimension 1, and a plane has dimension 2. As the dimension increases, the 'freedom' of the closest point on the target increases, and the perpendicular complement shrinks accordingly. This pattern generalizes beautifully to higher dimensions and to more exotic objects such as subspaces and affine varieties in linear algebra.

SECTION 4

Mathematical Framework

Point-to-Point Distance

Given two points P₁ = (x₁, y₁, z₁) and P₂ = (x₂, y₂, z₂) in ℝ³, the distance between them follows directly from the Pythagorean theorem applied in three mutually perpendicular directions. The derivation extends the familiar 2D formula by including the squared difference in the z-coordinates.

POINT-TO-POINT DISTANCE

d(P1,P2)=√[(x2−x1)2+(y2−y1)2+(z2−z1)2]d(P₁, P₂) = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]

Equivalently, d = ‖P₂ − P₁‖, the magnitude of the displacement vector from P₁ to P₂.

Point-to-Line Distance

Let ℓ be a line through a known point Q₀ with direction vector d, so ℓ: r(t) = Q₀ + td. Given an external point P, define v = P − Q₀. The perpendicular distance from P to ℓ is found by computing the rejection of v off d. The cross product provides a compact expression because ‖v × d‖ = ‖v‖ ‖d‖ sin θ, and ‖v‖ sin θ is exactly the perpendicular distance.

POINT-TO-LINE DISTANCE

d(P,ℓ)=‖(P−Q0)×d‖/‖d‖d(P, ℓ) = ‖(P − Q₀) × d‖ / ‖d‖

Here d is the direction vector of ℓ and Q₀ is any point on ℓ. The numerator is the area of the parallelogram formed by v and d; dividing by the base length ‖d‖ yields the height.

Point-to-Plane Distance

Let π be the plane defined by ax + by + cz = d (equivalently, n · r = d where n = ⟨a, b, c⟩). Given a point P = (x₀, y₀, z₀), pick any point Q₀ on the plane and form v = P − Q₀. The signed distance from P to π is compnv = (v · n)/‖n‖. Taking the absolute value and substituting the plane equation directly yields a formula involving only the coefficients and the coordinates of P.

POINT-TO-PLANE DISTANCE

d(P,π)=∣ax0+by0+cz0−d∣/√(a2+b2+c2)d(P, π) = |ax₀ + by₀ + cz₀ − d| / √(a² + b² + c²)

The numerator substitutes the point's coordinates into the plane equation; nonzero values indicate the point is off the plane. The denominator normalizes by the magnitude of the normal vector n = ⟨a, b, c⟩.

💡

Derivation Sketch — Point-to-Plane

Let Q₀ be any point on π, so a·Q₀ₓ + b·Q₀ᵧ + c·Q₀_z = d. Then v · n = a(x₀ − Q₀ₓ) + b(y₀ − Q₀ᵧ) + c(z₀ − Q₀_z) = (ax₀ + by₀ + cz₀) − d. Therefore the signed distance is (ax₀ + by₀ + cz₀ − d)/‖n‖, and the distance is the absolute value.

SECTION 5

Detailed Breakdown — Comparing the Three Formulas

While each formula has its own structure, a side-by-side comparison reveals a beautiful pattern: as the target object gains more degrees of freedom (point → line → plane), the tool used to extract the perpendicular component changes from simple vector magnitude to cross product to dot product with a normal. The following table and diagram summarize these relationships.

Distance TypeGiven InformationKey OperationFormula
Point-to-PointP₁, P₂ ∈ ℝ³Vector magnituded = ‖P₂ − P₁‖
Point-to-LineP, Q₀ on ℓ, direction dCross product (area ÷ base)d = ‖v × d‖ / ‖d‖
Point-to-PlaneP, plane ax+by+cz=dDot product (scalar proj.)d = |ax₀+by₀+cz₀−d| / ‖n‖

Summary comparison of the three 3D distance formulas

Vector Decomposition in Each Distance TypePoint-to-PointP₁P₂d = ‖v‖No decomposition needed.The full vector IS the answer.Point-to-Lineℓ (direction d)Pvprojd⊥v = proj + rejectionDistance = ‖rejection‖ = ‖v×d‖/‖d‖Point-to-PlaneπPQ₀d⊥n̂Distance = |compn̂v| = |v · n̂|Unifying PrincipleEvery 3D distance = length of the component of a connecting vector that isPERPENDICULARto the target object.
Detailed decomposition showing how v is split in each case. For point-to-point, no decomposition is needed. For point-to-line, v splits into a projection along d (green) and a rejection perpendicular to d (pink). For point-to-plane, v splits into a component in the plane and a component along n̂ (gold). The perpendicular component is the distance in every case.

An important observation is that the point-to-line formula uses the cross product because the line has one degree of freedom (parameterized by t), so the perpendicular complement is two-dimensional—and the cross product naturally produces a vector in that perpendicular plane. The point-to-plane formula uses the dot product because the plane has two degrees of freedom, leaving a one-dimensional normal direction—and the dot product extracts the scalar component along that single direction. This duality between cross and dot products in distance formulas is a hallmark of three-dimensional vector geometry.

SECTION 6

Worked Example — All Three Distance Types

Example 1: Point-to-Point

Find the distance between P₁ = (3, −1, 4) and P₂ = (−2, 5, 1).

  1. 1

    Step 1 — Compute the displacement vector

    v = P₂ − P₁ = (−2 − 3, 5 − (−1), 1 − 4) = ⟨−5, 6, −3⟩.
    v = ⟨−5, 6, −3⟩
  2. 2

    Step 2 — Compute the magnitude

    ‖v‖ = √[(−5)² + 6² + (−3)²] = √[25 + 36 + 9] = √70.
    d = √70 ≈ 8.37

Example 2: Point-to-Line

Find the distance from P = (1, 2, 3) to the line ℓ: r(t) = (0, 1, 0) + t⟨2, −1, 2⟩.

  1. 1

    Step 1 — Identify Q₀ and d

    From the line equation, Q₀ = (0, 1, 0) and the direction vector is d = ⟨2, −1, 2⟩.
    Q₀ = (0, 1, 0), d = ⟨2, −1, 2⟩
  2. 2

    Step 2 — Compute v = P − Q₀

    v = (1 − 0, 2 − 1, 3 − 0) = ⟨1, 1, 3⟩.
    v = ⟨1, 1, 3⟩
  3. 3

    Step 3 — Compute v × d

    v × d = |i j k; 1 1 3; 2 −1 2| = i(1·2 − 3·(−1)) − j(1·2 − 3·2) + k(1·(−1) − 1·2) = i(2 + 3) − j(2 − 6) + k(−1 − 2) = ⟨5, 4, −3⟩.
    v × d = ⟨5, 4, −3⟩
  4. 4

    Step 4 — Compute the magnitudes and divide

    ‖v × d‖ = √(25 + 16 + 9) = √50 = 5√2. Also, ‖d‖ = √(4 + 1 + 4) = √9 = 3. Therefore d(P, ℓ) = 5√2 / 3.
    d = 5√2 / 3 ≈ 2.357

Example 3: Point-to-Plane

Find the distance from P = (4, −1, 2) to the plane 2x + 3y − 6z = 7.

  1. 1

    Step 1 — Identify the coefficients

    The plane equation is 2x + 3y − 6z = 7, so a = 2, b = 3, c = −6, and d = 7. The normal vector is n = ⟨2, 3, −6⟩.
    n = ⟨2, 3, −6⟩, d = 7
  2. 2

    Step 2 — Evaluate the numerator

    |ax₀ + by₀ + cz₀ − d| = |2(4) + 3(−1) + (−6)(2) − 7| = |8 − 3 − 12 − 7| = |−14| = 14.
    Numerator = 14
  3. 3

    Step 3 — Evaluate the denominator

    ‖n‖ = √(4 + 9 + 36) = √49 = 7.
    Denominator = 7
  4. 4

    Step 4 — Compute the distance

    d(P, π) = 14/7 = 2.
    d = 2

SECTION 7

Strengths, Limitations & Common Pitfalls

Each distance formula has practical strengths and potential pitfalls that are worth examining before you begin applying them to problems. The following table highlights the key advantages and common sources of error for each formula.

FormulaStrengthsCommon Pitfalls
Point-to-PointDirect, requires no auxiliary information beyond coordinates; generalizes trivially to ℝⁿ; numerically stable.Sign errors in coordinate subtraction; forgetting to square negative differences (yielding negative terms under the radical).
Point-to-LineCross-product approach is compact and elegant; works for any parameterization of the line; avoids solving for the closest point explicitly.Confusing the direction vector d with the position vector Q₀; errors in the 3×3 cross-product determinant; forgetting to divide by ‖d‖.
Point-to-PlaneClosed-form expression using only the plane's coefficients and the point's coordinates; no need to find the foot of the perpendicular.Using the wrong sign convention (ax + by + cz + d = 0 vs. ax + by + cz = d); forgetting the absolute value (yielding signed distance instead).

Strengths and common pitfalls of each 3D distance formula

⚠️

KEY TAKEAWAY

A common source of confusion is the sign convention in the plane equation. Some textbooks write ax + by + cz + d = 0, while others write ax + by + cz = d. These lead to formulas that look slightly different in the numerator. Always check which form your plane equation is in before applying the formula. If in doubt, substitute a known point on the plane into your expression—the result should be zero if your setup is correct.

SECTION 8

Connection to Advanced Theory

The introductory distance formulas presented here are the entry point to a rich landscape of more advanced distance computations. In Calculus 3 and beyond, you will encounter distances between skew lines, distances from curves to surfaces, and ultimately the concept of distance in abstract metric spaces. The vector techniques you have learned generalize naturally to these settings.

This Lesson (Introductory)Advanced Extension
Point-to-point: d = ‖P₂ − P₁‖Generalized to ℝⁿ via the Euclidean norm; extends to non-Euclidean metrics (e.g., Minkowski distance in special relativity).
Point-to-line via cross productLine-to-line (skew lines) distance: d = |v · (d₁ × d₂)| / ‖d₁ × d₂‖, using the scalar triple product. Also foundational for curvature via the Frenet–Serret frame.
Point-to-plane via dot productGeneralizes to point-to-hyperplane in ℝⁿ and to signed-distance fields (SDFs) used in level-set methods, implicit surface modeling, and physics simulations.
Perpendicularity as optimality conditionLagrange multipliers yield the same perpendicularity condition when minimizing distance subject to a constraint surface—unifying these formulas with constrained optimization.

How introductory distance formulas connect to advanced topics

In differential geometry, the concept of distance evolves further: the distance between a point and a curve requires optimization over a continuously parameterized path, and the distance between two surfaces involves the Hausdorff metric. Nevertheless, at every level, the fundamental insight remains: distance equals the magnitude of the perpendicular component of a displacement vector, extracted using the inner product structure of the space.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Explain geometrically why the shortest distance from a point to a line must be measured along a direction perpendicular to the line. What would go wrong if you measured along a non-perpendicular direction?
Show answer
If you measure along any direction that is not perpendicular to the line, the resulting path from the point to the line would be longer than the true minimum distance—this follows from the Pythagorean theorem, since such a path would have a nonzero component parallel to the line in addition to the perpendicular component. Geometrically, as you slide the foot of your measurement along the line away from the true closest point, the hypotenuse of the resulting right triangle strictly increases. The perpendicular direction is unique in that it minimizes the length of the connecting segment, which is the definition of distance. This same reasoning generalizes to the point-to-plane case, where the shortest path is along the plane's normal.

Question 2: BASIC CALCULATION

Find the distance between the points A = (2, −3, 5) and B = (−1, 4, −2).
Show answer
Compute the displacement vector: B − A = ⟨−3, 7, −7⟩. Then ‖B − A‖ = √(9 + 49 + 49) = √107 ≈ 10.34. The distance is √107 units. This is a straightforward application of the Euclidean distance formula in ℝ³, extending the 2D Pythagorean theorem by including the z-coordinate difference.

Question 3: INTERMEDIATE

Find the distance from the point P = (3, 0, −1) to the line r(t) = (1, 2, 1) + t⟨1, −1, 3⟩.
Show answer
Let Q₀ = (1, 2, 1) and d = ⟨1, −1, 3⟩. Compute v = P − Q₀ = ⟨2, −2, −2⟩. Then v × d = |i j k; 2 −2 −2; 1 −1 3| = i((−2)(3) − (−2)(−1)) − j((2)(3) − (−2)(1)) + k((2)(−1) − (−2)(1)) = ⟨−8, −8, 0⟩. So ‖v × d‖ = √(64 + 64 + 0) = 8√2. Also ‖d‖ = √(1 + 1 + 9) = √11. Therefore d = 8√2/√11 = 8√22/11 ≈ 3.41. The cross product captures the area of the parallelogram formed by v and d, and dividing by the base ‖d‖ recovers the perpendicular height, which is the desired distance.

Question 4: APPLIED

A drone hovers at position P = (10, 20, 50) meters (in an east-north-up coordinate system). A building has a flat roof described by the plane 0x + 0y + z = 30 (i.e., z = 30). Separately, a power cable runs along the line r(t) = (0, 15, 40) + t⟨1, 0, 0⟩. Find the drone's vertical distance to the rooftop and its perpendicular distance to the cable.
Show answer
For the rooftop (plane z = 30, i.e., 0x + 0y + 1z = 30): d = |0(10) + 0(20) + 1(50) − 30| / √(0 + 0 + 1) = |20|/1 = 20 meters. For the cable: Q₀ = (0, 15, 40), d = ⟨1, 0, 0⟩, v = P − Q₀ = ⟨10, 5, 10⟩. v × d = |i j k; 10 5 10; 1 0 0| = ⟨0, 10, −5⟩. ‖v × d‖ = √(0 + 100 + 25) = √125 = 5√5. ‖d‖ = 1. So the distance to the cable is 5√5 ≈ 11.18 meters. The drone is 20 m above the roof and approximately 11.18 m from the cable at its closest approach.

Question 5: CRITICAL THINKING

Derive the point-to-line distance formula by minimizing the squared distance f(t) = ‖P − (Q₀ + td)‖² with respect to t. Show that the value of t at the minimum is t* = (v · d)/‖d‖², and substitute back to obtain d = ‖v − (v · d / ‖d‖²)d‖. Then prove that this expression equals ‖v × d‖/‖d‖.
Show answer
Define v = P − Q₀. Then f(t) = ‖v − td‖² = (v − td)·(v − td) = ‖v‖² − 2t(v·d) + t²‖d‖². This is a quadratic in t. Setting f'(t) = −2(v·d) + 2t‖d‖² = 0 gives t* = (v·d)/‖d‖². Since f''(t) = 2‖d‖² > 0, this is a minimum. The minimum distance squared is f(t*) = ‖v − ((v·d)/‖d‖²)d‖² = ‖v‖² − (v·d)²/‖d‖². To show equivalence with the cross-product formula, use the Lagrange identity: ‖v × d‖² = ‖v‖²‖d‖² − (v·d)². Dividing by ‖d‖² gives ‖v × d‖²/‖d‖² = ‖v‖² − (v·d)²/‖d‖² = f(t*). Taking square roots: d(P, ℓ) = ‖v × d‖/‖d‖, as required. This derivation illuminates the deep connection between the calculus-based minimization approach and the geometric cross-product formula—they are two perspectives on the same perpendicularity condition.

SUMMARY

Summary

Summary

This lesson introduced three fundamental distance formulas in ℝ³. The point-to-point distance is computed as d = ‖P₂ − P₁‖, a direct application of the Pythagorean theorem in three dimensions. The point-to-line distance uses the cross product to extract the perpendicular component: d = ‖v × d‖ / ‖d‖, where v connects the point to any point on the line and d is the line's direction vector. The point-to-plane distance uses the dot product with the normal vector: d = |ax₀ + by₀ + cz₀ − d| / ‖n‖.

The unifying geometric principle across all three formulas is that distance equals the magnitude of the perpendicular component of a connecting vector relative to the target object. This is achieved through vector rejection (for lines) or scalar projection (for planes), and it arises naturally from both the geometric and the optimization (calculus-based) perspectives. These formulas form the foundation for more advanced topics including skew-line distances, surface-to-surface distances, and Lagrange multiplier problems in multivariable calculus.

Varsity Tutors • Calculus 3 • Distance Formulas in 3D — Distances: Point-to-Point, Point-to-Line, Point-to-Plane (Intro)