Discrete Mathematics and Combinatorics

The Multiplication and Addition Rules of Counting

Learn when to multiply and when to add in counting problems, with worked examples, the complement trick and the usual traps.

Key takeaways

  • The multiplication rule: if a task has k steps with n₁, n₂, ..., nₖ options whatever came before, there are n₁ × n₂ × ... × nₖ outcomes.
  • The addition rule: if the outcomes split into cases with no overlap, the total is the sum of the case counts.
  • Counting everything and subtracting the unwanted outcomes is often far quicker than counting the wanted ones directly.
  • When cases overlap, subtract the overlap once, and when each outcome is built several times, divide by that number.

Multiply when you build one outcome through a sequence of choices: this and then that. Add when an outcome falls into one of several separate cases: this or else that. Nearly every counting formula is these two rules applied carefully.

The care lies in the conditions. Multiplication needs the number of options at each step to be the same no matter which earlier choices you made. Addition needs the cases not to overlap.

The multiplication rule

Say a lunch counter offers 3 breads, 4 fillings and 2 sides, and a meal takes one of each. For each of the 3 breads there are 4 fillings, giving 12 sandwiches. For each sandwich there are 2 sides, giving 24 meals.

meals = 3 × 4 × 2 = 24

A tree diagram shows why. Start with one point, draw 3 branches, then 4 from each of those, then 2 from each of the new ends. Every meal is one route from the start to a tip.

The rule extends to as many steps as you like. A made-up license plate format with 3 letters followed by 3 digits allows 26³ × 10³ = 17,576,000 plates. Each position is a step, and repeating a letter or digit is allowed.

Example: building a meal, one choice at a time
1 Pick a bread 3 options 2 Pick a filling 4 options each: 12 so far 3 Pick a side 2 options each: 24 meals Pick a bread 3 options 1 Pick a filling 4 options each: 12 so far 2 Pick a side 2 options each: 24 meals 3

When later choices depend on earlier ones

Now forbid repeats on the plate: no letter twice and no digit twice. The second letter has 25 options and the third has 24.

26 × 25 × 24 × 10 × 9 × 8 = 11,232,000

Which 25 letters remain depends on the first choice, but how many remain does not. That is all the rule requires.

Trouble starts when even the number of options varies. Consider three-digit even numbers with all digits different. If you choose the hundreds digit first, the count for the units digit depends on whether you used an even digit. The cure is to choose the most restricted position first and split into cases.

  • Units digit is 0: the hundreds digit has 9 options and the tens digit 8, giving 72.
  • Units digit is 2, 4, 6 or 8: the hundreds digit cannot be 0 or the units digit, so it has 8 options, and the tens digit has 8. That gives 4 × 8 × 8 = 256.

The total is 72 + 256 = 328.

The addition rule

If a set of outcomes splits into groups that share nothing, count each group and add. A student who must choose one project from 5 history topics or 7 science topics, with no topic on both lists, has 5 + 7 = 12 choices.

Most real problems mix the two rules. How many passwords of length 2 or 3 can you form from lowercase letters? The lengths are separate cases, and each case is a multiplication:

26² + 26³ = 676 + 17,576 = 18,252

In set language, the addition rule says that for disjoint sets, meaning sets with no common member, |A ∪ B| = |A| + |B|. Here |A| is the number of elements in A and ∪ is the union, everything in either set.

Fixing overlaps

When the cases share outcomes, adding counts the shared ones twice. Subtract them once:

|A ∪ B| = |A| + |B| − |A ∩ B|

The symbol ∩ marks the intersection, the outcomes in both. How many whole numbers from 1 to 100 are divisible by 4 or by 6? There are 25 multiples of 4 and 16 multiples of 6. Numbers divisible by both are multiples of 12, and there are 8 of them. The answer is 25 + 16 − 8 = 33.

With three or more overlapping properties the pattern of adding and subtracting continues. That is the inclusion-exclusion principle. A picture helps for two or three sets, as shown in reading Venn diagrams.

Counting the complement

The complement of a set of outcomes is everything outside it. Sometimes the outcomes you do not want are much easier to count.

How many four-digit PINs, from 0000 to 9999, contain at least one 7? A direct count must handle one, two, three or four sevens separately. Instead, count all PINs and remove those with no 7.

all PINs        10⁴ = 10,000
no digit is 7   9⁴  =  6,561
at least one 7       3,439

The phrase "at least one" is a good signal to try this. The same move solves the birthday problem, where it is easiest to count the groups in which everyone's birthday differs.

A longer worked problem

How many strings of 4 lowercase letters begin or end with a vowel, taking the vowels to be a, e, i, o and u? Letters may repeat.

