The distance between two points in space follows directly from Pythagoras’ theorem applied twice. If $P(x_1, y_1, z_1)$ and $Q(x_2, y_2, z_2)$ are any two points, the distance $PQ$ is the length of the straight segment joining them.
$$PQ = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}$$
This is exactly the 2D distance formula with one extra squared term — the $z$-difference — added under the root. Compare the two side by side.
Distance from the origin: Putting $P = O(0, 0, 0)$ gives a handy special case.
$$OQ = \sqrt{x_2^{\,2} + y_2^{\,2} + z_2^{\,2}}$$
What the formula lets you prove: Because distance is unambiguous, you can settle a great many geometric questions purely by computing lengths. Three points are collinear when the sum of two of the three pairwise distances equals the third. A triangle is isosceles if two sides are equal, equilateral if all three are equal, and right-angled when the three side-lengths satisfy $a^2 + b^2 = c^2$.
Deeper Insight — why one extra term is all you need: The 3D distance formula is not a new idea so much as Pythagoras’ theorem used twice. First imagine the box (rectangular parallelepiped) whose opposite corners are $P$ and $Q$ and whose edges are parallel to the axes; the diagonal of its base has length $\sqrt{(\Delta x)^2 + (\Delta y)^2}$ by the ordinary plane theorem. That base diagonal and the vertical edge of length $|\Delta z|$ are themselves perpendicular, so a second application of Pythagoras gives the space diagonal $\sqrt{(\Delta x)^2 + (\Delta y)^2 + (\Delta z)^2}$. This "Pythagoras twice" argument is why every coordinate dimension contributes its own squared difference, and it generalises cleanly to any number of dimensions. The practical payoff is huge: shape problems that would be hard to picture in space — is this triangle right-angled? are these four points the vertices of a square? — collapse into routine arithmetic the moment you compute a few distances.
Find the distance between $P(1, -3, 4)$ and $Q(4, 1, 6)$.
Solution- Differences: $x_2 - x_1 = 3$, $y_2 - y_1 = 4$, $z_2 - z_1 = 2$.
- Square and add: $3^2 + 4^2 + 2^2 = 9 + 16 + 4 = 29$.
- $PQ = \sqrt{29}$.
Answer: $PQ = \sqrt{29}$ units.
Find the distance of the point $A(2, -1, 2)$ from the origin.
Solution- Use $OA = \sqrt{x^2 + y^2 + z^2}$.
- $OA = \sqrt{2^2 + (-1)^2 + 2^2} = \sqrt{4 + 1 + 4}$.
- $= \sqrt{9} = 3$.
Answer: $OA = 3$ units.
Show that the points $A(0, 7, 10)$, $B(-1, 6, 6)$ and $C(-4, 9, 6)$ form a right-angled isosceles triangle.
Solution- $AB^2 = (-1-0)^2 + (6-7)^2 + (6-10)^2 = 1 + 1 + 16 = 18$.
- $BC^2 = (-4+1)^2 + (9-6)^2 + (6-6)^2 = 9 + 9 + 0 = 18$.
- $CA^2 = (0+4)^2 + (7-9)^2 + (10-6)^2 = 16 + 4 + 16 = 36$.
- $AB = BC$ ($= \sqrt{18}$), so the triangle is isosceles. Also $AB^2 + BC^2 = 18 + 18 = 36 = CA^2$, so it is right-angled at $B$.
Answer: $AB = BC = \sqrt{18}$ and $AB^2 + BC^2 = CA^2$, so $\triangle ABC$ is right-angled isosceles.
Find the value of $x$ so that the point $P(x, 2, 3)$ is at a distance $5$ from $Q(1, -1, 3)$.
Solution- $PQ^2 = (x-1)^2 + (2+1)^2 + (3-3)^2 = (x-1)^2 + 9$.
- Set $PQ = 5$, so $PQ^2 = 25$: $(x-1)^2 + 9 = 25$.
- $(x-1)^2 = 16 \Rightarrow x - 1 = \pm 4$.
- $x = 5$ or $x = -3$.
Answer: $x = 5$ or $x = -3$.
Show that the points $A(-2, 3, 5)$, $B(1, 2, 3)$ and $C(7, 0, -1)$ are collinear.
Solution- $AB = \sqrt{3^2 + (-1)^2 + (-2)^2} = \sqrt{9 + 1 + 4} = \sqrt{14}$.
- $BC = \sqrt{6^2 + (-2)^2 + (-4)^2} = \sqrt{36 + 4 + 16} = \sqrt{56} = 2\sqrt{14}$.
- $AC = \sqrt{9^2 + (-3)^2 + (-6)^2} = \sqrt{81 + 9 + 36} = \sqrt{126} = 3\sqrt{14}$.
- Since $AB + BC = \sqrt{14} + 2\sqrt{14} = 3\sqrt{14} = AC$, the points are collinear.
Answer: $AB + BC = AC$, so $A$, $B$, $C$ are collinear.
Find the point on the $y$-axis which is equidistant from $A(3, 1, 2)$ and $B(5, 5, 2)$.
Solution- A point on the $y$-axis has the form $P(0, y, 0)$.
- $PA^2 = 9 + (y-1)^2 + 4 = (y-1)^2 + 13$.
- $PB^2 = 25 + (y-5)^2 + 4 = (y-5)^2 + 29$.
- Set $PA^2 = PB^2$: $(y-1)^2 + 13 = (y-5)^2 + 29 \Rightarrow y^2 - 2y + 14 = y^2 - 10y + 54$.
- $8y = 40 \Rightarrow y = 5$.
Answer: The required point is $(0, 5, 0)$.