So you think you can count?

Think you can count? We’re in a cafeteria with a fruit basket.

:banana: :strawberry: :watermelon: :green_apple:

An arrangement of objects into a sequence, where order matters, is a permutation. A collection of objects, when the order does not matter, is a combination.

Counting permutations

Here, we consider the choices of fruit among our three friends, Christina, Joaquin, and Ezra. Because Christina, Joaquin, and Ezra are in line at the cafeteria, the order matters.

Case 1. Christina, Joaquin, and Ezra each select one fruit. There are plenty of bananas :banana:, strawberries :strawberry:, watermelons :watermelon:, and green apples :green_apple: in the cafeteria. How many different outcomes are there? e.g., one outcome is Christina and Ezra select a banana and Joaquin selects a watermelon.

Each person individually has four different outcomes. Since there are three people and any one person’s choice does not change the possible outcomes of the others, the number of outcomes is .

More generally, when people each have a choice of fruits, the number of outcomes is . This is called a permutation with repetition since people may choose the same fruits.

Case 2. Christina, Joaquin, and Ezra each select one fruit. Now, however, there is only a single banana :banana:, green apple :green_apple:, and strawberry :strawberry: remaining in the fruit basket. How many different outcomes are there?

Now, since Christina is in line first, she has a choice between all three fruits. However, after she chooses one, there are only two choices remaining for Joaquin; Ezra gets one choice. So, here the number of different outcomes is .

More generally, given people lined up to select distinguishable fruits, the number of outcomes is:

This is called the factorial of , denoted as .

Case 3. Christina, Joaquin, and Ezra each select one fruit. Now, however, there is a banana :banana:, green apple :green_apple:, strawberry :strawberry:, and watermelon :watermelon: remaining in the fruit basket. How many different outcomes are there?

There are four fruits for three people. One fruit will be left behind. Following the logic above, Christina has four choices, Joaquin has three choices, and Ezra has two choices. So there are outcomes.

More generally, when people each choose one of distinguishable fruits, for , the number of outcomes is:

There are factors here, one for each person. Note that this can be written as:

This scenario, where we seek the number of orderings of a subset of objects from a set of distinguishable objects is called a -permutation of .

Case 4. Christina, Joaquin, and Ezra each selected one fruit. We know that, all together, Christina, Joaquin, and Ezra selected two bananas and a watermelon, but we don’t know who selected which fruit. How many different possibilities are there? e.g., one possibility is that Christina selected the watermelon and Joaquin and Ezra each selected a banana.

Here, we seek how many different ways we can distribute two bananas and a watermelon among Christina, Ezra, and Joaquin, under the constraint that each receives one fruit. This seems similar to Case 2, where we counted the permutations of three different, distinguishable fruits. But, in this scenario, the two bananas are indistinguishable. i.e., if we could label the bananas with 1 and 2, the assignment:

Christina: :watermelon:, Ezra: :banana:, Joaquin: :banana:

is the same as the assignment:

Christina: :watermelon:, Ezra: :banana:, Joaquin: :banana:

since both describe the scenario where Christina gets the watermelon and Joaquin and Ezra get a banana.

That is, overcounts the number of possibilities because, upon switching the two labeled bananas in each assignment, the assignment represents the same outcome. Consequently, we must then divide the answer for the distinguishable fruit case () by the number of ways we can permute the bananas. Since there are two bananas, we need to divide by . Thus, there are outcomes here:

  1. Christina: :watermelon:, Ezra: :banana:, Joaquin: :banana:
  2. Christina: :banana:, Ezra: :watermelon:, Joaquin: :banana:
  3. Christina: :banana:, Ezra: :banana:, Joaquin: :watermelon:

From the list above, we see that we could also reduce this problem to: who gets the watermelon? Then, there are only 3 choices.

More generally, consider when we have fruits consisting of different (distinguishable) kinds fruit. Let be the number of fruits of type (e.g. here, :banana: and :watermelon:); we have of these variables, and a constraint here is:

The number of permutations is

The numbers in the denominator– one for each type of fruit– are to account for the indistinguishability of these fruits, as we did for the bananas in this case. This is called a multiset permutation.

