Finding number of integral solutions to an equation. 
Find the number of integral solutions to:

$$x^2+y^2-6x-8y=0.$$
My attempt: 
The equation can be rewritten as:
$$x^2+y^2-6x-8y+9+16=25,$$
basically adding 25 to both sides, or equivalently, 
$$(x-3)^2+(y-4)^2=25.$$
This is a Pythagorean triplet. The only triplet of this form would be $3$, $4$, $5$, so the possibilities for $x - 3$ and $y - 4$ are: 
1.) $3$, $4$
2.) $-3$, $-4$
3.) $-3$, $4$
4.) $3$, $-4$
For each of these pairs, there are two different pairs $(x,y)$. For instance, in the first pair we could have $x - 3 = 3$ and $y - 4 = 4$, or $x - 3 = 4$ and $y - 4 = 3$. So there are $8$ solutions.
But, shouldn't we also consider the pair $(0,5)$? Because
$$0^2+5^2=25.$$
Then we have two new pairs:
1.) $0$, $5$
2.) $0$, $-5$
This would give $4$ new solutions, so the total number of solutions should be $8+4=12$.
How is the answer just $8$ then? What am I missing?
 A: You are correct; there are solutions corresponding to $0^2+(\pm5)^2=25$, and there are $12$ integral solutions in total. Another way to see this, is to note that
$$(x-3)^2+(y-4)^2=25,$$
forces $|y-4|\leq5$, leaving $11$ possible values for $y$ and yielding $6$ different quadratics in $x$. A quick check then shows that only $4$ of them yield integral solutions for $x$.
A: There are $12$ different solutions. The square $25$ can be expressed as the sum:
$$5^2+0^2=4^2+3^2=3^2+4^2=0^2+5^2=25$$
So, the possibilities are:
$$\left\{\begin{matrix}
x-3=\pm4 \rightarrow x=7 \vee x=-1
\\ y-4=\pm3 \rightarrow y=7 \vee y=1
\end{matrix}\right.
\vee
\left\{\begin{matrix}
x-3=\pm3 \rightarrow x=6 \vee x=0
\\ y-4=\pm4 \rightarrow y=8 \vee y=0
\end{matrix}\right.
\vee
\left\{\begin{matrix}
x-3=0 \rightarrow x=3
\\ y-4=\pm5 \rightarrow y=9 \vee y=-1
\end{matrix}\right.
\vee
\left\{\begin{matrix}
x-3=\pm5 \rightarrow x=8 \vee x=-2
\\ y-4=0 \rightarrow y=4
\end{matrix}\right.$$
Doing this process for all values of $x,y$, we have $12$ different solutions:
$$(7,7) \vee (-1,1) \vee (3,9) \vee (3,-1) \vee (6,8) \vee (0,0) \vee (8,0) \vee (-2,4) \vee (7,1) \vee (6,0) \vee (-1,7) \vee (8,4)$$
A: In the non-negatives,
$$n^2+m^2=25$$ is indeed solved by
$$(0,5),(3,4),(4,3),(5,0),$$ as you can check by exhaustive search on $n$.
Then the signed solutions are
$$(0,\pm5),(\pm3,\pm4),(\pm4,\pm3),(\pm5,0).$$
There are $2+2^2+2^2+2$ of them, that you shift by $(3,4)$ to get $(x,y)$.

You can even minimize the "effort" by noticing that $n$ and $m$ play symmetric roles, and you can solve for $n\le m$ only, giving
$$(0,5),(3,4).$$
Then by playing with the signs and swapping, you get $2\cdot2+2\cdot2^2$ distinct solutions.

