In number theory, the **sum of two squares theorem** says when an integer n > 1 can be written as a sum of two squares, that is, when n = a^{2} + b^{2} for some integers a, b.

*An integer greater than one can be written as a sum of two squares if and only if its prime decomposition contains no prime congruent to 3 (mod 4) raised to an odd power.*
This theorem supplements Fermat's two-square theorem which says when a prime number can be written as a sum of two squares, in that it also covers the case for composite numbers.

The prime decomposition of the number 2450 is given by 2450 = 2 • 5^{2} • 7^{2}. Of the primes occurring in this decomposition, 2, 5, and 7, only 7 is congruent to 3 modulo 4. Its exponent in the decomposition, 2, is even. Therefore, the theorem states, it is expressible as the sum of two squares. Indeed, 2450 = 7^{2} + 49^{2}.

The prime decomposition of the number 3430 is 2 • 5 • 7^{3}. This time, the exponent of 7 in the decomposition is 3, an odd number. So 3430 cannot be written as the sum of two squares.