Let a, b be two integers
Suppose n = a^2 + b^2
Then 2n = 2a^2 + 2b^2 = a^2 + 2ab + b^2 + a^2 - 2ab + b^2
= (a + b)^2 + (a - b)^2
which is the sum of the square of two integers a+b and a-b
Suppose 2n = a^2 + b^2
Either both a and b are odd or even
Suppose both a and b are odd, p and q are integers
2n = (2p + 1)^2 + (2q + 1)^2 = 4p^2 + 4p + 1 + 4q^2 + 4q + 1
⇒ n = 2p^2 + 2q^2 + 2p + 2q + 1
= (p^2 + q^2 + 1 + 2pq + 2p + 2q) + (p^2 - 2pq + q^2)
= (p + q + 1)^2 + (p - q)^2
Suppose both a and b are even
2n = (2p)^2 + (2q)^2
⇒ n = 2p^2 + 2q^2 = (p + q)^2 + (p - q)^2
So in either case, n can be expressed as the sum of integers