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