How to Approximate a Hypotenuse Without a Square Root
At a glance
- 1. Take absolute values
Use the magnitudes of the two perpendicular side lengths or coordinate differences.
- 2. Order the inputs
Let a be the larger magnitude and b the smaller one.
- 3. Apply an approximation
Estimate the hypotenuse as a plus one third of b for a simple, fast calculation.
- 4. Check the needed accuracy
The one-third formula has a worst-case relative error of about 5.72 percent.
If you need a hypotenuse estimate but want to avoid a square root, a useful approximation is to add the larger leg to one third of the smaller leg. It is simple to calculate and works for any pair of perpendicular side lengths, though it is not exact.
The exact Euclidean length is still given by the Pythagorean theorem. The approximation is appropriate when a small, known error is acceptable—for example, in a rough geometric calculation or a performance-sensitive routine. For precise distances, use the exact formula or a standard hypot function.
A quick formula
Let the side lengths be and . First take their absolute values, since a length cannot be negative. Define
Then estimate the hypotenuse by
This uses comparisons, an addition, and a division by 3. If multiplication by a constant is convenient, use as a close decimal approximation instead. The exact answer is
The approximation is exact when the smaller side is zero. For other side ratios, it has a maximum relative error of about 5.72%. That error bound applies whether the estimate is too high or too low.
Worked example
Suppose the perpendicular legs are 12 and 5. The larger value is , and the smaller is . The estimate is
The exact hypotenuse is
So the approximation is about 0.667 units too large, or roughly 5.13% above the exact value. That is within the worst-case error bound.
Why the error stays limited
Because the formula is symmetric in the legs, assume the larger leg is and write the smaller one as , where . The ratio of the estimate to the exact length is then
The scale cancels, so the relative error depends only on the ratio of the two legs. This ratio is 1 at and at . Its maximum occurs at , where the ratio is . Thus the largest relative shortfall is about 5.72%, and the largest relative excess is about 5.41%; the overall worst case is about 5.72%.
If you want to tune the coefficient rather than use the easy fraction , a coefficient near 0.336 gives a slightly more balanced worst-case relative error of about 5.53%. The improvement is modest, so one third is often easier to remember and implement.
Choosing an approximation
For a still simpler calculation, use . This is always an overestimate, and its worst-case relative error is about 41.4%, when the legs are equal. It is useful as a rough upper bound, not as a close estimate.
A common shift-friendly alternative is . Its worst-case relative error is about 6.80%, slightly worse than the one-third formula. The best choice depends on which operations are convenient on your platform; modern processors often calculate square roots efficiently, so an approximation is not automatically faster in real software.
Common mistakes
- Using the formula on non-perpendicular segments: The Pythagorean formula applies to perpendicular components. For arbitrary coordinate differences in 2D, those differences are perpendicular coordinate components, so the formula applies; for other geometries, check the angle or use the appropriate distance formula.
- Forgetting absolute values: If inputs can be signed, use their magnitudes before deciding which is larger.
- Treating the estimate as exact: The one-third rule can be off by nearly 6%. Do not use it where that difference affects a safety margin, a proof, or a required precision.
- Ignoring numerical range: In software, intermediate arithmetic can overflow or underflow. A standard
hypot(x, y)routine is usually safer when you need an accurate Euclidean length.
For coordinate points and , apply the same approximation to and . It estimates the straight-line distance between the points without explicitly evaluating a square root.
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.