Checking a missing perpendicular difference in three dimensions
A distance between two points in space fixes the sum of three squared coordinate differences. With two differences known, subtract their squares and take a root to find the third.
The distance formula as an equation to solve
In three dimensions, the distance d between two points is the square root of dx² + dy² + dz², where each term is the difference in one coordinate. Usually you know all three differences and want d. Here the roles are reversed. You know d and two of the differences and want the third. Squaring the formula removes the root: d² = dx² + dy² + dz². Moving the known terms to the left leaves the unknown square on its own, and one more square root recovers its size. The step is ordinary algebra, but each part of it carries a condition worth checking.
Subtracting the known squares
The worked case has distance 13 and differences 3 and 4. Squaring gives 169 for the distance, 9 for dx and 16 for dy. The remaining square is 169 − 9 − 16 = 144. This is the square of the unknown difference, and it has to be zero or positive for a real answer, because a real number squared is never negative. The pattern 3, 4, 12, 13 is a Pythagorean quadruple, a set of whole numbers chosen so that no rounding enters. The same bookkeeping applies to any other triple, with decimals or large values, but the tidy numbers make each step easy to verify.
Taking the root
The square root calculator turns 144 into 12. By convention the principal root is the nonnegative one, so the result is a magnitude. It tells you how far apart the points are along the third axis, and it says nothing about direction. That distinction is the main subtlety of the whole method. Distance is always nonnegative and uses squared differences, so the information that tells a positive coordinate change from a negative one never reaches the formula. After the root, 12 is the size of the gap, and the sign remains open.
The sign ambiguity
Both +12 and −12 square to 144. Starting at the origin and ending at (3, 4, 12), or at (3, 4, −12), the 3D distance calculator returns 13 each time. The two end points are mirror images across the plane where z is zero, and they are equally far from the start. So the distance and two known differences narrow the third coordinate to two possible values. To pick one, you need extra information, such as which side of the plane the point lies on, or a measured direction. Reporting both candidates is correct when no such information exists. In a survey or a game scene, the missing sign usually comes from context, for example the target is known to be above the starting point, so the positive value applies. Without that context, writing the answer as plus or minus 12 is the honest statement of what the data support.
Distance 9 with differences 4 and 4
Take distance 9 and known differences 4 and 4. The remaining square is 81 − 16 − 16 = 49, and its root is 7. The points (0, 0, 0) and (4, 4, 7) are indeed 9 apart, since 16 + 16 + 49 = 81. Another case has distance 7 with differences 2 and 3: 49 − 4 − 9 = 36, so the third difference has magnitude 6, and the point (2, 3, 6) lies 7 from the origin. These triples, 4, 4, 7, 9 and 2, 3, 6, 7, are also whole-number examples, which makes them handy for checking your own worksheet. Not every case produces a tidy root. With distance 10 and differences 3 and 4, the remainder is 100 − 9 − 16 = 75, and the third difference is the square root of 75, about 8.660. The method is the same, only the final root is an irrational number that the calculator rounds for display.
When the numbers are inconsistent
If the distance is too small for the known differences, the subtraction goes negative. For distance 4 with differences 3 and 4, the remaining square is 16 − 9 − 16 = −9, and no real difference squares to a negative number. The data contradict each other, since the two known differences alone already span a distance of 5, larger than the 4 supplied. When the result lands on exactly zero, as with distance 5 and differences 3 and 4, the third difference is 0 and both points lie in the same plane. Negative remainders point to a measurement error or a swapped input.
Which differences to enter
The known differences can be in any order, because the formula adds their squares, and their signs do not matter for the same reason. What does matter is that all three differences use the same axes and units as the distance. Mixing meters for the distance with centimeters for a coordinate gives a remainder that is far off. If the points come as coordinates instead of differences, subtract them first, for example x2 − x1, and then proceed. Each difference is the later coordinate minus the earlier one, but swapping the order only flips a sign. For points (1, 2, 3) and (4, 6, z) at distance 13, the known differences are 3 and 4 again, so z − 3 has magnitude 12 and z is 15 or −9.
Uses of the recovered difference
Problems of this shape appear when a surveyor, a game developer or a student knows the straight-line gap between two points and two of their offsets. The recovered magnitude can then locate the remaining coordinate, subject to the sign ambiguity. Related problems, such as finding a missing leg of a right triangle, use the same idea in two dimensions, with two terms in place of three. The extra axis only adds one more square to the sum. The method gives a magnitude that satisfies the distance formula, and any further constraint on the real situation has to be added separately.
What the method assumes
The model is Euclidean distance in a Cartesian coordinate system with perpendicular axes of the same scale. It does not apply to distances measured along a curved surface, such as a path across the Earth, or to coordinates with unequal axis scaling. Rounded inputs give a rounded remainder, and when the distance is close to the combined size of the known differences, a small rounding error in d can change the remainder a lot. The calculators report what the supplied numbers imply and do not test the realism of the situation behind them.
Reproduce the checks
Magnitude of the third difference
Open the Square Root Calculator and enter:
- Value
144
Expected output:
result
12The principal root supplies a nonnegative magnitude.
Positive-direction control
Open the 3D Distance Calculator and enter:
- First x coordinate
0- First y coordinate
0- First z coordinate
0- Second x coordinate
3- Second y coordinate
4- Second z coordinate
12
Expected output:
distance
13The reconstructed differences reproduce the distance.
Negative-direction control
Open the 3D Distance Calculator and enter:
- First x coordinate
0- First y coordinate
0- First z coordinate
0- Second x coordinate
3- Second y coordinate
4- Second z coordinate
-12
Expected output:
distance
13The opposite third direction gives the same distance.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- MathWorld ↗ · 2026-10-08
- MathWorld ↗ · 2026-10-08