Coordinates and distance in three dimensions
Two numbers pin down any spot on a flat page. How many does it take to pin down a spot in a room, and once you have them, how far apart are two such spots?
Where you are 8 in Solids
Why this exists
The The coordinate plane gives every point of a flat page a name: two numbers, one across and one up. That is enough for a map, a graph or a floor plan. It is not enough for a light hanging from a ceiling, a drone over a field or a corner of a box. Two lamps can sit over exactly the same spot on the floor and still be in different places, because one hangs lower than the other. A third number is needed, for height.
The The distance formula has the same limit. It measures a straight line drawn on the page. The straight line from a socket near the floor to a lamp near the ceiling leaves the floor, and the plane formula has nowhere to put the climb. Three coordinates give space a name for every point, and with them comes a distance formula for space, built from the Pythagorean theorem used twice.
Definition
Pick a point O, the origin, and three number lines through it, each one perpendicular to the other two, all with the same unit of length. These are the coordinate axes: the x-axis, the y-axis and the z-axis.
The usual way to set them up is the right-hand system: 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. In the pictures here the y-axis runs to the right, the z-axis runs up and the x-axis comes out of the page toward you, drawn slanting down and to the left.
To find the coordinates of a point P, get there from O in three moves, each one along an axis direction:
- move a units in the x-direction (backwards if a is negative),
- then b units in the y-direction,
- then c units in the z-direction.
The point is named by the ordered triple (a, b, c). Order matters: (1, 2, 3) and (3, 2, 1) are different points. The set of all ordered triples of real numbers is written \mathbb{R}^3, and with the axes in place it is all of space.
Each pair of axes lies in one plane, a coordinate plane:
| Plane | Holds | Equation |
|---|---|---|
| the xy-plane | the x- and y-axes | z = 0 |
| the xz-plane | the x- and z-axes | y = 0 |
| the yz-plane | the y- and z-axes | x = 0 |
The three coordinate planes cut space into eight regions called octants, one for each pattern of signs. The first octant is the one where all three coordinates are positive.
Intuition
A point in space is a point in the plane with a height attached. The first two numbers of (4, 5, 3) say where you stand on the floor, at the spot (4, 5, 0) directly underneath; the last number says how far up to go. Drawing the dashed path in the figure, along the x-axis, across, then up, is the reliable way to show a point on paper, because a lone dot in a slanted drawing could be anywhere along your line of sight.
Stand in the corner of a room. The floor is the xy-plane, every point on it has height 0, so its equation is z = 0. The wall running along the y-axis is the yz-plane, made of the points with x = 0, and the other wall is the xz-plane, where y = 0. The edges where the walls meet the floor, and each other, are the three axes, and the corner itself is the origin.
So each coordinate is a signed distance from a coordinate plane: in (a, b, c), the number c says how far the point is above the floor (below it if c is negative), a how far in front of the back wall, and b how far to the right of the side wall. An equation that fixes one coordinate, such as z = 2, describes a whole plane: a floor two units up, parallel to the xy-plane. Fixing two, such as x = 0 and y = 0, leaves a line: the z-axis.
Results
Distance from a point to the coordinate planes. The point (a, b, c) is |c| from the xy-plane, |b| from the xz-plane and |a| from the yz-plane.
Distance from a point to the axes. The point (a, b, c) is \displaystyle \sqrt{a^2 + b^2} from the z-axis, \displaystyle \sqrt{b^2 + c^2} from the x-axis and \displaystyle \sqrt{a^2 + c^2} from the y-axis. The nearest point of the z-axis is (0, 0, c), at the same height.
The distance formula in space. The distance between P(x_1, y_1, z_1) and Q(x_2, y_2, z_2) is the square root of the right side of
In particular the distance from the origin to (a, b, c) is \displaystyle \sqrt{a^2 + b^2 + c^2}.
The midpoint. The midpoint of the segment from P(x_1, y_1, z_1) to Q(x_2, y_2, z_2) is the point whose coordinates are the averages:
The sphere. The sphere with center (h, k, l) and radius r > 0, the set of all points at distance r from the center, has the equation
Why it is true
The distance formula. Take P(x_1, y_1, z_1) and Q(x_2, y_2, z_2) and build the box that has them as opposite corners, with its edges parallel to the axes. Two more corners of the box do the work: S(x_1, y_2, z_1) and R(x_2, y_2, z_1).
Going from P to S changes only the y-coordinate, so PS runs parallel to the y-axis and PS = |y_2 - y_1|. Going from S to R changes only x, so SR runs parallel to the x-axis and SR = |x_2 - x_1|. The x- and y-axes are perpendicular, so the angle at S is a right angle, and the Pythagorean theorem in triangle PSR gives
The absolute values drop away because a square is never negative.
Now R and Q differ only in z, so RQ is upright, parallel to the z-axis, and RQ = |z_2 - z_1|. The segment PR lies in the level plane z = z_1. The upright line RQ is perpendicular to the two level lines through R that run parallel to the x- and y-axes. A fact of solid geometry finishes the step: a line perpendicular to two crossing lines of a plane, at their crossing point, is perpendicular to every line of that plane through that point. PR is one of those lines, so the angle at R is a right angle too, and the Pythagorean theorem in triangle PRQ gives
Taking the positive square root gives the formula. If P and Q happen to agree in a coordinate, the box is flat and one of the triangles collapses to a segment, but the formula still holds: a difference of 0 simply adds 0. The distance from a point to the origin is the case P = O.
The distance to an axis. A point of the z-axis is (0, 0, t). By the formula, its distance from (a, b, c) is \displaystyle \sqrt{a^2 + b^2 + (c - t)^2}. The term (c - t)^2 is smallest, 0, when t = c, so the nearest point is (0, 0, c) and the least distance is \displaystyle \sqrt{a^2 + b^2}. The other two axes work the same way.
The midpoint. From P to M, each coordinate changes by half as much as it does from P to Q. Each square in the distance formula is then a quarter as large, so PM = \tfrac{1}{2} PQ. The same holds from M to Q, so PM + MQ = PQ. If M were off the segment, P, M and Q would make a triangle and PM + MQ would be longer than PQ. So M lies on the segment, halfway along.
The sphere. A point (x, y, z) is on the sphere exactly when its distance to (h, k, l) is r. Both sides of that statement are positive, so squaring them loses nothing, and the square of the distance formula is the equation above. It is the equation of a circle with one more square.
Worked examples
Locating a point
Describe how to reach (3, -2, 4) from the origin. What pattern of signs does it have, is it in the first octant, and how far is it from each coordinate plane?
SolutionGo 3 units in the positive x-direction (toward you, in the pictures), then 2 units in the negative y-direction (to the left), then 4 units up. The spot (3, -2, 0) on the floor is directly beneath it.
The signs are (+, -, +): in front of the back wall, on the left of the side wall, above the floor. That is not the first octant, since the y-coordinate is negative.
Each coordinate is a signed distance from one plane, so the distances are the sizes of the coordinates: |3| = 3 from the yz-plane, |-2| = 2 from the xz-plane and |4| = 4 from the xy-plane.
Distance between two points
Find the distance between P(1, -2, 3) and Q(4, 2, 15).
SolutionFind the change in each coordinate first, since the formula squares each one: x_2 - x_1 = 3, y_2 - y_1 = 4 and z_2 - z_1 = 12. Then
Check. The floor diagonal is \displaystyle \sqrt{9 + 16} = 5, and the upright leg is 12; a right triangle with legs 5 and 12 has hypotenuse 13.
A radical answer and a midpoint
For A(-2, 5, 1) and B(4, 1, -3), find AB and the midpoint M of \overline{AB}. Then check that M is half of AB from A.
SolutionThe changes are 6, -4 and -4. Squaring removes the signs:
The last step pulls out the square factor: 68 = 4 \cdot 17.
The midpoint averages each coordinate:
Check. From A to M the changes are 3, -2 and -2, so \displaystyle AM = \sqrt{9 + 4 + 4} = \sqrt{17}, which is half of \displaystyle 2\sqrt{17}.
Distances to the planes and the axes
For P(5, -12, 4), find the distance to each coordinate plane, to each axis and to the origin.
SolutionThe distances to the planes are the sizes of the coordinates: 5 from the yz-plane, 12 from the xz-plane and 4 from the xy-plane.
For the z-axis, the nearest point is (0, 0, 4), at the same height as P, so only the x- and y-coordinates count:
The same reasoning for the other axes keeps the two coordinates that are not along that axis. The x-axis: \displaystyle \sqrt{(-12)^2 + 4^2} = \sqrt{160} = 4\sqrt{10}. The y-axis: \displaystyle \sqrt{5^2 + 4^2} = \sqrt{41}.
The origin uses all three: \displaystyle \sqrt{25 + 144 + 16} = \sqrt{185}. As it should be, that is farther than any of the axes, because the origin lies on every axis.
A missing coordinate
The point (1, k, 4) is 3 units from (3, -1, 2). Find every possible value of k.
SolutionThe changes in the coordinates are 3 - 1 = 2, -1 - k and 2 - 4 = -2. Write the distance with k left in, and square both sides to clear the root (both sides are positive, so nothing is lost):
That is 4 + (k + 1)^2 + 4 = 9, so (k + 1)^2 = 1. A number whose square is 1 is 1 or -1:
so k = 0 or k = -2.
Two answers make sense in space. The points (1, k, 4) form a line parallel to the y-axis, and the points 3 from (3, -1, 2) form a sphere; the line passes through the sphere, going in at one point and out at the other.
Check. For k = 0: 4 + 1 + 4 = 9. For k = -2: 4 + 1 + 4 = 9. Both distances are 3.
A sphere and where it meets the floor
Write the equation of the sphere with center (2, -1, 3) and radius 5. Is (5, 3, 3) on it? Is the origin inside or outside? Where does the sphere meet the xy-plane?
SolutionPut the center and radius into the sphere equation:
For (5, 3, 3) the left side is 3^2 + 4^2 + 0^2 = 25, so the point is exactly 5 from the center and lies on the sphere.
For the origin the left side is (-2)^2 + 1^2 + (-3)^2 = 14. That is the square of the distance to the center, and 14 < 25, so the origin is less than 5 from the center: inside.
The xy-plane is where z = 0. Putting z = 0 in the equation:
On the floor that is a circle with center (2, -1, 0) and radius 4. The center of the sphere is 3 above the floor, and a right triangle with hypotenuse 5 and one leg 3 has other leg 4.
A right triangle in space
Show that A(1, 1, 1), B(3, 2, 3) and C(2, -1, 1) are the corners of a right triangle, and find its area.
SolutionFind the three side lengths, squared, to keep the arithmetic exact. From A to B the changes are 2, 1 and 2; from A to C they are 1, -2 and 0; from B to C they are -1, -3 and -2. So
Since 9 + 5 = 14, the squares of the two shorter sides add to the square of the longest, and by the converse of the Pythagorean theorem the angle at A, opposite the longest side, is a right angle. The three points cannot lie on one line, because then the longest side would equal the sum of the other two, and \displaystyle 3 + \sqrt{5} is not \displaystyle \sqrt{14}.
The legs are AB = 3 and \displaystyle AC = \sqrt{5}, so the area is
Boundaries
- The axes must be perpendicular and share one unit. The distance formula is the Pythagorean theorem, and that needs right angles. With slanted axes, or a different unit on one axis, the three numbers still name points but the sum of squares no longer gives distance.
- A drawing is not to scale in every direction. In the pictures the x-direction is drawn at half length and at a slant, so two equal lengths in space can look unequal on paper. Distances come from the coordinates, never from measuring the drawing.
- The meaning of a triple depends on an agreed set-up. A left-hand system, with one axis reversed, is just as consistent, but the same triple then names the mirror-image point. The distance formula is the same in both, because it only squares differences.
- An equation means different things with different numbers of coordinates. x = 2 is a point on a number line, a line in the plane and a plane in space.
- The formula measures straight through space. An ant walking over the outside of a box, or a ship following the curve of the Earth, travels farther than the formula gives, because its path is not a straight segment.
- The sphere equation needs a positive right side. After rearranging, an equation of the form (x - h)^2 + (y - k)^2 + (z - l)^2 = 0 describes the single point (h, k, l), and one with a negative right side describes no points at all.
Where this goes next
With three coordinates, the arrow from one point to another is also three numbers, and vectors in space are built on exactly that: length is the distance formula, and direction comes from the three changes. The box argument is the same one used to find the long diagonal of a box in The Pythagorean theorem in three dimensions, and the sphere equation turns the sphere into something algebra can work with. Nothing in the argument depends on there being three coordinates rather than four or ten. In vectors in n dimensions a point has n coordinates and its distance from the origin is the square root of the sum of n squares, an idea that reaches far beyond physical space into data, where each coordinate is one measurement.
Exercises
Points, planes and axes
- Say where each point lies: on an axis, on a coordinate plane, or neither. (a) (0, 5, -2) (b) (3, 0, 0) (c) (-1, 4, 0)
- A point lies directly below (3, -1, 4) and 7 units below the xy-plane. Give its coordinates.
- Start at (2, 5, -1). Move 3 units in the negative x-direction, then 4 units in the positive y-direction, then 6 units up. Where do you end, and which coordinate planes did the path cross?
- Describe in words the set of all points with z = -3, and the set of all points with x = 0 and y = 0.
Distances to the planes, the axes and the origin
- Find the distance from (6, -8, 3) to each of the three coordinate planes.
- Find the distance from (6, -8, 3) to each of the three axes.
- Find the distance from (6, -8, 3) to the origin.
Distance between two points
- Find the distance between (0, 0, 0) and (2, 3, 6).
- Find the distance between (1, 4, -2) and (3, -2, 1).
- Find the distance between (-3, 2, 5) and (1, -1, 5).
- Measured in meters from one corner of a room, a wall socket is at (0, 2, 0.5) and a ceiling lamp at (2, 8, 2.5). How long is a string stretched straight from the socket to the lamp?
- Find the distance between \left(\tfrac{1}{2}, 1, -1\right) and \left(2, -1, \tfrac{1}{2}\right).
Midpoints
- Find the midpoint of the segment from (-3, 4, 7) to (5, -2, 1).
- M(2, -1, 3) is the midpoint of \overline{AB}, and A = (-1, 4, 6). Find B.
A missing coordinate
- The point (1, 2, z) is 7 units from (3, -1, 4). Find every possible value of z.
- Find the point on the y-axis that is the same distance from A(1, 2, 3) as from B(-1, 4, 1).
Spheres
- Write the equation of the sphere with center (-1, 0, 4) and radius 3.
- For the sphere (x - 1)^2 + (y + 2)^2 + (z - 3)^2 = 49, decide whether (4, 0, -3) is on, inside or outside it, and the same for the origin.
- A sphere has center (3, -4, 5) and radius 6. Describe where it meets the xy-plane, and find the points where it meets the z-axis.
- Find the center and radius of the sphere x^2 + y^2 + z^2 - 4x + 6y - 2z = 2.
Shapes from coordinates
- Find the side lengths of the triangle with corners A(2, 0, 1), B(4, 2, 2) and C(0, 2, 2). Is it isosceles? Is it a right triangle?
- Do the points P(1, 2, -1), Q(3, 5, 1) and R(7, 11, 5) lie on one line? Use distances to decide.
Reasoning
- Explain why the distance formula gives the same answer whichever of the two points you call P.
- Explain why the point of the z-axis nearest to (a, b, c) is (0, 0, c), and why the distance is \displaystyle \sqrt{a^2 + b^2} whatever c is.
- Describe the set of points satisfying x = 2 on a number line, in the coordinate plane and in space, and explain why the answers differ.
- Ilka says a point can be the same distance from all three coordinate planes only in the first octant. Is she right? Explain.
- Show that, for any point P, the squares of its distances to the three axes add up to twice the square of its distance from the origin.
Answers
- (a) On the yz-plane, since x = 0; not on an axis, since the other two coordinates are not 0. (b) On the x-axis, since y = 0 and z = 0. (c) On the xy-plane, since z = 0.
- (3, -1, -7). Directly below keeps x and y; 7 below the xy-plane means z = -7.
- (-1, 9, 5), from 2 - 3 = -1, 5 + 4 = 9 and -1 + 6 = 5. The path crossed the yz-plane, because x went from positive to negative, and the xy-plane, because z went from negative to positive. It did not cross the xz-plane, because y stayed positive.
- The points with z = -3 form a plane parallel to the xy-plane, 3 units below it. The points with x = 0 and y = 0 form the z-axis.
- 6 from the yz-plane, 8 from the xz-plane and 3 from the xy-plane: the sizes of the coordinates.
- \displaystyle \sqrt{73} from the x-axis, \displaystyle 3\sqrt{5} from the y-axis and 10 from the z-axis. Keep the two coordinates not along each axis: \displaystyle \sqrt{64 + 9}, \displaystyle \sqrt{36 + 9} = \sqrt{45} and \displaystyle \sqrt{36 + 64}.
- \displaystyle \sqrt{109}, from \displaystyle \sqrt{36 + 64 + 9}.
- 7, from \displaystyle \sqrt{4 + 9 + 36} = \sqrt{49}.
- 7. The changes are 2, -6 and 3, and \displaystyle \sqrt{4 + 36 + 9} = \sqrt{49}.
- 5. The changes are 4, -3 and 0, so \displaystyle \sqrt{16 + 9 + 0} = 5. Both points have the same height, so this is a distance in a level plane.
- \displaystyle 2\sqrt{11} meters, about 6.63 meters. The changes are 2, 6 and 2, so \displaystyle \sqrt{4 + 36 + 4} = \sqrt{44} = 2\sqrt{11}.
- \displaystyle \dfrac{\sqrt{34}}{2}. The changes are \tfrac{3}{2}, -2 and \tfrac{3}{2}, so the sum of squares is \tfrac{9}{4} + 4 + \tfrac{9}{4} = \tfrac{17}{2}, and \displaystyle \sqrt{\tfrac{17}{2}} = \tfrac{\sqrt{34}}{2}.
- (1, 1, 4), from \tfrac{-3 + 5}{2}, \tfrac{4 + (-2)}{2} and \tfrac{7 + 1}{2}.
- B = (5, -6, 0). Each coordinate of M is the average, so B’s coordinate is twice M’s minus A’s: 4 - (-1) = 5, -2 - 4 = -6 and 6 - 6 = 0.
- z = 10 or z = -2. From 4 + 9 + (z - 4)^2 = 49, (z - 4)^2 = 36, so z - 4 = 6 or z - 4 = -6.
- (0, 1, 0). A point of the y-axis is (0, t, 0). Setting the squared distances equal, 1 + (t - 2)^2 + 9 = 1 + (t - 4)^2 + 1, which simplifies to 4t = 4, so t = 1. Both distances are \displaystyle \sqrt{11}.
- (x + 1)^2 + y^2 + (z - 4)^2 = 9.
- (4, 0, -3) is on the sphere: 3^2 + 2^2 + (-6)^2 = 49. The origin is inside: 1 + 4 + 9 = 14 < 49.
- It meets the xy-plane in a circle with center (3, -4, 0) and radius \displaystyle \sqrt{11}: with z = 0, (x - 3)^2 + (y + 4)^2 = 36 - 25 = 11. It meets the z-axis at \displaystyle (0, 0, 5 + \sqrt{11}) and \displaystyle (0, 0, 5 - \sqrt{11}): with x = 0 and y = 0, 9 + 16 + (z - 5)^2 = 36, so (z - 5)^2 = 11.
- Center (2, -3, 1), radius 4. Completing the square in each variable, (x - 2)^2 - 4 + (y + 3)^2 - 9 + (z - 1)^2 - 1 = 2, so the sum of the squares is 16.
- AB = 3, AC = 3, BC = 4. It is isosceles. It is not a right triangle: 3^2 + 3^2 = 18, which is not 4^2 = 16.
- Yes. \displaystyle PQ = \sqrt{4 + 9 + 4} = \sqrt{17}, \displaystyle QR = \sqrt{16 + 36 + 16} = 2\sqrt{17} and \displaystyle PR = \sqrt{36 + 81 + 36} = 3\sqrt{17}. Since PQ + QR = PR, Q lies on segment PR: off the line, the three would form a triangle and PQ + QR would be longer than PR.
- Swapping the points changes the sign of each difference, as x_1 - x_2 = -(x_2 - x_1), and a number and its negative have the same square. Every term of the sum is unchanged, so the distance is too.
- A point of the z-axis is (0, 0, t), at squared distance a^2 + b^2 + (c - t)^2 from (a, b, c). The last term is never negative and is 0 exactly when t = c, so the distance is smallest at (0, 0, c), where it is \displaystyle \sqrt{a^2 + b^2}. The value of c only says which height of the axis is nearest; it never adds to the distance.
- On a number line, x = 2 is one point. In the plane it is the line of points (2, y), parallel to the y-axis. In space it is the plane of points (2, y, z), parallel to the yz-plane. The equation fixes one coordinate and leaves every other one free, so each extra coordinate adds one more free direction.
- No. A point is the same distance from all three planes when |a| = |b| = |c|. That allows any signs, so (-2, 2, -2), for one, is 2 from each plane and lies in a different octant. Every octant holds such points: (\pm t, \pm t, \pm t) with t > 0 and any choice of signs.
- For P(a, b, c) the squared distances to the axes are b^2 + c^2, a^2 + c^2 and a^2 + b^2. Their sum is 2a^2 + 2b^2 + 2c^2 = 2(a^2 + b^2 + c^2), which is twice the square of the distance \displaystyle \sqrt{a^2 + b^2 + c^2} to the origin.