Find all values x, y and z which satisfy the equation $(x^2 + 1)(y^2 + 1) = z^2 + 1$ given that $(x^2 + 1)$ and $(y^2 + 1)$ are both primes.

Suppose without loss of generality $x \ge y$. Then $z^2+1 \le (x^2+1)^2$, so $z < x^2+1$.

Note that $x^2+1 \mid (z^2+1)-(x^2+1)=(z-x)(z+x)$.

Since $(x^2+1)$ is a prime number and

$$0 < z-x < z+x < x^2+x+1<2(x^2+1),$$

we must have $x+z = x^2+1$ and $z-x=1$, from which we obtain $x=2$, and then $z=3, y=1$.


Odd primes: We first take care of the case $x^2+1$, $y^2+1$ both odd primes. If $x^2+1$ and $y^2+1$ are odd, then $x$, $y$, and $z$ are even.

Factor in the Gaussian integers. We get $$(x-i)(x+i)(y-i)(y+i)=(z-i)(z+i).$$ Note that $x\pm i$ and $y\pm i$ are Gaussian primes. And since $z$ is even, the Gaussian integers $z-i$ and $z+i$ are relatively prime.

The Gaussian prime $x-i$ divides one of $z-i$ or $z+i$. The same remark applies to all the other Gaussian primes on the left. And we cannot have, for example, both $x-i$ and $x+i$ dividing $z-i$, else $x^2+1$ would, but it doesn't. Similarly, $y-i$ and $y+i$ cannot both divide $z-i$. Similar comments can be made about $z+i$.

It follows that $z-i$ is a unit times one of the products $(x-i)(y-i)$ or $(x-i)(y+i)$ or $(x+i)(y-i)$ or $(x+i)(y+i)$.

The arguments for all four cases are now essentially the same. Consider the first case, $(x-i)(y-i)$ equal to a unit times $z-i$. We have $(x-i)(y-i)=xy+1-i(x+y)$. Suppose that this is equal to a unit $\epsilon$ times $z-i$. Then $$xy+1-i(x+y)=\epsilon(z-i).$$ If $\epsilon=\pm 1$, we are in trouble because $xy+1$ is odd and $\epsilon z$ is even. If $\epsilon=\pm i$, then $xy+1=\pm 1$, which is impossible.

One prime even: This is the case $x=1$. We get the Gaussian factorization $(1-i)(1+i)(y-i)(y+i)=(z-i)(z+i)$. The same argument as the one above shows that $z-i$ is a unit times $(1-i)(y\pm i)$. Multiplying out $(1-i)(y\pm i)$, we reach the conclusion that $y=\pm 2$. For example, if $z-i$ is a unit times $(1-i)(y+i)$, it is a unit times $1+y+i(1-y)$. If the unit is $\pm 1$, we get $1-y=\mp 1$. And if the unit is $\pm i$, then $1+y=\mp 1$. .