Number of ways of picking coloured balls from a box.

combinationscombinatoricscontest-math

A box has 14 balls, 7 black balls numbered from 1 to 7 and another 7 white balls numbered from 1 to 7. A person picks 2 balls at a time and repeats the process till box is empty.
Let n be the number of ways of drawing the balls such that when every time he picks balls of both the colours, the difference of the numbers appearing on them is at most one.

I tried to brute force the problem at first but it got too complicated. Then I tried looking for a recurrence but don't see anything.

Best Answer

Let $(x,y)$ represent selecting a black ball labeled $x$ and a white ball labeled $y$.

Think of the possible valid ways to select two balls - either $|x-y|=0$ or $|x-y|=1$. This means that we can draw either $(x,x)$, $(x,x+1)$, or $(x,x-1)$.

Now for a crucial fact: it is impossible to draw two pairs of balls $(x,x+1)$ and $(x+1,x+2)$ and still meet the criteria given in the problem. If you were to do this, then there would be a black $x+2$ ball and a white $x$ ball still in the mix without any valid partners. You could argue that you could still pick $(x+2,x+3)$, for example, but this would then leave you in the same situation but now with a black $x+3$ and a white $x$.

From this, we get the following:

Of the set of balls composed of the black and white $x$ and $x+1$ balls, the only valid drawings are $(x,x)$ and $(x+1,x+1)$, or $(x,x+1)$ and $(x+1,x)$.

From here, let's call a drawing of the form $(x,x)$ to be a match, and a pair of drawings of the form $(x,x+1)(x+1,x)$ a switch, notated as $S_x$. We can show easily that the maximum number of switches possible is 3.

We can now say that a switch is even if $x$ is even and a switch is odd if $x$ is odd. It should be clear that we cannot have a drawing that includes both $S_x$ and $S_{x+1}$.

With all this in mind, it's easy to see which drawings are possible, and in fact, the list may be manually exhausted. Let's notate a drawing as a string of switches with the understanding that if a ball is not mentioned then it has a match. Our possible valid drawings are:

  • $1$ (all matches) (1 element)
  • $S_1,S_2,S_3,S_4,S_5,$ and $S_6$ (6 elements)
  • $S_1S_3,S_2S_4,S_3S_5,$ and $S_4S_6$ (4 elements)
  • $S_1S_4,S_2S_5,$ and $S_3S_6$ (3 elements)
  • $S_1S_5$ and $S_2S_6$ (2 elements)
  • $S_1S_6$ (1 element)
  • $S_1S_3S_5$ and $S_2S_4S_6$ (2 elements)

If the order that the pairs of balls are selected does not matter, then there are simply 19 different ways to pick the balls so that the criteria are met. If the order does matter, then there are $19\times 7!=95760$ ways.