Odds and Evens Made Fair

This problem follows on from an earlier one. Make sure you have a think about Odds and Evens first!

Iris and many others realised that the game given in this problem is not fair. There are more ways of making an odd total than an even one. Finding a game which is fair is a harder challenge!


A good thing to notice is that the actual numbers on the balls don't matter - just whether they are even or odd. This is sometimes called a number's parity.

Charlotte, Lokhin, Matthew, Jake and Hashim from The Cherwell School sent in a fair game they found by trial and improvement:

To start with we tried two even and two odd balls because this is the most logical, but this made you more likely to lose. The table shows ossible outcomes here where the parity of the first ball is along the top, and the second is down the left side. The diagonal cells don't count because you can't choose the same ball twice.
 

  E E O O
E - E O O
E E - O O
O O O - E
O O O E -

You can see that there are 8 odd outcomes and only 4 even ones - and each outcome is equally likely. This game is unfair, so we tried swapping one of the evens with an odd and the result was a fair game.

Great work! Try to construct the table of outcomes for this new game with 1 even and 3 odd balls. Check for yourself that the game is fair.

Michael, Benjie, Oliver, Conall gave very similar algebraic solutions. They used different ways of turning the problem into a set of equations to solve, and then found the answers. Fantastic work, see if you can follow the method:


Write $a$ for the number of even balls, and $b$ for the number of odd ones. We need to count ways of finding even and odd totals. It's important to be able to count ways of choosing pairs of things. If you choose 2 things from $n$ objects there are $n(n-1)/2$ ways to do this because there are $n$ ways of choosing the first, then $(n-1)$ ways of choosing the second; but then we count each pair twice; choosing it in either order.

Even, Even: This makes an even total. There are $a(a-1)/2$ ways of choosing two evens.

Odd, Odd: This makes an even total. There are $b(b-1)/2$ ways of choosing two odds.

Even, Odd or Odd, Even: This makes an odd total. There are exactly $ab$ ways of choosing one odd and one even number.

Sometimes counting pairs can be tricky, make sure you understand why these numbers work.

So there are $\frac{a(a-1) + b(b-1)}{2}$ ways of choosing an even total and $ab$ ways of choosing an odd total. Since each individual outcome is equally likely to occur we need these numbers to be equal. This is where we find an equation:

$$\frac{a(a-1) + b(b-1)}{2} = ab$$

There are a few good ways of solving this. One extra problem is that $a$ and $b$ are integers. Rearrange the equation to give

\begin{align}
a(a-1) + b(b-1) &= 2ab\\
a^2-a+b^2-b-2ab &= 0\\
(a-b)^2 -(a+b) &= 0\\
(a-b)^2 &= a+b
\end{align}

Which we can solve using our knowledge that since $a$ and $b$ are integers; so are $a-b$ and $a+b$. but then $a+b$ is a square number! Let's write $a+b=n^2$. Then we also have

$$a-b=\pm n$$

But since $a$ and $b$ play the same role in the equation solutions are valid if we swap $a$ and $b$. Let's just take $a-b=n$ then. The other sign is dealt with by swapping.

Now we have $a-b= n$ and $a+b=n^2$. So solve for $a$ and $b$:
\begin{align}
a &=\frac{n^2+n}{2}\\
b &=\frac{n^2-n}{2}
\end{align}

Wonderful. The same solutions can be found if you use the quadratic formula on the big equation for $a$ and $b$ too. This is equally good! Now put all this together:

So for the game to be fair; we need the number of odd and even balls to have the formulas above for any positive integer $n$. This also means the total number of balls is a square number.

For example if $n=2$ we have the solution found by trial and improvement above, with odd and even swapped.