An identity which applies to all of the natural numbers Prove that any natural number n can be written as $$n=a^2+b^2-c^2$$ where $a,b,c$ are also natural.
 A: Consider $n\ge 6$.
If $n$ is odd, $n=2m+1$, then
$$
n = 2m+1 = 2^2 + (m-1)^2 - (m-2)^2;
$$
If $n$ is even, $n=2m$, then
$$
n = 2m = 1^2 + m^2 - (m-1)^2;
$$
Small $n$:
$1=1^2+1^2-1^2$,
$2=3^2+3^2-4^2$,
$3=4^2+6^2-7^2$,
$4=2^2+1^2-1^2$,
$5=4^2+5^2-6^2$.
A: If you consider the case $b=c+1$, you get $b^2-c^2=2c+1$, which can be any odd natural number $\ge3$.
Thus with $a=1$ you reach all even $n\ge4$ and with $a=2$ all odd $n\ge 7$.
This leaves only the cases $n\in\{1,2,3,5\}$ open. Can you find solutions for these $n$? (Hint: Try $b=c-1$).
A: First show the following lemma:

Lemma: Any odd postive integer can be written as the difference of two squares.

For a proof without word, consider the area of the gray part with $a=n$ and $b=n-1$:

So if $n$ is odd, set $b=0$ and apply the previous lemma; if $n$ is even, set $b=1$ and apply the previous lemma to $n-1$.
A: I like this approach to the solution of this equation.
If we consider the Diophantine equation: $qX^2+Y^2=Z^2+j$ 
If the root is a : $a=\sqrt{\frac{j}{q}}$ 
We use the solutions of Pell's equation: $p^2-(q+1)s^2=1$ 
Solutions can be written: 
$X=2s(s\pm{p})L\pm{ap^2}+2aps\pm{a(q+1)s^2}=bL+af$ 
$Y=(p^2\pm2ps+(1-q)s^2)L\pm{ap^2}+2aps\pm{a(q+1)s^2}=cL+af$  
$Z=(p^2\pm2ps+(q+1)s^2)L\pm{ap^2}+2a(q+1)ps\pm{a(q+1)s^2}=fL+at$ 
$L$ - any integer number given by us  
number: $b,c,f,t$ - are solutions of the following equations 
$qb^2+c^2=f^2$ 
$t^2-(q+1)f^2=\pm{q}$ 
If we take the solutions of Pell's equation:  $p^2-(q+1)s^2=k$ 
number $b,c$ - are solutions of the equation:  $qb^2+c^2=f^2$  
wherein: $c-b=k$ 
number $t,f$ - solutions of the equation: $t^2-(q+1)f^2=\pm{qk^2}$ 
These formulas allow us to find some solutions of Pell's equation using solutions of simpler equations. At least there will be another opportunity to find a solution to this equation. Later draw solutions with other factors.
All of numbers can be any character.In Equation:  $qX^2+Y^2=Z^2+a$  
If the ratio is factored so:  $a=(b-c)(b+c)$  
Then we use the solutions of Pell's equation: $p^2-fs^2=\pm1$ 
where:  $f=(q+1)k^2-2kt-(q-1)t^2$ 
Then the solutions are of the form: 
$X=2(ck-bt)ps+2(bk^2-(b+c)kt+ct^2)s^2$  
$Y=bp^2+2c(k-t)ps-(b(q-1)k^2+2(b-qc)kt+b(q-1)t^2)s^2$  
$Z=cp^2+2b(k-t)ps+(c(q+1)k^2-2(bq+c)kt+c(q+1)t^2)s^2$ 
All of numbers can be any character.
