# Find the probability that $m^2-n^2$ is divisible by $4$

Two integers are $m$ , $n$ chosen at random with replacement from the set of integers $1,2,3..9$ . Find the probability that $m^2-n^2$ is divisible by $4$ .

my solution : Two integers can be chosen (with replacement ) in $9\times 9=81$ ways .

$m^2-n^2$ is divisible iff either both $m,n$ are odd or both are even . There are $4\times 4=16$ ways way of obtaining both even integers and $5\times 5=25$ ways of obtaining both odd integer.

So total number of favorable outcome $=16+25=41$ .

Hence required probability = $\frac{41}{81}$ .

Now i would like to slightly change the question :

Two integers are $m$ , $n$ chosen at random without replacement from the set of integers $1,2,3..9$ . Find the probability that $m^2-n^2$ is divisible by $4$

my solution when order consideration is relevant :

Total number of obtaining two integers $= 2\times 9\times 8=2\times 72$

Numbers ways of obtaining two even numbers $=2\times 4\times 3$ and number of ways obtaining odd numbers $=2\times 5\times 4$ .

So total number of favorable cases= $2(4\times 3+5 \times 4)=2\times 32$ . Hence required probability $=\frac{2 \times 32 }{2 \times 72 }=\frac{32}{72}$

my solution when order is considered irrelevant

Total numbers of cases $=9\times 8=72$

Numbers of ways obtaining both even and both odd integers is $4\times3=12$ and $5\times4=20$ respectably .

So number of favorable cases$=12+20=32$ .

Hence probability =$\frac{32}{72}$

Is my understanding in above problems correct ? Please point out if i calculated anything wrong?

Thank you

• Looks good to me! – vrugtehagel Apr 14 '17 at 8:16

Everything is fine, the only thing wrong is :

When order is considered, the total ways will be $9 \times 8$ rather than $2 \times 9 \times 8$.

You have counted repeatedly, consider selecting $m$ and $n$ from set {$1,2$}.

Total ordered pairs are : (1,2), (2,1).

Id est $2 \times 1$, not $2 \times 2 \times 1$.

Although this doesn't alter your answer, because $2$ is cancelled from both the numerator and denominator.

Similarly, when order isn't considered, the total ways would be $\displaystyle \binom{9}{2}=\frac{9 \times 8}{2}$ rather than $9 \times 8$.

We will use the following three things:

1) $$(x^2-y^2) = (x-y)(x+y)$$
2) Odd + Odd = Even
Odd - Odd = Even
Even + Even = Even
Even - Even = Even
Odd + Even = Even + Odd = Odd
Odd - Even = Even - Odd = Odd
3) Even $$\cdot$$ Even = Multiple of $$4$$
Odd $$\cdot$$ Odd = Odd $$\not =$$ Multiple of $$4$$

Hence if $$x,y$$ both Odd or both Even we have $$(x^2-y^2) = (x-y)(x+y) =$$ Even $$\cdot$$ Even = Multiple of $$4$$
And if one is Even and the other is Odd we have $$(x^2-y^2) = (x-y)(x+y) =$$ Odd $$\cdot$$ Odd $$\not =$$ Multiple of $$4$$

Hence for $$(x^2-y^2)$$ to be divisible by 4 we need them to be "same" , with respect to divisibility by two. Think of this as there being $$9$$ cards. $$4$$ Red and $$5$$ Black. What is the probability that if, with replacement, we pick the same colour twice? Clearly this is $$\frac{5}{9}\cdot \frac{5}{9} + \frac{4}{9}\cdot\frac{4}{9} = \frac{41}{81} \approx 0.5$$