Probability that $5$ divides $a^2+b^2$ is $\frac9{25}$ 
Two positive integers $a$ and $b$ are randomly selected with replacement, then prove that the probability of $(a^2 +b^2)/5$ being positive integer is $9/25$.

I found out the pattern of the last digits of $a^2$ , $b^2$  but then the sample space isn't finite so I dropped idea of thinking of finding the a's and b's such that their square's last digit is either 0 or 5. Please help.
 A: The idea of this question is that $a$ has $20\%$ chances of being each of $0$ or $1$ or $2$ or $3$ or $4$ modulo $5$, hence $a^2$ has $20\%$ chances of being $0$, $40\%$ to be $1$ and $40\%$ to be $4$ modulo $5$. The same holds for $b^2$ hence, assuming that $a$ and $b$ are independent, $a^2+b^2$ is $0$ modulo $5$ when $(a^2,b^2)$ is $(0,0)$ or $(1,4)$ or $(4,1)$ modulo $5$, that is, with probability 
$$20\%\times20\%+40\%\times40\%+40\%\times40\%=36\%.
$$
This can be made fully rigorous by assuming that $a$ and $b$ are uniform between $1$ and $n$, and letting $n$ go to infinity. Then, for every $n$ multiple of $5$, the formal proof above becomes rigorous, hence the probability is exactly $36\%$, which implies that the limit when $n\to\infty$ ($n$ multiple of $5$ or not) indeed exists and is $36\%$.
The same reasoning shows that $a^2+b^2$ is $1$ or $2$ or $3$ or $4$ modulo $5$, each with probability $16\%$, in other words, the odds for $0:1:2:3:4$ are $9:4:4:4:4$.
A: $1^2 mod  5 \equiv 1$
$2^2 mod 5 \equiv 4$
$3^2 mod 5 \equiv 4$
$4^2 mod 5 \equiv 1$
$5^2 mod 5 \equiv 0$ 
We want $a^2+b^2 mod 5 \equiv 0$, 
That happens for (1,3)  (1,2)  (4,3)  (4,2)  (3,1)  (2,1)  (3,4)  (2,4)  and (5,5)
where (x,y) represents (a mod 5, b mod 5)
5*5 ways to express (x,y)
So the probability is 9/25
