← MATH 241 MathScape 0 MATH241

Distance in 3D

3 min read

Jump to a section
Reference: Stewart §12.1

Textbook Reference

Primary source OpenStax Calculus Volume 3, Section 2.2: “Vectors in Three Dimensions”
Direct link https://openstax.org/books/calculus-volume-3/pages/2-2-vectors-in-three-dimensions
Textbook used in class Stewart, Calculus, Section 12.1: “Three-Dimensional Coordinate Systems” (Examples 3, 4)

Opening Scenario

The Pythagorean theorem gives the distance between two points in the plane as $\sqrt{(\Delta x)^2 + (\Delta y)^2}$. In 3D you apply it twice: once to get the diagonal of the base rectangle, then again to lift that diagonal up to the point at height $\Delta z$. The result is the three-dimensional distance formula, and it leads directly to the equation of a sphere.


Quick Reference

Distance formula. \[ |P_1 P_2| = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}. \]

Equation of a sphere with center $(a, b, c)$ and radius $r$: \[ (x - a)^2 + (y - b)^2 + (z - c)^2 = r^2. \]

A sphere is the set of all points at distance $r$ from the center.


Key Concepts

1. Deriving and Applying the Distance Formula

Example 1. Find the distance from $P_1 = (1, -2, 4)$ to $P_2 = (3, 0, -1)$. (Stewart 12.1, Example 3.)

\[ |P_1 P_2| = \sqrt{(3-1)^2 + (0-(-2))^2 + (-1-4)^2} = \sqrt{4 + 4 + 25} = \sqrt{33}. \]

Boxed answer: $\sqrt{33}$.


2. The Equation of a Sphere

A sphere with center $C = (a, b, c)$ and radius $r$ is the set of all points $P = (x, y, z)$ with $|CP| = r$: \[ (x - a)^2 + (y - b)^2 + (z - c)^2 = r^2. \]

Example 2. Show that $x^2 + y^2 + z^2 + 4x - 6y + 2z + 6 = 0$ is the equation of a sphere, and find its center and radius. (Stewart 12.1, Example 4.)

Complete the square in each variable: \[ (x^2 + 4x + 4) + (y^2 - 6y + 9) + (z^2 + 2z + 1) = -6 + 4 + 9 + 1 = 8. \] \[ (x+2)^2 + (y-3)^2 + (z+1)^2 = 8. \]

Boxed answer: Center $(-2, 3, -1)$, radius $r = \sqrt{8} = 2\sqrt{2}$.

Recap. Completing the square in three variables simultaneously is the standard technique. Add the same constants to both sides. The right side must be positive for a real sphere.


3. Midpoint Formula

The midpoint of $P_1 = (x_1, y_1, z_1)$ and $P_2 = (x_2, y_2, z_2)$ is \[ M = \left(\frac{x_1+x_2}{2},\, \frac{y_1+y_2}{2},\, \frac{z_1+z_2}{2}\right). \] This is the 3D analogue of the 2D midpoint formula.


Common misconception

taking the center of the sphere directly from the expanded equation without completing the square. The equation $x^2 + y^2 + z^2 + 4x - 6y + 2z + 6 = 0$ does NOT have center $(4, -6, 2)$. Those are the coefficients of the linear terms, not the coordinates of the center. Complete the square to find the center $(-2, 3, -1)$.


Common Errors Summary

Error Correction
Not squaring differences before summing Distance uses $(x_2 - x_1)^2$, not $|x_2 - x_1|$ summed; the sum is inside the square root
Forgetting to add the completing-square constants to both sides For each variable $x^2 + bx$, add $(b/2)^2$ to both sides
Accepting a negative right side as a sphere If $r^2 \leq 0$ after completing the square, the “sphere” is imaginary or a single point

Common Misconceptions

Common misconception

the center of a sphere can be read directly from the linear coefficients of the expanded equation.

This is the concept-image-conflicts-definition error. In the expanded form $x^2 + y^2 + z^2 + 4x - 6y + 2z + 6 = 0$, the numbers $4$, $-6$, and $2$ are not the center coordinates. Completing the square in each variable reveals the center $(-2, 3, -1)$ and radius $2\sqrt{2}$. Reading the linear coefficients directly gives the wrong sign and misses the halving step.


Leveled Practice

Problem 1. Find the equation of the sphere with center $(1, -3, 2)$ and radius $4$.

Show answer

$(x-1)^2 + (y+3)^2 + (z-2)^2 = 16$.


Problem 2. Find the center and radius of $x^2 + y^2 + z^2 - 2x + 4y - 6z + 5 = 0$.

Show answer

$(x^2 - 2x + 1) + (y^2 + 4y + 4) + (z^2 - 6z + 9) = -5 + 1 + 4 + 9 = 9$.

$(x-1)^2 + (y+2)^2 + (z-3)^2 = 9$.

Center $(1, -2, 3)$, radius $3$.


Mastery Checklist


Previous: Three-Dimensional Coordinates | Next: Vector Definition