TITLE: Probability that sum of squares of two integers is divisible by $10$
QUESTION [5 upvotes]: I came across this question a few days ago and have been trying to find the right answer since. Two numbers $x$ and $y$ are chosen at random from the integers $\{-n,\ldots,-1,0,1,\ldots,n\}$. What is the limit, as $n \to \infty$, of the probability that $x^2+y^2$ is divisible by $10$?
I started by trying to make pairs of such numbers by checking their possible unit places.
I got $\{(1,3), (2, 4), (2, 6), (5, 5),\ldots\}$. These unit places can be set up in infinite number of $x$'s and $y$'s. The answer, though, I am sure won't be much of a vague figure like infinity.
So, I assumed two possible solutions- either the numbers must be having a pattern to form them into an infinite sequence, or a far suitable answer from this point that I find is finding the probability for a general- n terms.
Would it be correct to take a lot of pairs of integers less than or equal to 10 to find probability till infinity?
Am I proceeding in the right direction?

REPLY [7 votes]: You are going in the right direction, yes.
We indeed only have to focus on the last digits of each number, so we are looking for two numbers whose last digits are one of the following pairs:
$(0,0),(1,3),(1,7),(2,4),(2,6),(3,9),(4,8),(5,5),(6,8),(7,9)$ 
This is without looking at order, and thus we get $2*8+2 =18$ pairs if we do look at order.
This is out of $100$ possible pairs, so the probability you are looking for is $0.18$ or $18\%$

REPLY [6 votes]: The possible unit digits of square of a natural number is $1,4,5,6,9$.The possible 
 unordered pairs that make the unit digit $0$ (So that number is divisible by $10$) are :$$(1,9) ; (4,6) ; (5,5) ;(0,0)$$
Now the distribution of unit digit is as follows :
$$1 ~~~-~~~ 1,9$$$$4 ~~~-~~~ 2,8$$ $$5 ~~~-~~~ 5~~~$$$$6 ~~~-~~~ 4,6$$$$9 ~~~-~~~ 3,7$$ $$0 ~~~-~~~ 0~~~~$$
Probability that the unit digits are : $$(1,9)= \dfrac{2}{10} \times \dfrac{2}{10} \times \underbrace{2}_{\text{order}}$$$$(4,6)= \dfrac{2}{10} \times \dfrac{2}{10}\times \underbrace{2}_{\text{order}}$$$$(5,5)= \dfrac{1}{10} \times \dfrac{1}{10}$$$$(0,0)= \dfrac{1}{10} \times \dfrac{1}{10}$$
Now you can add all these and get the probability to be $\dfrac{18}{100}=0.18$

REPLY [2 votes]: Two numbers are chosen at random from all non negative integers

As Patrick Stevems implies in a comment, there is no uniform distribution on the non-negative integers. So your question is, strictly speaking, meaningless.
But we all know what you mean. To make it rigorous, you can re-phrase it:

Two numbers $x$ and $y$ are chosen at random from the integers $0,...,n$. What is the limit, as $n$ tends to infinity, of the probability that $x^2+y^2$ is divisible by $10$?

In general, such a limit is not guaranteed to exist. But in our case it does exist, and is easy to calculate. See Bram28's answer for the details.