More practice on Diophantine problems Continuing with my studies in the Diophantine equations chapter, trying to get used to solving a given equation has no integral solutions.


*

*Problem 1) How can I show that $x^2+y^2=9z+3$ has no integral solutions?

*Problem 2) How can I show that $x^2+2y^2=8z+5$ has no integral solutions? 
A clear proof would really help me follow and understand the steps required to do these kind of proofs, as I am still not entirely familiar in writing a proper proof  to these problems quite yet. 
 A: Hint: the first, $x$ and $y$ must be divisible by $3$ (you can verify that the case $x=1$ mod $3$ or $2$ mod $3$ is impossible, same with $y=1$ mod $3$ or $2$ mod $3$), this implies that $x^2+y^2$ is divisible by $9$, but $9z+3$ is not divisible by $9$.
A: For Problem 1, consider the residue of $x^2+y^2$ in mod 9. The RHS should say that the residue is 3. However, since the residue of square numbers in mod 9 is either 0, 1, 4, 7, the residue of sum of square numbers in mod 9 is either 0, 1, 2, 4, 6, 7, 8, which is a contradiction, thus no integer solution to the equation.
Problem 2 can be treated as equally as Problem 1.
A: For the problem 1 note the fact that all squares are either of the form $3k$ or $3k+1$ ( this can be easily seen by classifying integers modulo 3 classes($ 3k, 3k+1, 3k+2$ and squaring them)
Using this idea observe that R.H.S is of form$9z+3=3(3z+1)= 3k$ for some integer k.This would imply both the terms (squares ) on the L.H.S is a multiple of $3$ so this would imply the integers being squares themselves are multiple of $3$ this would imply L.H.S is divisible by $9$ but R.H.S leaves remainder $1$ when divided by 9 which is absurd hence by contradiction this equation has no solutions. 
For problem 2 after such a detailed explanation of problem 1  I will only give a hint: analyze things modulo 4 the integers themselves can take forms$4k, 4k+1,4k+2,4k+3$ but their squares take only the forms    $4k,4k+1$
You will get a contradiction by similar line of reasoning.
This is my first answer on the forum so please feel free to give any suggestions.
A: The quadratic residues mod $9$ are $\{1,4,0,7,7,0,4,1\}$.  This means that $x^2+y^2$ is always going to be congruent to possible combinations of these numbers: $$\{0,1,2,4,5,7,8\}$$
Now if we put this into the context of the question, $x^2+y^2-3$ will always be congruent to $\{6,7,8,1,2,4,5\}$.  It will never be congruent to $0 \ \text{mod} \ 9$, so there are no integral solutions.
For the second question, modulo $8$, a square number will always be congruent to $\{0,1,4\}$.  Thus $x^2+2y^2$ will always be congruent to $\{0,1,2,3,4\}$.  $x^2+2y^2-5$ will be congruent to $\{3,4,5,6,7\}$ mod $8$.  We recognize that this will never be congruent to zero mod $8$, so it cannot be divisible.
A: Here is a proof for the second question, since other answers address the first one fairly well. I will write it out without using any higher-level machinery (e.g., modular arithmetic) although that mode of thought certainly undergirds the approach below. I will also omit some details, for which I include a parenthetical, and rhetorical, "why?" throughout:

Prove there are no $x, y, z \in \mathbb{Z}$ for which $x^2+2y^2=8z+5$.

Let us suppose a solution exists, and wend our way towards a contradiction, which will show that our supposition was incorrect, and no such solution can exist. So, supposing there were a solution, we observe that the right side of the equation is odd (why?) so the left side of the equation must be odd, too. In particular, $x$ must be odd (why?) so we can write $x = 2n+1$ for some $n \in \mathbb{Z}$.
We now have: $(2n+1)^2 + 2y^2 = 8z + 5$, i.e., $4n^2 + 4n + 1 + 2y^2 = 8z + 5$. Subtracting $1$ from both sides and factoring out a $4$ yields the equation: $4n(n+1) + 2y^2 = 4(2z+1)$. From here, we divide both sides by $2$ to derive the equation 
$$2n(n+1) + y^2 = 2(2z+1)$$
and note that the right hand side is even, which means $y$ must be even (why?) so we can write $y = 2m$ for some $m \in \mathbb{Z}$. This yields $2n(n+1) + 4m^2 = 2(2z+1)$, which we re-divide by $2$:
$$n(n+1) + 2m^2 = 2z+1$$
which, at last, is our contradiction: The two expressions directly above cannot be equal, for the left hand side is an even number (why?) and the right hand side is an odd number (why?). Since our assumption of a solution existing led to a contradiction, we were wrong in our supposition, and, thus, we conclude that no solution exists. QED.

As a final note: This proof involved dividing by $2$ twice, i.e., dividing by $4$. So, if you are comfortable using modular arithmetic in proofs, then it may make sense - as is suggested elsewhere - to (re)consider this entire problem from a "mod $4$" perspective.
