# Probability that number is divisible by 5

Two numbers $x$ and $y$ are chosen at random without replacement from the set $${1,2,\cdots,5n}$$.then the probability that $x^4-y^4$ is divisible by $5$ is----

I could write down $x^4-y^4$ as $(x-y)(x+y)(x^2+y^2)$ and then i could easily figure out the possoble cases for first and second brackets but i couldnot figure out for the third bracket.

Thanks.

• The divisibilty condition can be written $5|x=5|y$. – Yves Daoust Oct 13 '16 at 7:11

Note that if $x$ is not a multiple of $5$ then $x^4-1$ is divisible by $5$ (why?).

This implies that if $x$ and $y$ are not a multiple of $5$ then $x^4-y^4=(x^4-1)-(y^4-1)$ is divisible by $5$.

Can you take it from here?

P.S. Finally you will find that $x^4-y^4$ is NOT divisible by 5 iff the set $\{x,y\}$ ($5n(5n-1)/2$ choices) contains a multiple of $5$ ($n$ choices) and a not-multiple of $5$ ($4n$ choices). Hence the probability is $$1-\frac{(n)\cdot (4n)}{\frac{5n(5n-1)}{2}}.$$

The remainders modulo $5$ of $n^4$ are periodically

$$0,1,16,81,256\to0,1,1,1,1$$

Hence $x^4-y^4$ is a multiple of $5$ when both or none are multiple of $5$.

The first drawing yields a multiple with probability $n/(5n)$. The second drawing yields a multiple with probabilities $(n-1)/(5n-1)$ or $n/(5n-1)$.

Hence the requested probability $p_1p_{2|1}+(1-p_1)(1-p_{2|1})$,

$$\frac15\frac{n-1}{5n-1}+\frac45\left(1-\frac n{5n-1}\right).$$