3D Coordinate System

A 3D coordinate system locates every point in space with an ordered triple (x, y, z), using three perpendicular axes that meet at the origin. It extends the coordinate plane by adding a z-axis for height. With it you can plot points, find the distance between two points and write the equation of a sphere.

Before this lesson: Distance Formula, Equation of a Circle and Completing the Square

How the 3D coordinate system works

In the plane, two numbers (x, y) locate a point. Space needs a third number, so we add a z-axis perpendicular to both the x-axis and the y-axis. All three axes meet at the origin, (0, 0, 0).

The axes follow the right-hand rule: curl the fingers of your right hand from the positive x-axis toward the positive y-axis, and your thumb points along the positive z-axis. In most drawings the x-axis comes toward you, the y-axis points right and the z-axis points up.

To plot (4, 3, 5), move 4 units along the x-axis, then 3 units parallel to the y-axis, then 5 units up. The three numbers are the edge lengths of a box with one corner at the origin and the opposite corner at the point.

Three-dimensional axes with the x-axis pointing toward the viewer, the y-axis to the right and the z-axis up. A dashed box runs from the origin to the point P(4, 3, 5); its floor corner (4, 3, 0) lies in the shaded xy-plane, and the box edges along the axes have lengths 4, 3 and 5.
To reach P(4, 3, 5), move 4 along the x-axis, 3 along the y-axis, then 5 up.

Each pair of axes forms a coordinate plane. The xy-plane is where z = 0, the xz-plane is where y = 0, and the yz-plane is where x = 0. The three planes split space into eight octants. The first octant is the one where x, y and z are all positive.

One equation describes a surface, not a curve. In space, z = 5 is a whole flat plane parallel to the xy-plane, 5 units above it. In the same way, the set of points at a fixed distance from a center is a sphere, the 3D version of a circle.

Formulas for the 3D coordinate system

For points (x_1, y_1, z_1) and (x_2, y_2, z_2):

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}
M = \left(\dfrac{x_1 + x_2}{2}, \dfrac{y_1 + y_2}{2}, \dfrac{z_1 + z_2}{2}\right)

A sphere with center (h, k, l) and radius r has the equation:

(x - h)^2 + (y - k)^2 + (z - l)^2 = r^2
  • The distance formula is the Pythagorean theorem used twice: once across the floor and once up to the point.
  • The midpoint averages each coordinate.
  • The sphere equation says “the distance from (x, y, z) to the center is r,” squared on both sides.
  • The distance from (x, y, z) to the xy-plane is |z|, to the xz-plane is |y| and to the yz-plane is |x|.

3D coordinate system examples

Example 1: Locating a point

Describe where P(4, 3, 5) sits: its octant, the point directly below it in the xy-plane, and its distance to each coordinate plane.

(4, 3, 0)

Set z = 0 to drop straight down to the xy-plane.

|5| = 5

Distance to the xy-plane is |z|.

|3| = 3

Distance to the xz-plane is |y|.

|4| = 4

Distance to the yz-plane is |x|.

Answer: all three coordinates are positive, so P is in the first octant. It sits 5 units above (4, 3, 0), and it is 5, 3 and 4 units from the xy-, xz- and yz-planes.

Example 2: Distance between two points

Find the distance between P(1, −2, 3) and Q(4, 2, 15).

d = \sqrt{(4 - 1)^2 + (2 - (-2))^2 + (15 - 3)^2}

Substitute into the distance formula (see distance formula).

= \sqrt{3^2 + 4^2 + 12^2}

Subtract inside each set of parentheses.

= \sqrt{9 + 16 + 144}

Square each difference.

= \sqrt{169}

Add.

= 13

Take the square root.

Answer: the distance is 13 units.

Example 3: Sphere from the ends of a diameter

A diameter of a sphere runs from A(−1, 4, 2) to B(5, −4, 8). Write the equation of the sphere.

(h, k, l) = \left(\dfrac{-1 + 5}{2}, \dfrac{4 + (-4)}{2}, \dfrac{2 + 8}{2}\right)

The center is the midpoint of the diameter (see midpoint formula).

= \left(\dfrac{4}{2}, \dfrac{0}{2}, \dfrac{10}{2}\right)

Add in each numerator.

= (2, 0, 5)

Divide by 2.

r^2 = (5 - 2)^2 + (-4 - 0)^2 + (8 - 5)^2

r² is the squared distance from the center to B.

= 3^2 + (-4)^2 + 3^2

Subtract inside each set of parentheses.

= 9 + 16 + 9

Square each difference.

= 34

Add.

(x - 2)^2 + (y - 0)^2 + (z - 5)^2 = 34

Substitute the center and r² into the sphere equation.

(x - 2)^2 + y^2 + (z - 5)^2 = 34

Simplify y − 0 to y.

Answer: (x - 2)^2 + y^2 + (z - 5)^2 = 34. The radius is \sqrt{34} \approx 5.83.

