TITLE: Prove: $2^k$ is the sum of two perfect squares
QUESTION [4 upvotes]: If $k$ is a nonnegative integer, prove that $2^k$ can be represented as a sum of two perfect squares in exactly one way. (For example, the unique representation of $10$ is $3^2+1^2$; we do not count $1^2+3^2$ as different.)
I understand that $2^{2n}=0+2^{2n}$ and $2^{2n+1}=2^{2n}+2^{2n}$. But how can we prove that $2^k$ can be represented as two perfect squares in exactly one way?

REPLY [2 votes]: I do not see anyone mentioning this simple aspect: if we have integers $u,v$ such that $$ u^2 + v^2 \equiv 0 \pmod 4, $$
then both $u,v$ must be even.
Which means this: take a number that is divisible by $4.$ Suppose we have
$$ x^2 + y^2 = n $$
Keep dividing $n$ by $4$ until the result, $n_0,$ is no longer divisible by $4.$   We have
$$   x^2 + y^2 = 4^k n_0,  $$ where $x = 2^k x_0$ and $y = 2^k y_0.$ 
$$ x_0^2 + y_0^2 = n_0. $$
For you, either $n_0 = 1,$ written only as $1^2 + 0^2 = 1,$ or $n_0 = 2,$ written only as $1^2 + 1^2 = 2.$
{"set_name": "stack_exchange", "score": 4, "question_id": 1713733}