<s>[INST] Writing $\frac{(\sqrt{2}+1)^{2n+1}+(\sqrt{2}-1)^{2n+1}}{2\sqrt{2}}, n\geq2$ as sum of two perfect squares I tried to show that
$$
{\left(\sqrt{2\,} + 1\right)^{2n+1} + \left(\sqrt{2\,} - 1\right)^{2n+1}
 \over
2\,\sqrt{2\,}}\,,\qquad n\geq2
$$
is written as the sum of two perfect squares. We used Newton's binomial formula and we did. Is there another way ?. Thanks you !.
 [/INST] Let us look at a quadratic whose roots are
$$(\sqrt2 + 1)^2 \text{ and }(\sqrt2 - 1)^2$$
i.e.,
$$3+2\sqrt2 \text{ and }3 - 2\sqrt2$$
The quadratic is $x^2-6x+1$. Now let us look at the recurrence
$$a_{n+1} = 6a_n - a_{n-1}$$
where $a_0 = 1$ and $a_1 = 5$. This gives the sequence you are after. Now note that
$$a_0 = 0^2 + 1^2$$
$$a_1 = 1^2 + 2^2$$
$$a_2 = 2^2 + 5^2$$
$$a_3 = 5^2 + 12^2$$
$$a_4 = 12^2 + 29^2$$
Hence, it looks like if $a_{n-1} = x^2 + y^2$, then $a_n = y^2 + (2y+x)^2$. Prove this is the case using the recurrence and induction. The identity
$$(2(2y+x) + y)^2 + (2y+x)^2 = 6(y^2 + (2y+x)^2) - (x^2+y^2)$$ will be helpful in the process.
</s>