Example 4: Center and radius by completing the square

Find the center and radius of the sphere x^2 + y^2 + z^2 - 6x + 4y - 10z + 22 = 0.

(x^2 - 6x) + (y^2 + 4y) + (z^2 - 10z) = -22

Group terms by variable and subtract 22 from both sides.

(x^2 - 6x + 9) + (y^2 + 4y + 4) + (z^2 - 10z + 25) = -22 + 9 + 4 + 25

Add the square of half of each linear coefficient to both sides (see completing the square).

(x - 3)^2 + (y + 2)^2 + (z - 5)^2 = -22 + 9 + 4 + 25

Factor each perfect square trinomial.

(x - 3)^2 + (y + 2)^2 + (z - 5)^2 = 16

Add on the right side.

r = \sqrt{16} = 4

Take the square root of r².

Answer: the center is (3, −2, 5) and the radius is 4. Watch the signs: (y + 2)² means k = −2.

Example 5: Wi-Fi range (word problem)

A Wi-Fi router sits at (2, 3, 1) in a building, measured in meters from one corner. Its signal reaches 12 meters in every direction. Is a laptop at (10, 9, 4) inside the signal sphere?

d = \sqrt{(10 - 2)^2 + (9 - 3)^2 + (4 - 1)^2}

Substitute the router and laptop into the distance formula.

= \sqrt{8^2 + 6^2 + 3^2}

Subtract inside each set of parentheses.

= \sqrt{64 + 36 + 9}

Square each difference.

= \sqrt{109}

Add.

\approx 10.44

Approximate the square root.

10.44 \lt 12

Compare the distance with the range.

Answer: the laptop is about 10.44 m from the router, which is less than 12 m, so it is inside the signal sphere.

Common mistakes

MistakeExample of the errorFix
Reading the center’s sign wrongCenter of (x + 4)^2 + \dots given as x = 4(x - h)^2 with h = −4 gives (x + 4)^2, so the center has x = −4.
Using r² as the radius(x - 2)^2 + y^2 + (z - 5)^2 = 34, so r = 34Take the square root: r = √34.
Completing the square on one side onlyAdding 9, 4 and 25 on the left but not the rightAdd the same numbers to both sides.
Leaving out the z-differenced = √(3² + 4²) = 5 for Example 2Use all three differences: d = √(3² + 4² + 12²) = 13.
Calling y = 4 a line“y = 4 is a horizontal line”In space, y = 4 is a plane parallel to the xz-plane.

Related methods

Traces of a sphere

A trace is where a surface meets a plane. To find it, substitute the plane’s equation. Here is the trace of the sphere from Example 4 in the plane z = 3:

(x - 3)^2 + (y + 2)^2 + (3 - 5)^2 = 16

Substitute z = 3.

(x - 3)^2 + (y + 2)^2 + 4 = 16

Square −2.

(x - 3)^2 + (y + 2)^2 = 12

Subtract 4 from both sides.

The trace is a circle centered at (3, −2, 3) with radius √12 = 2√3 ≈ 3.46 (see simplifying square roots). It has the same form as the equation of a circle in the plane.

Distance from a point to an axis

The distance from (x, y, z) to the z-axis ignores z: it is \sqrt{x^2 + y^2}. For P(4, 3, 5), that is √(16 + 9) = √25 = 5. Likewise, the distance to the x-axis is \sqrt{y^2 + z^2} and to the y-axis is \sqrt{x^2 + z^2}.

Next, points become arrows: vectors in space use the same three components, and the distance formula becomes the length of a vector.

Practice problems

  1. Find the distance from (−2, 5, −7) to each coordinate plane.
  2. Describe the set of points in space with y = 4.
  3. Find the distance between (2, −1, 4) and (8, 1, 7).
  4. Find the distance between (1, 1, 1) and (3, 5, −3).
  5. Find the midpoint of the segment from (−3, 6, 1) to (7, −2, 9).
  6. Write the equation of the sphere with center (1, −4, 2) and radius 5.
  7. Write the equation of the sphere with center (2, −1, 3) that passes through (4, 1, 4).
  8. Find the center and radius of x^2 + y^2 + z^2 + 8x - 2y - 4z + 5 = 0.
  9. Is the point (4, 5, 1) inside, on or outside the sphere (x - 1)^2 + (y - 1)^2 + z^2 = 25?
  10. A ceiling lamp at (6, 2, 10), in feet, lights every point within 11 feet. Is a plant at (0, −3, 4) lit?
Show answers

1.

|-7| = 7

Distance to the xy-plane is |z|.

|5| = 5

Distance to the xz-plane is |y|.

|-2| = 2

Distance to the yz-plane is |x|.

Answer: 7 units to the xy-plane, 5 units to the xz-plane and 2 units to the yz-plane.

2.

Answer: a plane parallel to the xz-plane that crosses the y-axis at (0, 4, 0). Every point in it has y = 4, and x and z can be anything.

3.

