Skip to main content

Section 8.1 Basic Counting

We will start, however, with some more reasonable sorts of counting problems in order to develop the ideas that we will soon need.

Example 8.1.1.

Suppose at a particular restaurant you have three choices for an appetizer (soup, salad or breadsticks) and five choices for a main course (hamburger, sandwich, quiche, fajita or pizza). If you are allowed to choose exactly one item from each category for your meal, how many different meal options do you have?

Solution.

Solution 1: One way to solve this problem would be to systematically list each possible meal:

soup + hamburger

soup + fajita

salad + sandwich

salad + pizza

breadsticks + quiche

soup + sandwich

soup + pizza

salad + quiche

breadsticks + hamburger

breadsticks + fajita

soup + quiche

salad + hamburger

salad + fajita

breadsticks + sandwich

breadsticks + pizza

Assuming that we did this systematically and that we neither missed any possibilities nor listed any possibility more than once, the answer would be 15. Thus you could go to the restaurant 15 nights in a row and have a different meal each night.

Solution 2: Another way to solve this problem would be to list all the possibilities in a table:

Table 8.1.2.
Hamburger Fajita Sandwich Pizza Quiche
+ breadsticks + breadsticks + breadsticks + breadsticks + breadsticks
+ soup + soup + soup + soup + soup
+ salad + salad + salad + salad + salad

In each of the cells in the table we could list the corresponding meal: soup + hamburger in the upper left corner, salad + hamburger below it, etc. But if we didn't really care what the possible meals are, only how many possible meals there are, we could just count the number of cells and arrive at an answer of 15, which matches our answer from the first solution. (It's always good when you solve a problem two different ways and get the same answer!)

Solution 3: We already have two perfectly good solutions. Why do we need a third? The first method was not very systematic, and we might easily have made an omission. The second method was better, but suppose that in addition to the appetizer and the main course we further complicated the problem by adding desserts to the menu: we've used the rows of the table for the appetizers and the columns for the main courses—where will the desserts go? We would need a third dimension, and since drawing 3-D tables on a 2-D page or computer screen isn't terribly easy, we need a better way in case we have three categories to choose form instead of just two.

So, back to the problem in the example. What else can we do? Let's draw a tree diagram. We can abbreviate Breadsticks (B), Soup (SP), and Salad (SD) to make the tree easier to read.

A tree with five inital branches labled hamburger, fajita, pizza, sandwich, and quiche. From each of those five branches is another three branches labeled B, SP, and SD.

This is called a "tree" diagram because at each stage we branch out, like the branches on a tree. In this case, we first drew five branches (one for each main course) and then for each of those branches we drew three more branches (one for each appetizer). We count the number of branches at the final level and get (surprise, surprise!) 15.

If we wanted, we could instead draw three branches at the first stage for the three appetizers and then five branches (one for each main course) branching out of each of those three branches.

OK, so now we know how to count possibilities using tables and tree diagrams. These methods will continue to be useful in certain cases, but imagine a game where you have two decks of cards (with 52 cards in each deck) and you select one card from each deck. Would you really want to draw a table or tree diagram to determine the number of outcomes of this game?

Let's go back to the previous example that involved selecting a meal from three appetizers and five main courses, and look at the second solution that used a table. Notice that one way to count the number of possible meals is simply to number each of the appropriate cells in the table, as we have done above. But another way to count the number of cells in the table would be multiply the number of rows (3) by the number of columns (5) to get 15. Notice that we could have arrived at the same result without making a table at all by simply multiplying the number of choices for the appetizer (3) by the number of choices for the main course (5). We generalize this technique as the basic counting rule:

Definition 8.1.3. Basic Counting Rule.

If we are asked to choose one item from each of two separate categories where there are \(m\) items in the first category and \(n\) items in the second category, then the total number of available choices is:

\begin{equation*} m \cdot n \end{equation*}

This is sometimes called the multiplication rule for counting.

Example 8.1.4.

There are 21 novels and 18 volumes of poetry on a reading list for a college English course. How many different ways can a student select one novel and one volume of poetry to read during the quarter?

Solution.

There are 21 choices from the first category and 18 for the second, so there are \(21\cdot 18=378\) possibilities.

The Basic Counting Rule can be extended when there are more than two categories by applying it repeatedly, as we see in the next example.

Example 8.1.5.

Suppose at a particular restaurant you have three choices for an appetizer (soup, salad or breadsticks), five choices for a main course (hamburger, sandwich, quiche, fajita or pasta) and two choices for dessert (pie or ice cream). If you are allowed to choose exactly one item from each category for your meal, how many different meal options do you have?

Solution.

There are 3 choices for an appetizer, 5 for the main course and 2 for dessert, so there are \(3 \cdot 5 \cdot 2=30\) possibilities.

Example 8.1.6.

A quiz consists of 3 true-or-false questions. In how many ways can a student answer the quiz?

Solution.

There are 3 questions. Each question has 2 possible answers (true or false), so the quiz may be answered in \(2\cdot 2\cdot 2=8\) different ways. Recall that another way to write \(2\cdot 2 \cdot 2\) is \(2^3\) which is much more compact.

Problem 8.1.7. Try It Now.

Suppose at a particular restaurant you have eight choices for an appetizer, eleven choices for a main course and five choices for dessert. If you are allowed to choose exactly one item from each category for your meal, how many different meal options do you have?

Answer.
\(8 \cdot 11 \cdot 5 = 440\)
Example 8.1.8.

A keycode contains four-digits (from 0 to 9).

  1. How many different keycodes are possible?

  2. How many keycodes have no repeated digits?

  3. How many keycodes only contain odd digits?

Solution.
  1. There are 10 possible numbers (0 to 9) that could be in each of the four digits of the keycode.

    \begin{equation*} 10 \cdot 10 \cdot 10 \cdot 10 = 10^4 = 10,000 \end{equation*}

    There are 10,000 different keycodes.

  2. There are 10 possible numbers (0 to 9) that could be in the first digit of the keycode. The second digit has to be different from the first, so that leave 9 possible numbers for the second digit. The third digit must be different from the first two digits, so there are 8 possible numbers for the thrid digit. Using the same reasoning, that leave 7 possibilities for the fourth digit, and:

    \begin{equation*} 10 \cdot 9 \cdot 8 \cdot 7 = 5,040 \end{equation*}

    There are 5,040 keycodes that have no repeated digits.

  3. Since all of the digits have to be odd numbers (1, 3, 5, 7, 9), there are 5 possible numbers that could be in each of the four digits of the keycode.

    \begin{equation*} 5 \cdot 5 \cdot 5 \cdot 5 = 5^4 = 625 \end{equation*}

    There are 625 keycodes that only contain odd numbers.