$x^2-y^2=n$ has solution in $\Bbb Z$ IFF : $n \not \equiv 2 \pmod 4$ suppose $n\in \Bbb Z $   then how to prove this statement:
$x^2-y^2=n$ has  solution in $\Bbb Z$ IFF :    $n \not \equiv 2 \pmod 4$

Observe that $x+y=x-y+2y$ 
So, $x+y,x-y$ have the parity
If they are odd, $n=x^2-y^2$ will be odd
If they are even, $n=x^2-y^2$ will be divisible by $4$
Conversely, if $n$ is odd $=2m+1$(say)
$(x+y)(x-y)=2m+1$ where $m$ is any integer 
So, we can write $x+y=2m+1,x-y=1\implies x=m+1,y=m$
or $x+y=-(2m+1),x-y=-1\implies x=-(m+1),y=-m$
If $4\mid n,n=4r$(say)
So, we can write $x+y=2r,x-y=2\implies x=r+1,y=r-1$
or $x+y=-2r,x-y=-2\implies x=-(r+1),y=-(r-1)$
