Tuesday, December 27, 2011

Combinations with Repetition


1. Combinations with Repetition

OK, now we can tackle this one ...
Let us say there are five flavors of icecream: banana, chocolate, lemon, strawberry and vanilla. You can have three scoops. How many variations will there be?
Let's use letters for the flavors: {b, c, l, s, v}. Example selections would be
  • {c, c, c} (3 scoops of chocolate)
  • {b, l, v} (one each of banana, lemon and vanilla)
  • {b, v, v} (one of banana, two of vanilla)
(And just to be clear: There are n=5 things to choose from, and you choose r=3 of them.
Order does not matter, and you can repeat!)
Now, I can't describe directly to you how to calculate this, but I can show you a special technique that lets you work it out.
Think about the ice cream being in boxes, you could say "move past the first box, then take 3 scoops, then move along 3 more boxes to the end" and you will have 3 scoops of chocolate!
 So, it is like you are ordering a robot to get your ice cream, but it doesn't change anything, you still get what you want.
Now you could write this down as  (arrow means move, circle means scoop).
In fact the three examples above would be written like this:
{c, c, c} (3 scoops of chocolate):
{b, l, v} (one each of banana, lemon and vanilla):
{b, v, v} (one of banana, two of vanilla):
OK, so instead of worrying about different flavors, we have a simpler problem to solve: "how many different ways can you arrange arrows and circles"
Notice that there are always 3 circles (3 scoops of ice cream) and 4 arrows (you need to move 4 times to go from the 1st to 5th container).
So (being general here) there are r + (n-1) positions, and we want to choose r of them to have circles.
This is like saying "we have r + (n-1) pool balls and want to choose r of them". In other words it is now like the pool balls problem, but with slightly changed numbers. And you would write it like this:
where n is the number of things to choose from, and you choose r of them
(Repetition allowed, order doesn't matter)
Interestingly, we could have looked at the arrows instead of the circles, and we would have then been saying "we have r + (n-1) positions and want to choose (n-1) of them to have arrows", and the answer would be the same ...
So, what about our example, what is the answer?
(5+3-1)!=7!=5040= 35
3!(5-1)!3!×4!6×24


No comments:

Post a Comment