combinatorics - take all the balls out of a basket so that number of the balls from each color be always unequal.
We have $5$ identical blue balls and $5$ identical red balls in a basket. in each step we can do one of these three:
- take a blue ball out of the basket.
- take a red ball out of the basket.
- take a blue and a red ball out of the basket.
How many ways are there to take all the balls out of the basket so that, except at first and last, we don't have the same number of each colour in the basket?
At first, I wanted to solve this by calculating the ways we will have the same number of each colour and subtracting it from all the ways we can take all the balls out; but I don't know how to do this and I don't even know if this is the best way to solve the problem.
I really appreciate it if someone could help me with this.
Solution 1:
If you're too lazy to manually compute the recursive function, it's easy to let excel to all the work for you. We will make a $6\times 6$ grid, where the entry in the $i^{\text{th}}$ row and $j^{\text{th}}$ column (zero-indexed) is the number of ways to remove $i$ blue marbles and $j$ red marbles according to your rules. With Excel's convention of numbering rows by numbers and columns by letters, the entry in C4
would represent the number of ways to draw three blue marbles and two red ones. In particular, F6
contains the final answer.
-
Fill the first row,
A1
toF1
, with the number $1$ (if there are zero blue marbles, there is only one way to remove the red marbles). -
Fill the rest of the first column,
A2
toA6
, with the number $1$. -
Set
B2
to be the formula= A2 + A1 + B1
. Click and drag to fill the rest of the table (entriesB2:F6
) with that formula. (Each entry is the sum of the entries above, to the left of, and diagonally above-and-to-the-left of itself, representing the three choices of what marble(s) to remove). -
Finally, manually delete the formulas in the diagonal cells
B2, C3, D4,
andE5
and replace them with zero. (Equal marbles are not allowed in intermediate steps).
The completed result is in this Google sheets doc.