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 — placed under the root. Because every term is squared, it does not matter which point you call "first": $(x_2 - x_1)^2 = (x_1 - x_2)^2$, so $PQ = QP$. Compare the two settings side by side.
Distance from the origin. Putting $P = O(0, 0, 0)$ gives a handy special case — here $\sqrt{x^2 + y^2 + z^2}$ is also the length of the space diagonal of the box with edges $|x|, |y|, |z|$.
$$OQ = \sqrt{x_2^{\,2} + y_2^{\,2} + z_2^{\,2}}$$
Testing collinearity. Because distance is unambiguous, three points $A$, $B$, $C$ are collinear exactly when the largest of the three pairwise distances equals the sum of the other two — for instance $AB + BC = AC$. If instead $AB + BC > AC$ for every arrangement, the three points form a genuine triangle.
Classifying a triangle by its sides. Once you have the three side-lengths, the type of triangle reads straight off them: isosceles if two sides are equal, equilateral if all three are equal, scalene if all differ, and right-angled when the three lengths satisfy $a^2 + b^2 = c^2$ (the longest side being the hypotenuse $c$).
A common application is finding a point with a stated distance property — for example a point on an axis equidistant from two given points. Put the unknown point in its general axis form (such as $(0, y, 0)$ on the $y$-axis), set the two squared distances equal, and the square terms cancel to leave a simple linear equation.
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. Imagine the box 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 contributes its own squared difference, and it generalises to any number of dimensions. The practical payoff is large: shape questions that are 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)$.
Show that the points $A(1, 2, 3)$, $B(2, 3, 4)$ and $C(0, 1, 2)$ are collinear, and state which point lies between the other two.
Solution- $AB = \sqrt{1^2 + 1^2 + 1^2} = \sqrt{3}$.
- $BC = \sqrt{(-2)^2 + (-2)^2 + (-2)^2} = \sqrt{12} = 2\sqrt{3}$.
- $AC = \sqrt{(-1)^2 + (-1)^2 + (-1)^2} = \sqrt{3}$.
- $AC + AB = \sqrt{3} + \sqrt{3} = 2\sqrt{3} = BC$, so the points are collinear and $A$ lies between $B$ and $C$.
Answer: Collinear, since $BC = AB + AC = 2\sqrt{3}$; the point $A$ lies between $B$ and $C$.
Find the point on the $z$-axis equidistant from $A(1, 5, 7)$ and $B(5, 1, -4)$.
Solution- A point on the $z$-axis has the form $P(0, 0, z)$.
- $PA^2 = 1 + 25 + (z-7)^2 = (z-7)^2 + 26$.
- $PB^2 = 25 + 1 + (z+4)^2 = (z+4)^2 + 26$.
- Set equal: $(z-7)^2 = (z+4)^2 \Rightarrow -14z + 49 = 8z + 16$.
- $22z = 33 \Rightarrow z = \dfrac{3}{2}$.
Answer: The required point is $\left(0, 0, \dfrac{3}{2}\right)$.
Show that the points $A(3, 3, 3)$, $B(0, 6, 3)$, $C(1, 7, 7)$ and $D(4, 4, 7)$ are the vertices of a parallelogram.
Solution- $AB = \sqrt{(-3)^2 + 3^2 + 0^2} = \sqrt{18}$ and $CD = \sqrt{3^2 + (-3)^2 + 0^2} = \sqrt{18}$.
- $BC = \sqrt{1^2 + 1^2 + 4^2} = \sqrt{18}$ and $DA = \sqrt{(-1)^2 + (-1)^2 + (-4)^2} = \sqrt{18}$.
- Opposite sides are equal: $AB = CD$ and $BC = DA$.
- Diagonals: $AC = \sqrt{(-2)^2 + 4^2 + 4^2} = \sqrt{36} = 6$ and $BD = \sqrt{4^2 + (-2)^2 + 4^2} = \sqrt{36} = 6$. Equal diagonals show it is in fact a rectangle (all four sides are also equal here, so a square).
Answer: Opposite sides are equal ($AB = CD$, $BC = DA = \sqrt{18}$), so $ABCD$ is a parallelogram (here even a square, since all sides equal and diagonals equal).
Find the locus (equation) of a point $P(x, y, z)$ that is equidistant from $A(1, 2, 3)$ and $B(3, 2, -1)$.
Solution- Equidistant means $PA^2 = PB^2$.
- $(x-1)^2 + (y-2)^2 + (z-3)^2 = (x-3)^2 + (y-2)^2 + (z+1)^2$.
- Expand and cancel $x^2, y^2, z^2$ and the $(y-2)^2$ terms: $-2x + 1 - 6z + 9 = -6x + 9 + 2z + 1$.
- $-2x - 6z + 10 = -6x + 2z + 10 \Rightarrow 4x - 8z = 0 \Rightarrow x = 2z$.
Answer: The locus is the plane $x - 2z = 0$ (the perpendicular bisector plane of $AB$).
Find the distance between $A(a, b, c)$ and $B(-a, -b, -c)$, and hence the distance of $(2, -3, 6)$ from its reflection in the origin.
Solution- $AB = \sqrt{(2a)^2 + (2b)^2 + (2c)^2} = 2\sqrt{a^2 + b^2 + c^2}$.
- For $(2, -3, 6)$: $a^2 + b^2 + c^2 = 4 + 9 + 36 = 49$.
- So the distance $= 2\sqrt{49} = 2 \times 7 = 14$.
Answer: $AB = 2\sqrt{a^2 + b^2 + c^2}$; for $(2, -3, 6)$ the distance is $14$ units.