What Are Combinations? Part 2
What amazingly clever trick can help you count combinations of objects? How does it relate to our quest to find the total number of hypothetically colored rainbows? Keep on reading to find out.
Jason Marshall, PhD
Listen
What Are Combinations? Part 2
Imagine you’re holding a bag containing a red, a green, and a blue marble. You shake the bag to mix it, then select a marble and write down its color, then draw another marble and write down its color, and finally do the same thing once more. How many three-color combinations of red, green, and blue are possible? Only one, right? Because we’re talking about combinations (where ordering doesn’t matter) and not permutations (where order does matter).
Now imagine doing this again, but this time after you select a marble and write down its color, you return it to the bag and shake the whole thing up again before drawing another. In other words, this time you allow the colors to repeat. How many different three-color combinations are possible now?
What if you throw an orange, yellow, and purple marble into the bag and draw six marbles to create a list of six-color combinations? How many are there? And what does this all have to do with our ongoing quest to find out how many ways there are to arrange the colors of a rainbow? Those are exactly the questions we’ll be answering today.
Combinations: With and Without Repeats
In the past few episodes, we’ve learned all about permutations and combinations both with and without repeats. We’re not going to rehash the details of this today (check out the previous shows if you’re curious), we’re just going to jump right into tackling our final order of business on the topic: How to calculate combinations with repeats. This is precisely what we need to know to calculate the number of color combinations that are possible in the version of our marbles game in which we return marbles to the bag after drawing them. Do you see why this is true? (Think about it if not.)
To see how this works, let’s think back to our simple marbles game, in which we have one red, one green, and one blue marble in a bag, and we draw three marbles with replacement—meaning we put the marbles back into the bag each time before we select the next. How many three-color combinations are possible here?
Balls and Urns, Stars and Bars, or Marbles and Bins
We’re going to answer this question using a trick that will seem strange at first—but, once you think about it, will hopefully just seem really, really clever and awesome. This trick goes by lots of names, including “balls and urns” and “stars and bars,” but today we’re going to call it “marbles and bins.” Here’s why …
Instead of thinking about all the ways we can draw red, green, and blue marbles from a bag, we’re going to imagine sorting indistinguishable white marbles into red, green, and blue bins. To picture what we’re doing, let’s draw our three white marbles like this:
ooo
Let’s now draw two vertical bars to represent the divisions between the three color bins:
o|o|o
The bin on the left represents red, the bin in the middle represents green, and the bin on the right represents blue. So, this combination represents 1 red, 1 green, and 1 blue marble. We could also have something like
oo||o
which represents 2 red marbles, 0 green marbles, and 1 blue marble. Or something like:
|ooo|
which represents 0 red marbles, 3 green marbles, and 0 blue marbles. Make sense?
Now, here’s the cool part. The total number of possible combinations of these three colors (including the possibility that a color can repeat one or more times) is related to the number of ways you can rearrange the marbles and bars in our drawing. If you take a few minutes to draw some examples for yourself and think about it, you’ll see that every way you arrange the marbles and bins gives you a different possible three-color combination of marbles—which is exactly what we’re after!
If you’re curious, here are all of the possibilities:
- o o o | |
- o o | o |
- o o | | o
- o | o o |
- o | | o o
- o | o | o
- | o o o |
- | | o o o
- | o | o o
- | o o | o
How to Calculate Combinations With Repeats
While that’s all well and good and incredibly cool, it doesn’t tell us how to solve the problem in a general way. After all, we don’t want to have to write out a chart of all the possible ways of arranging marbles and bins every time we want to calculate combinations with repeats. And, if you look carefully at what we’ve found, you’ll see that we don’t have to.
Notice that there will always be one less bar than there are bins.
The drawings we’ve made all contain three marbles and two bars. The total number of permutations of these five objects is equal to 5! since there are 5 options for the first character, then 4 for the second, and so on down to 1 for the last. But the order in which we write the identical marbles doesn’t matter, so we need to divide this number by 3! (the number of ways the three marbles can be arranged). And the order of the bars doesn’t matter either, so we need to further divide this by 2! (the number of ways the two bars can be arranged). Thus, the number of combinations is given by 5! / (3! x 2!) = 10.
Notice that there will always be one less bar than there are bins, which means we can generalize what we’ve found even more. If there are m marbles sorted into n different bins, there will be (m + n – 1)! / [m! x (n – 1)!] different possible combinations. Or, equivalently, there will be this many possible combinations of m marbles of n different colors. Do you see why? Again, if not, I encourage you to think about it a bit.
How Many Ways Can You Make a Rainbow?
So at long last we’re ready to answer our big question: How many six-striped rainbows can you make from a rainbow’s six colors?
If we’re talking about permutations (so the order of the stripes is important) and if we don’t want the colors to repeat, there are 6! = 720 different rainbows. If we’re talking about permutations and we’re fine with repeating colors, there are 66 = 46,656 different rainbows.
If, on the other hand, we’re talking about combinations (so we don’t care about ordering of stripes) and if we don’t want colors to repeat, then there is only 1 rainbow. And finally, if we’re talking about combinations in which colors are allowed to repeat, then we now know how to find the answer: A rainbow has m = 6 stripes each of which can be n = 6 different colors, which means there are 11! / (5! x 6!) = 462 different possible rainbows.
Which is no doubt way more than you ever wanted to know about rearranging the colors of a rainbow! But at least now you know.
Wrap Up
OK, that’s all the math we have time for today.
For more fun with math, please check out my book, The Math Dude’s Quick and Dirty Guide to Algebra. And remember to become a fan of The Math Dude on Facebook, where you’ll find lots of great math posted throughout the week. If you’re on Twitter, please follow me there, too.
Until next time, this is Jason Marshall with The Math Dude’s Quick and Dirty Tips to Make Math Easier. Thanks for reading, math fans!
Marble image from Shutterstock.