<s>[INST] Solution of Diophantine equation Find all integral solutions of $x^2+1= y^2+z^2$. Actually I have to find all integral solution of $a(a+1)=b(b+1)+c(c+1)$. I reduced this in the above form I.e., $  (2a+1)^2+1= (2b+1)^2+(2c+1)^2$ .
 [/INST] The case where $z^2-x^2=1-y^2=0$ is self-evident.We have $z=\pm x$ and $y=\pm 1$
Now consider the case where $(1-y^2)(z^2-x^2)\neq 0$
$$z^2-x^2=1-y^2$$
$$(z+x)(z-x)=(1+y)(1-y)$$
$$\dfrac{z+x}{1+y}=\dfrac{1-y}{z-x}
=\dfrac{p}{q}$$ with $pq\neq 0$ and $\gcd(p,q)=1$.
It follows:
$$z+x=\dfrac{p}{q}(1+y)$$
$$z-x=\dfrac{q}{p}{(1-y)}$$
Hence, in order to find all the integral solutions, the following restrictions must apply 
$$1-y\equiv 0\pmod p$$
$$1+y\equiv 0\pmod q$$ 
In other words,by alternatively subtracting 1 from 2/ adding 1 and 2   $$qs-pr=2y$$
$$qs+pr=2$$  where $r,s$ are 2 coprime integers.
Since
$$z+x=ps$$
$$z-x=qr$$
we have:
$$z=\dfrac{1}{2}(ps+qr)$$ $$x=\dfrac{1}{2}(ps-qr)$$ $$y=\dfrac{1}{2}(qs-pr)$$where $pr,qs$ have the same parity and $qs+pr=2$.
</s>