Ma · Mathematics

How to Approximate a Hypotenuse Without a Square Root

Published By the 9to5Science editorial team

At a glance

  1. 1. Take absolute values

    Use the magnitudes of the two perpendicular side lengths or coordinate differences.

  2. 2. Order the inputs

    Let a be the larger magnitude and b the smaller one.

  3. 3. Apply an approximation

    Estimate the hypotenuse as a plus one third of b for a simple, fast calculation.

  4. 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 xx and yy. First take their absolute values, since a length cannot be negative. Define

a=max⁡(∣x∣,∣y∣),b=min⁡(∣x∣,∣y∣).a = \max(|x|,|y|), \qquad b = \min(|x|,|y|).

Then estimate the hypotenuse by

h≈a+b3.h \approx a + \frac{b}{3}.

This uses comparisons, an addition, and a division by 3. If multiplication by a constant is convenient, use a+0.333333333ba + 0.333333333b as a close decimal approximation instead. The exact answer is

h=x2+y2.h = \sqrt{x^2+y^2}.

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 a=12a=12, and the smaller is b=5b=5. The estimate is

12+53≈13.667.12 + \frac{5}{3} \approx 13.667.

The exact hypotenuse is

122+52=169=13.\sqrt{12^2+5^2}=\sqrt{169}=13.

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 a>0a>0 and write the smaller one as b=tab=ta, where 0≤t≤10\le t\le1. The ratio of the estimate to the exact length is then

a+b/3a2+b2=1+t/31+t2.\frac{a+b/3}{\sqrt{a^2+b^2}} =\frac{1+t/3}{\sqrt{1+t^2}}.

The scale aa cancels, so the relative error depends only on the ratio of the two legs. This ratio is 1 at t=0t=0 and 4/(32)≈0.94284/(3\sqrt{2})\approx0.9428 at t=1t=1. Its maximum occurs at t=1/3t=1/3, where the ratio is 10/9≈1.0541\sqrt{10/9}\approx1.0541. 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 1/31/3, 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 a+ba+b. 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 a+3b/8a+3b/8. 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 (x1,y1)(x_1,y_1) and (x2,y2)(x_2,y_2), apply the same approximation to ∣x2−x1∣|x_2-x_1| and ∣y2−y1∣|y_2-y_1|. 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.