TOPICS
Search

Pythagorean Addition


Pythagorean addition combines two real numbers x and y to give sqrt(x^2+y^2), the Euclidean norm of (x,y). The operation is used when computing vector norms, the Frobenius norm, and Givens rotations.

Directly squaring the inputs in floating-point arithmetic can cause overflow or underflow even when the final norm is representable. For finite inputs, set a=max(|x|,|y|) and b=min(|x|,|y|). If a=0, the result is zero. Otherwise, evaluate

 asqrt(1+(b/a)^2).

Since b/a<=1, the intermediate square cannot overflow. Moler and Morrison (1983) and Dubrulle (1983) describe iterative alternatives.


See also

Euclidean Norm, Floating-Point Arithmetic, Frobenius Norm, Givens Rotation

Explore with Wolfram|Alpha

References

Borges, C. F. "Algorithm 1014: An Improved Algorithm for hypot(x,y)." ACM Trans. Math. Softw. 47, Art. 9, 2021. https://doi.org/10.1145/3428446.Dubrulle, A. A. "A Class of Numerical Methods for the Computation of Pythagorean Sums." IBM J. Res. Develop. 27, 582-589, 1983. https://doi.org/10.1147/rd.276.0582.Moler, C. and Morrison, D. "Replacing Square Roots by Pythagorean Sums." IBM J. Res. Develop. 27, 577-581, 1983. https://doi.org/10.1147/rd.276.0577.

Cite this as:

Weisstein, Eric W. "Pythagorean Addition." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/PythagoreanAddition.html

Subject classifications