Start by naming two sets. Let A be the strings that begin with a vowel and B the strings that end with one. Each set is a multiplication, since one position has 5 options and the other three have 26.

|A|      = 5 × 26³      = 87,880
|B|      = 26³ × 5      = 87,880
|A ∩ B|  = 5 × 26² × 5  = 16,900
|A ∪ B|  = 87,880 + 87,880 − 16,900 = 158,860

Now check by the complement. A string fails the condition only if it begins with one of the 21 other letters and ends with one of them too. There are 21 × 26 × 26 × 21 = 298,116 such strings. All strings number 26⁴ = 456,976, and 456,976 − 298,116 = 158,860.

Two methods with different weak points have agreed. That is about the best check available when the numbers are too large to list.

Splitting into cases well

Good cases have two properties: together they cover every outcome, and no outcome falls into two of them. Mathematicians call such a division a partition of the set.

Natural ways to split include the value of the most restricted position, the number of times a special item appears, or the size of the outcome. For instance, to count whole numbers below 1,000 that contain exactly one digit 5, treat them as three-digit strings from 000 to 999 and split by where the 5 sits. Each of the 3 cases leaves two positions with 9 options apiece, so the total is 3 × 81 = 243.

Two counts worth memorizing

First, a set with n elements has 2ⁿ subsets. Build a subset by walking through the elements and deciding in or out for each one: n steps with 2 options apiece. The empty set and the whole set are included.

Second, the number of functions from a set of k elements to a set of n elements is nᵏ, because each of the k inputs independently receives one of n outputs. Ten true or false questions can be answered in 2¹⁰ = 1,024 ways.

The multiplication rule also counts divisors. Since 360 = 2³ × 3² × 5, a divisor uses 0 to 3 twos, 0 to 2 threes and 0 or 1 five, so there are 4 × 3 × 2 = 24 divisors. See counting divisors from prime factors.

When you have counted too often

Some outcomes are easier to build several times and then correct. If every outcome gets built exactly d times, divide by d. This is sometimes called the division rule.

Seat 5 people around a round table, where two seatings are the same if one is a rotation of the other. Lining them up gives 5 × 4 × 3 × 2 × 1 = 120 orders. Each circular seating appears 5 times, once for each starting seat, so there are 24.

The condition matters: every outcome must be counted the same number of times. When some patterns are more symmetric than others, simple division fails, and you need Burnside's lemma.

Division also leads straight to selections where order does not matter, covered in permutations and combinations.

A checklist and common mistakes

Before computing, describe how you would write down one outcome. Then ask these questions.

Question If yes
Is an outcome built by successive choices? Multiply the option counts
Are there different kinds of outcome? Add the counts for each kind
Can one outcome belong to two kinds? Subtract the overlap
Can one outcome be built in several ways? Divide, or redesign the steps

The most frequent error is double counting hidden in the steps. Suppose you want two-card hands containing at least one ace. "Pick an ace (4 ways), then any other card (51 ways)" gives 204. But a hand with two aces gets built twice, once with each ace picked first. The correct count is all hands minus hands with no ace: 1,326 − 1,128 = 198. The difference, 6, is exactly the number of two-ace hands.

A second habit worth forming is to test on a tiny version. Shrink the deck to 2 aces and 1 other card, list the hands, and see whether your method agrees.

Another common slip is multiplying cases that should be added. If a dessert is either one of 4 cakes or one of 3 fruits, there are 7 desserts. The product, 12, counts meals that include both. Reading your plan aloud with "and then" or "or else" usually exposes the mistake.

From counts to probabilities

When every outcome is equally likely, the probability of an event is the number of favorable outcomes divided by the number of all outcomes. Both numbers must come from the same way of describing an outcome.

Take the PIN example and suppose, hypothetically, that a PIN is picked uniformly at random. The chance that it contains at least one 7 is 3,439/10,000, a little over 34 percent. Real people do not choose PINs uniformly, so this describes the random model only.

For two fair dice, treat them as distinguishable and count 6 × 6 = 36 equally likely ordered results. A total of 7 arises from 6 of them, giving 1/6. A total of 2 arises from only 1, giving 1/36. Listing unordered results instead would produce 21 outcomes that do not have equal chances.

Practice problems

  1. How many three-letter strings have no two neighboring letters equal? You should get 26 × 25 × 25 = 16,250.
  2. How many whole numbers from 1 to 60 are divisible by 3 or 5? Add 20 and 12, subtract 4, and get 28.
  3. How many ways can 6 coin tosses include at least one head? The answer is 64 − 1 = 63.

Written for 4Mathematics with AI writing tools and not reviewed line by line by a person. Check anything you rely on against a textbook or primary source. Report an error.

Keep reading

All 45 articles in Discrete Mathematics and Combinatorics →

Latest news on this topic