Proving that every positive integer is of the form $x^2+y^2-5z^2$

diophantine equationsnumber theory

Prove that every positive integer can be written as
$$x^2+y^2-5z^2$$
with $x$, $y$ and $z$ are non-zero integers.

I made the following observations

  • if a number is congruent to 0,1,2 mod 4 than it can easily be expressed in this by taking z to be zero , as for the case when z is non zero I am not sure.

  • if the number is congruent to 3 mod 4 than (x,y )have to even and z has to be odd all other cases dont work, the opposite is true if the number is congruent 2 mod 4

  • to generalize for all types of integers mod 4 the parity of the numbers(x,y,z) that will satisfy are given below(I will denote even as 0 and odd as 1) and (x,y) can obviously be interchanged, therefore

-if 0 mod 4 then (0,0,0) and (0,1,1)
-if 1 mod 4 then (0,1,0) and (1,1,1)
-if 2 mod 4 then (1,1,0)
-if 3 mod 4 then (0,0,1)

so I tried to write a number congruent to 3 mod 4 as follows
$$x^2+y^2-5z^2$$=
$$(2a)^2+(2b)^2-5(2c+1)^2$$
$$4(a^2+b^2-5c^2-5c-1)^2-1$$

Best Answer

$$2=1^2+9^2-5\cdot4^2$$ $$4=20^2+3^2-5\cdot9^2$$ If $n \ge 3$ then $$2n=(n-2)^2+(2n-1)^2-5(n-1)^2$$ $$1=10^2+9^2-5\cdot6^2$$ If $n \ge 2$ then $$2n-1=n^2+(2n-2)^2-5(n-1)^2$$