d = \sqrt{(8 - 2)^2 + (1 - (-1))^2 + (7 - 4)^2}

Substitute into the distance formula.

= \sqrt{6^2 + 2^2 + 3^2}

Subtract inside each set of parentheses.

= \sqrt{36 + 4 + 9}

Square each difference.

= \sqrt{49}

Add.

= 7

Take the square root.

Answer: 7 units

4.

d = \sqrt{(3 - 1)^2 + (5 - 1)^2 + (-3 - 1)^2}

Substitute into the distance formula.

= \sqrt{2^2 + 4^2 + (-4)^2}

Subtract inside each set of parentheses.

= \sqrt{4 + 16 + 16}

Square each difference.

= \sqrt{36}

Add.

= 6

Take the square root.

Answer: 6 units

5.

M = \left(\dfrac{-3 + 7}{2}, \dfrac{6 + (-2)}{2}, \dfrac{1 + 9}{2}\right)

Average each coordinate.

= \left(\dfrac{4}{2}, \dfrac{4}{2}, \dfrac{10}{2}\right)

Add in each numerator.

= (2, 2, 5)

Divide by 2.

Answer: (2, 2, 5)

6.

(x - 1)^2 + (y - (-4))^2 + (z - 2)^2 = 5^2

Substitute h = 1, k = −4, l = 2 and r = 5.

(x - 1)^2 + (y + 4)^2 + (z - 2)^2 = 25

Simplify the signs and square 5.

Answer: (x - 1)^2 + (y + 4)^2 + (z - 2)^2 = 25

7.

r^2 = (4 - 2)^2 + (1 - (-1))^2 + (4 - 3)^2

r² is the squared distance from the center to the point.

= 2^2 + 2^2 + 1^2

Subtract inside each set of parentheses.

= 4 + 4 + 1

Square each difference.

= 9

Add.

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

Substitute the center and r² into the sphere equation.

Answer: (x - 2)^2 + (y + 1)^2 + (z - 3)^2 = 9

8.

(x^2 + 8x) + (y^2 - 2y) + (z^2 - 4z) = -5

Group terms by variable and subtract 5 from both sides.

(x^2 + 8x + 16) + (y^2 - 2y + 1) + (z^2 - 4z + 4) = -5 + 16 + 1 + 4

Complete each square on both sides.

(x + 4)^2 + (y - 1)^2 + (z - 2)^2 = -5 + 16 + 1 + 4

Factor each perfect square trinomial.

(x + 4)^2 + (y - 1)^2 + (z - 2)^2 = 16

Add on the right side.

r = \sqrt{16} = 4

Take the square root of r².

Answer: center (−4, 1, 2), radius 4

9.

(4 - 1)^2 + (5 - 1)^2 + 1^2

Substitute the point into the left side.

= 3^2 + 4^2 + 1^2

Subtract inside each set of parentheses.

= 9 + 16 + 1

Square each number.

= 26

Add.

26 \gt 25

Compare with r² = 25.

Answer: outside, because its squared distance from the center is more than r².

10.

d = \sqrt{(0 - 6)^2 + (-3 - 2)^2 + (4 - 10)^2}

Substitute the lamp and plant into the distance formula.

= \sqrt{(-6)^2 + (-5)^2 + (-6)^2}

Subtract inside each set of parentheses.

= \sqrt{36 + 25 + 36}

Square each difference.

= \sqrt{97}

Add.

\approx 9.85

Approximate the square root.

9.85 \lt 11

Compare with the lamp’s reach.

Answer: yes. The plant is about 9.85 feet from the lamp, which is within 11 feet.

3D coordinate system FAQ

What is a 3D coordinate system?

It is a way to locate points in space with three numbers (x, y, z), measured along three perpendicular axes that meet at the origin. It is also called a three-dimensional rectangular or Cartesian coordinate system.

How do you find the distance between two points in 3D?

Subtract matching coordinates, square the three differences, add them and take the square root: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²).

What is the equation of a sphere?

A sphere with center (h, k, l) and radius r is (x − h)² + (y − k)² + (z − l)² = r². If the equation is expanded, complete the square in x, y and z to find the center and radius.

What is the right-hand rule for 3D axes?

Point the fingers of your right hand along the positive x-axis and curl them toward the positive y-axis. Your thumb then points along the positive z-axis. Textbooks and software draw axes this way so that formulas like the cross product give consistent signs.

Summary

  • A point in space is an ordered triple (x, y, z) on three perpendicular axes that follow the right-hand rule.
  • The coordinate planes are z = 0 (xy), y = 0 (xz) and x = 0 (yz); they split space into eight octants.
  • Distance: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). Midpoint: average each coordinate.
  • Sphere: (x − h)² + (y − k)² + (z − l)² = r². Complete the square to find the center and radius.
  • In space, one equation like z = 5 is a plane, not a line.

Previous course: Statistics Index

Next lesson: Vectors in 3D

Back to the Calculus 3 Index