Counting combinations

Here, we will see examples where the ordering of the fruits does not matter by considering only Christina’s selection of fruit from the basket.

Case 5. Christina selects two different fruits from a fruit basket that contains a banana :banana:, a strawberry :strawberry:, a watermelon :watermelon:, and a green apple :green_apple:. How many different outcomes are there? e.g., one outcome is that she selects a watermelon and a strawberry. Here, the ordering of the fruit does not matter.

If ordering did matter, we would count the permutations of ; Christina has four choices for the first fruit and then three remaining choices for the second fruit she picks, giving outcomes. However, we need to correct for the fact that, here, since ordering does not matter,

{ :strawberry:, :watermelon: }

is the same as

We can correct for this overcounting by dividing by the number of permutations (reorderings) of the two fruits that Christina selected, which in this case is . There are thus different outcomes here.

We will use the brackets {} to denote a set of objects where ordering does not matter. All outcomes here are then:

  1. {:strawberry:, :watermelon:}
  2. {:strawberry:, :banana:}
  3. {:strawberry:, :green_apple:}
  4. {:watermelon:, :banana:}
  5. {:watermelon:, :green_apple:}
  6. {:green_apple:, :banana:}

More generally, following the math for -permutations of in Case 3, the number of combinations of fruits from a basket of distinguishable fruits (, in this case) is:

So the formula gives the number of -permutations of divided by , the number of ways to permute/rearrange an ordered sequence of fruits, to correct for the order being inconsequential.

The number of combinations of objects from a set of distinguishable objects has a special notation:

read out loud as “ choose ”.

Case 6. Christina selects two fruits from a fruit basket with four different types of fruit (bananas :banana:, strawberries :strawberry:, watermelons :watermelon:, and green apples :green_apple:). However, we now relax the constraint in Case 5 by allowing duplicates; Christina can select two of the same fruit if she desires. How many outcomes are there? Again, ordering does not matter.

There is a visual way to understand this problem. To represent a particular outcome, let’s list the fruits that Christina chooses in a special way, using cookies :cookie: from the cafeteria. We place cookies in a row on the table:

:cookie: :cookie: :cookie:

When Christina chooses two fruits, we group them together by fruit type (e.g. bananas with bananas) and place them in between the cookies, using the cookies as separators. Our convention is to place the fruits in the following order: bananas, strawberries, watermelons, and then green apples.

For example, if she chooses a banana and a watermelon, we represent this as:

:banana: :cookie: :cookie: :watermelon: :cookie:

If she chooses two watermelons:

:cookie: :cookie: :watermelon: :watermelon: :cookie:

If she chooses a watermelon and a green apple:

:cookie: :cookie: :watermelon: :cookie: :green_apple:

That is, we keep a cookie :cookie: to separate the fruit type even if there were no fruits of that type. This way, no matter what the outcome, there are always fruits and cookies in our representation of an outcome, for a total of foods representing the outcome.

From this representation of outcomes, we see that the number of outcomes is equal to the number of ways that we can arrange the cookies in positions (the rest of the positions will be occupied by fruits). This is a multiset permutation as in Case 4, where we are looking for the number of permutations of symbols, of which are indistinguishable cookies and the other symbols are fruits, which we also view as indistinguishable since the positions of the cookies distinguish the fruits implicitly by our convention of ordering the fruit.

The number of ways we can arrange the cookies among the positions is:

In this particular case, . We now check by enumerating the possibilities. We have four more possibilities than in Case 5 above, since we now allow for duplicates:

  1. {:strawberry:, :watermelon:}
  2. {:strawberry:, :banana:}
  3. {:strawberry:, :green_apple:}
  4. {:watermelon:, :banana:}
  5. {:watermelon:, :green_apple:}
  6. {:green_apple:, :banana:}
  7. {:strawberry:, :strawberry:}
  8. {:banana:, :banana:}
  9. {:watermelon:, :watermelon:}
  10. {:green_apple:, :green_apple:}

This scenario is counting the number of combinations of objects with repetitions. This type of counting also has a special notation:

comments powered by Disqus