Prove: $2^k$ is the sum of two perfect squares 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?

Suppose
$2^{2n+1}$
is the smallest odd power of two
that can represented in
more than one way
as the sum of two squares.
Then
$2^{2n+1}
=(2^{n}+a)^2+(2^{n}-b)^2
$
where
$1 \le a < 2^n$
and
$1 \le b < 2^n$.
Then
$\begin{array}\\
2^{2n+1}
&=(2^{n}+a)^2+(2^{n}-b)^2
\qquad(0)\\
&=2^{2n}+a2^{n+1}+a^2+2^{2n}-b2^{n+1}+b^2\\
\text{or}\\
(b-a)2^{n+1}
&=a^2+b^2
\qquad(1)\\
\text{or}\\
b(2^{n+1}-b)
&=a(2^{n+1}+a)
\qquad(2)\\
\end{array}
$
From $(0)$,
$a$ and $b$ must be even,
otherwise the right side
is $\equiv 2 \bmod 4$.
Suppose
$2^k || a$,
so that
$2^k | a$
and
$2^{k+1}\not\mid a$.
Then
$2^{2k}||a(2^{n+1}+a)
$
so
$2^{2k}||b(2^{n+1}-b)
$.
If $2^j || b$,
reasoning as for $a$,
$2^{2j} ||b(2^{n+1}-b)
$.
Therefore
$j=k$,
so that
$a=2^kc$
and
$b = 2^kd$
where $c$ and $d$ are odd.
Substituting in $(2)$,
$2^kd(2^{n+1}-2^kd)
=2^kc(2^{n+1}+2^kc)
$
or
$d(2^{n+1-k}-d)
=c(2^{n+1-k}+c)
$
or
$0
=2c2^{n-k}+c^2-2d2^{n-k}+d^2
$
or
$\begin{array}\\
2^{2(n-k)+1}
&=2^{2(n-k)}+2c2^{n-k}+c^2+2^{2(n-k)}-2d2^{n-k}+d^2\\
&=(2^{(n-k)}+c)^2+(2^{(n-k)}-d)^2\\
\end{array}
$
Therefore,
a smaller odd power of $2$
can be represented
in more than one way
as the sum of two squares.
But this contradicts $2^{2n+1}$
being the smallest such odd power.
Therefore
$2^{2n+1}$
can only be represented
in one way
as the sum of two squares.
This feels good!
This is the first time
I have independently constructed
a proof by infinite descent.
Maybe I'll try
even powers,
but this is enough for now.
