# No solutions to the diophantine equation $x^2 + 2y^2 = 8z + 5.$

Working independently on some practice problems in preparation for my class exam and got stuck on the following question:

Show there are no solutions in integers $$x$$, $$y$$, and $$z$$ to the diophantine equation $$x^2 + 2y^2 = 8z + 5.$$

I know that we have to prove it using modular arithmetic but I'm not sure how to go about solving this problem. Could anyone help? Thanks!

If you look at the equation mod $$8$$, note that squares are either $$0,1$$ or $$4$$ mod 8. Thus the left hand side can only attain the values $$0,1,2,3,4$$ or $$6$$ mod $$8$$ and hence will never be equal to the right hand side, which is $$5$$ mod $$8$$.
• $x^2+2y^2$ can't be $6\bmod 8$. May 29, 2019 at 22:19
• @Bernard $2^2+2 \times 1^2 = 6$ May 29, 2019 at 22:25
If you have $$x^2+2y^2=8z+5$$, by looking $$\bmod 2$$, you have that $$x$$ has to be odd.
Now (a very useful fact for me) we have that $$odd^2\equiv 1\mod 8$$. In particular $$x^2\equiv 1\mod 8$$.
So, if you look your original equation $$\bmod 8$$ you get $$1+2y^2=5\bmod 8$$ This implies that $$2y^2\equiv 4\mod 8$$ and by dividing by $$2$$, you get $$y^2\equiv 2\mod 4$$. The last thing is imposible, so there are no solutions.