Let $x$, $y$ and $z$ be natural numbers satisfying $x^2 + y^2 + 1 = xyz$. Prove that $z = 3$. 
Let $x$, $y$ and $z$ be natural numbers satisfying $x^2 + y^2 + 1 = xyz$. Prove that $z = 3$.

I have managed to show that $z$ is a multiple of $3$ by looking at it modulo $3$ but not sure how to show $z=3$. Any tips?

One could go about this in the following way: If $x = y$, then the equation becomes
\begin{align*}
2x^2 + 1 &= x^2 z
\end{align*}
where the left-hand side is congruent to $1$ (mod $x$) and the right-hand side is congruent to $0$. It follows immediately that $x = 1$, and consequently that $z = 3$.
Now, suppose that $y > x$ (with no loss of generality). Then we can write $y = x+k$ for some $k \in \mathbb{Z}_+$. Substituting this into the equation, we see that
\begin{align*}
x^2 + x^2 + 2kx + k^2 &= x(x+k)z \\
&\equiv 0
\end{align*}
(mod $x$). Consequently,
\begin{align*}
x \mid k^2 = (y-x)^2 = y^2 - 2yx + x^2 \equiv y^2
\end{align*}
(mod $x$).
Thus there is some natural $b$ so that $y^2 = bx$. Using this, we find that
\begin{align*}
x^2 + bx + 1 = xyz.
\end{align*}
The right-hand side $xyz$ is divisible by $x$, but also $xyz - 1$ is divisible by $x$, since this is equal to $x^2 + bx$. Thus we must have $x = 1$. Now the original equation becomes
\begin{align*}
y^2 + 2 &= yz\\
&\Updownarrow \\
y^2 - yz + 2 &= 0.
\end{align*}
This quadratic equation in $y$ must have a square discriminant since $y$ is assumed to be a natural number. Hence
\begin{align*}
D &= (-z)^2 - 4\cdot 1 \cdot 2 \\
&= z^2 - 8
\end{align*}
is a square. This is only achieved for $z = 3$: 
\begin{align*}
z^2 - 8 &= r^2 \\
&\Updownarrow \\
(z-r)(z+r) &= 8 \\
&\Downarrow \\
z-r &\in \lbrace 1, 2\rbrace, \\
z+r &\in \lbrace 4, 8 \rbrace.
\end{align*}
The only possibility here is that $z = 3$ and $r = 1$.
Thus, in any case, $z = 3$.
