<s>[INST] 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?
 [/INST] 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$.
</s>