Skip to content

Mathematics · Ch 5 — Introduction to Three-Dimensional Geometry

Distance Between Two Points

5.4

Distance Between Two Points

Distance Between Two Points in Three Dimensions

We already know how to find the distance between two points on a plane, using the familiar formula (x2−x1)2+(y2−y1)2\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}. The step into three dimensions is a natural extension of that idea. Instead of working with just two axes, we now have three mutually perpendicular axes — XX, YY, and ZZ — and the distance formula gains one more term.

Consider two points P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2) in space, referred to a rectangular coordinate system with axes OXOX, OYOY, and OZOZ. To find the distance PQPQ, we build a rectangular box (a rectangular parallelepiped) around these points. Through PP and QQ, draw planes parallel to the coordinate planes. The segment PQPQ becomes the diagonal of this box.

Look at the right triangle PAQPAQ, where AA is the vertex such that PAPA is parallel to the YY-axis and AQAQ lies in a plane parallel to the XZXZ-plane. Since ∠PAQ\angle PAQ is a right angle, we have:

PQ2=PA2+AQ2(1)PQ^2 = PA^2 + AQ^2 \quad \text{(1)}

Now consider triangle ANQANQ, where NN is the foot of the perpendicular from AA to the XX-axis, so that ANAN is parallel to the XX-axis and NQNQ is parallel to the ZZ-axis. Triangle ANQANQ is also right-angled at NN, giving:

AQ2=AN2+NQ2(2)AQ^2 = AN^2 + NQ^2 \quad \text{(2)}

Substituting (2) into (1):

PQ2=PA2+AN2+NQ2PQ^2 = PA^2 + AN^2 + NQ^2

Now, what are these lengths in terms of coordinates? The difference in the yy-coordinates gives PA=y2−y1PA = y_2 - y_1. The difference in the xx-coordinates gives AN=x2−x1AN = x_2 - x_1. The difference in the zz-coordinates gives NQ=z2−z1NQ = z_2 - z_1. Therefore:

PQ2=(x2−x1)2+(y2−y1)2+(z2−z1)2PQ^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2

Taking the positive square root gives the distance formula:

PQ=(x2−x1)2+(y2−y1)2+(z2−z1)2PQ = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}

This is the distance between any two points P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2) in three-dimensional space. …

Figure 11.4Rectangular parallelepiped with diagonal PQ (distance between two points)
Fig. 11.4 — Rectangular parallelepiped with diagonal PQ (distance between two points)

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

Fig. 11.4 is a three-dimensional sketch of a rectangular box — a rectangular parallelepiped — drawn with its edges parallel to the coordinate axes. The axes are labelled OX, OY, OZ, with O at the origin. In the drawing, the Z-axis points upward, the Y-axis points to the right, and the X-axis comes out toward the lower left from O. The box itself floats above the Y-axis, not touching the origin.

Two opposite corners of the box are marked P and Q. P is the lower-left corner (closer to the origin), and Q is the upper-right corner (farther away). The space diagonal PQ is drawn in indigo, running through the interior of the box from P to Q. Three intermediate corners are also labelled: A is the corner reached from P by moving along the Y-direction (so PA is horizontal and parallel to the Y-axis); N is the corner directly below A, reached from A by moving along the X-direction (so AN is horizontal and parallel to the X-axis). The face diagonal AQ is also drawn in indigo, lying on the top face of the box. Right-angle marks are shown at A (for angle PAQ) and at N (for angle ANQ), confirming that triangles PAQ and ANQ are right-angled.

The physical idea the figure teaches is this: the straight-line distance between any two points P and Q in space can be found by constructing a rectangular box whose edges are parallel to the axes, with P and Q at opposite corners. The three edges of the box that meet at P are exactly the differences in the x, y, and z coordinates between P and Q. Because the box is rectangular, the space diagonal PQ is the hypotenuse of two successive right triangles, and its length is the square root of the sum of the squares of the three edge lengths.

The textbook uses the figure to derive the distance formula. From the right triangle PAQ:

PQ2=PA2+AQ2PQ^2 = PA^2 + AQ^2

From the right triangle ANQ:

AQ2=AN2+NQ2AQ^2 = AN^2 + NQ^2

Combining these gives:

PQ2=PA2+AN2+NQ2PQ^2 = PA^2 + AN^2 + NQ^2

Now, reading the edge lengths from the coordinates:

  • PA=y2−y1PA = y_2 - y_1 (the difference in y-coordinates)
  • AN=x2−x1AN = x_2 - x_1 (the difference in x-coordinates)
  • NQ=z2−z1NQ = z_2 - z_1 (the difference in z-coordinates)

Therefore:

PQ2=(x2−x1)2+(y2−y1)2+(z2−z1)2PQ^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2

PQ=(x2−x1)2+(y2−y1)2+(z2−z1)2PQ = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}

This is the distance between two points P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2) in three-dimensional space. In the special case where P is the origin O(0,0,0), the formula reduces to OQ=x22+y22+z22OQ = \sqrt{x_2^2 + y_2^2 + z_2^2}. …