Home

Permutations and Combinations

Generalized Permutations and Combinations

Generating Permutations and Combinations

Applets


Site Index

Computer Science 235 Project
Permutations & Combinations
Patrick McAtee, Tom Rice, and Jesse Whidden

Generalized Permuations and Combinations

Repetitions, Indistinguishable Objects, and Objects in Boxes


Combinations with Repetition

E X A M P L E S

Basic Application | Advanced Application


Example: Basic Application
Pretend you're playing a carnival game and you've won the lottery, sort of. You have the opportunity to select five bills from a money bag, while blindfolded. The bill values are $1, $2, $5, $10, $20, $50, and $100. How many different ways can you choose the five bills? (Order doesn't matter, and there are at least five of each type of bill.)

Applying the formula to our situation, n = 7 (the number of bill types we can choose from) and r = 5 (the number of bills we actually get to pick). Using the formula, the number of different ways to pick 5 bills is C(7 + 5 - 1, 5) = C(11, 5)
= 11!

5! 6!

= 462

Return to tutorial: Combinations with Repetition

Example: Advanced Application
This formula can also be used to find the total number of solutions to certain math problems (although it won't tell you what exactly those are). For example, how many solutions are there to the equation

x + y + z = 17

where x, y, and z are all non-negative integers?

To apply the formula, it is necessary to think of each variable as a different 'type'. Therefore, when we find the solution

9 + 3 + 5 = 17

We've counted 9 items of type x, 3 items of type y, and 5 items of type z.

To generalize for this equation, n = 3 (the number of variables) and r = 17 (the sum). So, the total number of solutions is C(3 + 17 - 1, 17) = C(19, 17)
= 19!

17! 2!

= 171

Return to tutorial: Combinations with Repetition

Last updated 12/14/2001