Prove that $R$ is reflexive, symmetric, and transitive.
I agree with J. W. Tanner's question comment that what you've done looks all right.
I have just one small suggestion. With your $x^2−y^2=4a$ and $y^2−z^2=4b$ equations, you don't need to do any rearranging. Instead, you can just add these $2$ equations, as the $y^2$ terms cancel, to more directly get your result of $x^2−z^2=4a+4b=4(a+b)$. This will make your proof a bit shorter & more succinct.
Your solution is ok. I’d just like to point out that your problem is in fact just a specific case of a much more general phenomenon:
Let $A$, $B$ be sets, $f:A\to B$ a function, and $R\subseteq B\times B$ an equivalence relation. Define a relation $S\subseteq A\times A$ such that $$(x,y)\in S\Leftrightarrow (f(x),f(y))\in R.$$ Then, $S$ is also an equivalence relation.
This is straightforward to prove:
- $S$ is reflexive since $f(x)Rf(x)$ implies $xSx$.
- $S$ is symmetric since, if $xSy$, then $f(x)Rf(y)$, $f(y)Rf(x)$, and $ySx$.
- $S$ is transitive since, if $xSy$ and $ySz$, then $f(x)Rf(y)$ and $f(y)Rf(z)$, so that $f(x)Rf(z)$ and $xSz$.
Your result is now immediate: take $A=B=\mathbb Z$, $R$ to be equivalence $\text{mod }4$, and $f(x)=x^2$ to be the squaring function.