Chapter

Counting Principles

The module introduces olympiad counting through order of choice, the sum rule, the product rule, casework, complement counting, and first overcounting traps.
Log in to track solved progress and bookmarks.

Theory

Key Idea

Counting begins not with a formula, but with the question: what is chosen first, what is chosen next, and does the next choice depend on the previous one? The sum rule is used for disjoint cases, while the product rule is used for sequential choices when the number of options at each step is known.

The olympiad difficulty is often not arithmetic, but avoiding double counting and missing forbidden cases. Therefore this module emphasises a careful order of choice, casework, and complement counting.

Basic Facts

  • If an object can be obtained in \(a\) ways of one type or \(b\) ways of another type, and the types are disjoint, there are \(a+b\) ways.
  • If the first step has \(a\) choices and after each first step the second has \(b\) choices, there are \(a\cdot b\) ways.
  • If the number of choices on a later step depends on an earlier step, write a product by cases or draw a choice tree.
  • Complement counting: sometimes it is easier to count all objects and subtract the forbidden ones.
  • Overcounting happens when the same object can be obtained in several ways; then choose a different order or divide by the number of repetitions.

When to Use This Method

  • You need to count numbers, words, paths, selections, or colorings with simple restrictions.
  • The condition naturally splits into disjoint cases.
  • Forbidden objects are easier to count than allowed objects.
  • There is a danger that different descriptions produce the same object.

How to Recognise the Method

The word “or” often suggests the sum rule, provided the cases are disjoint. Words like “first”, “then”, and “after that” suggest the product rule. If the statement says “at least one”, “not less than one”, or “without such a property”, check the complement method.

If several objects are chosen, ask: does order matter? If order does not matter, one cannot simply multiply sequence choices without later correction.

Typical Mistakes

  • Adding choices when the choices must be made simultaneously.
  • Multiplying cases that overlap.
  • Forgetting that the first digit of a number cannot be \(0\).
  • Counting “at least one” directly when complement counting is shorter.
  • Counting the same object twice because it was chosen in different orders.

Mini-Checklist

  • What exactly counts as one object?
  • Does the order of choices matter?
  • Are the cases truly disjoint?
  • Are forbidden objects easier to subtract?
  • Does a later choice depend on an earlier one?
  • Can the same object be obtained in several ways?

Examples

Example 1. Sum Rule

The cases must be disjoint.

Problem. A student has \(5\) mathematics books and \(4\) physics books. In how many ways can he choose one book?

Solution.

He chooses either a mathematics book or a physics book. These cases do not overlap. Therefore there are \(5+4=9\) ways.

Comment. If he had to choose two books, one mathematics and one physics, it would be a product, not a sum.

Example 2. Product Rule

Sequential steps give a product.

Problem. There are \(3\) roads from city \(A\) to city \(B\), and \(4\) roads from \(B\) to \(C\). How many routes go from \(A\) to \(C\) through \(B\)?

Solution.

First choose the road \(A o B\): \(3\) choices. Then choose the road \(B o C\): \(4\) choices. Total: \(3\cdot4=12\) routes.

Comment. Every first choice is compatible with every second choice.

Example 3. Choosing Without Repetition

The number of choices changes after each step.

Problem. How many three-digit numbers can be formed from digits \(1,2,3,4,5\) if digits do not repeat?

Solution.

The hundreds digit can be chosen in \(5\) ways, the tens digit in \(4\) ways, and the units digit in \(3\) ways. Total: \(5\cdot4\cdot3=60\).

Comment. After the first digit is chosen, it is no longer available.

Example 4. The First Digit Is Not Zero

The restriction on the first step must not be forgotten.

Problem. How many three-digit numbers with distinct digits can be formed from \(0,1,2,3,4\)?

Solution.

The hundreds digit can be chosen in \(4\) ways: \(1,2,3,4\). Then \(4\) digits remain for the tens place and \(3\) for the units place. Total: \(4\cdot4\cdot3=48\).

Comment. Starting with \(5\cdot4\cdot3\) would count strings that begin with zero.

Example 5. Complement Counting

“At least one” is often better counted by the opposite condition.

Problem. How many binary strings of length \(6\) contain at least one \(1\)?

Solution.

There are \(2^6=64\) binary strings in total. There is exactly one string with no ones: \(000000\). Therefore the answer is \(64-1=63\).

Comment. Direct counting by the number of ones would be longer.

Example 6. Cases by the Last Digit

Splitting into cases helps handle divisibility.

Problem. How many four-digit numbers with distinct digits from \(0,1,\ldots,7\) are divisible by \(5\)?

Solution.

The last digit must be \(0\) or \(5\). If it is \(0\), the first digit has \(7\) choices, then \(6\), then \(5\): \(210\). If it is \(5\), the first digit is neither \(0\) nor \(5\): \(6\) choices, then \(6\), then \(5\): \(180\). Total: \(390\).

Comment. The cases are disjoint, so their counts are added.

Example 7. Overcounting

Sometimes the order of choosing creates extra copies.

Problem. In how many ways can two monitors be chosen from \(8\) students if the roles are identical?

Solution.

If we choose first and second in order, we get \(8\cdot7=56\) choices. But each pair is counted twice: \(AB\) and \(BA\). Therefore the answer is \(56/2=28\).

Comment. This is the first signal that order is not always part of the object.

Example 8. Complement with Two Restrictions

Two forbidden conditions require adding back the intersection.

Problem. How many words of length \(5\) over the alphabet \(\{A,B,C\}\) contain at least one \(A\) and at least one \(B\)?

Solution.

There are \(3^5=243\) words in total. Without \(A\): \(2^5=32\). Without \(B\): \(2^5=32\). Without both \(A\) and \(B\), the word consists only of \(C\), so there is one. By complement counting, the answer is \(243-32-32+1=180\).

Comment. The intersection of the two forbidden sets was subtracted twice, so it must be added back.

Problems

Problems

#1.1
#1.1

One Choice from Two Groups

Counting Grade 7 Grade 8 ★☆☆☆☆

A box contains \(6\) red and \(5\) blue cards. In how many ways can one card be chosen?

Details
Problem: COM-B1-M01-P001
Difficulty: Level 1 of 5
Tag: Counting
Grade: Grade 7, Grade 8
#1.2
#1.2

Two Sequential Choices

Counting Grade 7 Grade 8 ★☆☆☆☆

A cafe has \(4\) soups and \(3\) main dishes. How many lunches consisting of one soup and one main dish can be made?

Details
Problem: COM-B1-M01-P002
Difficulty: Level 1 of 5
Tag: Counting
Grade: Grade 7, Grade 8
#1.3
#1.3

Two-Digit Numbers

Product rule Grade 7 Grade 8 ★☆☆☆☆

How many two-digit numbers with distinct digits can be formed from \(1,2,3,4,5\)?

Details
Problem: COM-B1-M01-P003
Difficulty: Level 1 of 5
Tag: Product rule
Grade: Grade 7, Grade 8
#1.4
#1.4

Nonempty Subsets

Complement method Grade 7 Grade 8 ★☆☆☆☆

How many nonempty subsets does a set of \(6\) elements have?

Details
Problem: COM-B1-M01-P004
Difficulty: Level 1 of 5
Tag: Complement method
Grade: Grade 7, Grade 8
#1.5
#1.5

Sum of Two Positive Numbers

Counting Grade 7 Grade 8 ★☆☆☆☆

How many pairs of positive integers \((a,b)\) satisfy \(a+b=7\)?

Details
Problem: COM-B1-M01-P005
Difficulty: Level 1 of 5
Tag: Counting
Grade: Grade 7, Grade 8
#1.6
#1.6

Even Three-Digit Numbers

Digits Grade 7 Grade 8 ★★☆☆☆

How many even three-digit numbers with distinct digits can be formed from \(0,1,2,3,4,5\)?

Details
Problem: COM-B1-M01-P006
Difficulty: Level 2 of 5
Tag: Digits
Grade: Grade 7, Grade 8
#1.7
#1.7

Short Paths

Counting Grade 7 Grade 8 ★★☆☆☆

How many shortest paths go from the lower-left corner of a \(3\) by \(2\) grid to the upper-right corner if one may only move right and up?

Details
Problem: COM-B1-M01-P007
Difficulty: Level 2 of 5
Tag: Counting
Grade: Grade 7, Grade 8
#1.8
#1.8

No Equal Adjacent Letters

Product rule Grade 7 Grade 8 ★★☆☆☆

How many words of length \(4\) over \(\{A,B,C\}\) have no two adjacent equal letters?

Details
Problem: COM-B1-M01-P008
Difficulty: Level 2 of 5
Tag: Product rule
Grade: Grade 7, Grade 8
#1.9
#1.9

Divisible by \(3\) or \(5\)

Complement method Grade 7 Grade 8 ★★☆☆☆

How many integers from \(1\) to \(200\) are divisible by \(3\) or by \(5\)?

Details
Problem: COM-B1-M01-P009
Difficulty: Level 2 of 5
Tag: Complement method
Grade: Grade 7, Grade 8
#1.10
#1.10

Chair and Secretary

Product rule Grade 7 Grade 8 ★★☆☆☆

A class has \(12\) students. In how many ways can a chair and a secretary be chosen if they must be different students?

Details
Problem: COM-B1-M01-P010
Difficulty: Level 2 of 5
Tag: Product rule
Grade: Grade 7, Grade 8
#1.11
#1.11

Team with a Condition

Casework Grade 8 Grade 9 ★★☆☆☆

From \(4\) boys and \(3\) girls, a team of \(3\) is chosen. How many teams contain at least one girl?

Details
Problem: COM-B1-M01-P011
Difficulty: Level 2 of 5
Tag: Casework
Grade: Grade 8, Grade 9
#1.12
#1.12

Three-Stripe Flag

Product rule Grade 8 Grade 9 ★★☆☆☆

A flag has three horizontal stripes. There are \(4\) colors, and adjacent stripes must have different colors. How many flags can be made?

Details
Problem: COM-B1-M01-P012
Difficulty: Level 2 of 5
Tag: Product rule
Grade: Grade 8, Grade 9
#1.13
#1.13

Four-Digit Multiples of \(5\)

Digits Grade 8 Grade 9 ★★★☆☆

How many four-digit numbers with distinct digits from \(0,1,\ldots,7\) are divisible by \(5\)?

Details
Problem: COM-B1-M01-P013
Difficulty: Level 3 of 5
Tag: Digits
Grade: Grade 8, Grade 9
#1.14
#1.14

Exactly Three Ones

Counting Grade 8 Grade 9 ★★★☆☆

How many binary strings of length \(10\) contain exactly three ones?

Details
Problem: COM-B1-M01-P014
Difficulty: Level 3 of 5
Tag: Counting
Grade: Grade 8, Grade 9
#1.15
#1.15

At Least \(A\) and \(B\)

Complement method Grade 8 Grade 9 ★★★☆☆

How many words of length \(5\) over \(\{A,B,C\}\) contain at least one \(A\) and at least one \(B\)?

Details
Problem: COM-B1-M01-P015
Difficulty: Level 3 of 5
Tag: Complement method
Grade: Grade 8, Grade 9
#1.16
#1.16

Path Avoiding a Forbidden Point

Complement method Grade 8 Grade 9 ★★★☆☆

How many shortest paths from \((0,0)\) to \((4,3)\), using only right and up moves, do not pass through \((2,1)\)?

Details
Problem: COM-B1-M01-P016
Difficulty: Level 3 of 5
Tag: Complement method
Grade: Grade 8, Grade 9
#1.17
#1.17

Pairs with Even Sum

Parity Grade 8 Grade 9 ★★★☆☆

How many pairs \((a,b)\), where \(1\le a,b\le20\), have even sum?

Details
Problem: COM-B1-M01-P017
Difficulty: Level 3 of 5
Tag: Parity
Grade: Grade 8, Grade 9
#1.18
#1.18

Increasing Digits

Counting Grade 8 Grade 9 ★★★☆☆

How many three-digit numbers have strictly increasing nonzero digits?

Details
Problem: COM-B1-M01-P018
Difficulty: Level 3 of 5
Tag: Counting
Grade: Grade 8, Grade 9
#1.19
#1.19

Five Balls in Three Boxes

Casework Grade 8 Grade 9 ★★★☆☆

In how many ways can \(5\) identical balls be placed into \(3\) distinct boxes so that every box is nonempty?

Details
Problem: COM-B1-M01-P019
Difficulty: Level 3 of 5
Tag: Casework
Grade: Grade 8, Grade 9
#1.20
#1.20

Rectangles in a Grid

Counting Grade 8 Grade 9 ★★★☆☆

How many rectangles can be chosen in a \(4\) by \(5\) grid of cells?

Details
Problem: COM-B1-M01-P020
Difficulty: Level 3 of 5
Tag: Counting
Grade: Grade 8, Grade 9
#1.21
#1.21

Six-Digit Numbers with Even Digit Sum

Digits Grade 8 Grade 9 ★★★★☆

How many six-digit numbers with distinct digits have even digit sum?

Details
Problem: COM-B1-M01-P021
Difficulty: Level 4 of 5
Tag: Digits
Grade: Grade 8, Grade 9
#1.22
#1.22

Subsets with Two Properties

Complement method Grade 8 Grade 9 ★★★★☆

How many subsets of \(\{1,2,\ldots,20\}\) contain at least one even number and at least one multiple of \(5\)?

Details
Problem: COM-B1-M01-P022
Difficulty: Level 4 of 5
Tag: Complement method
Grade: Grade 8, Grade 9
#1.23
#1.23

No Letter Appears Exactly Once

Casework Grade 8 Grade 9 ★★★★☆

How many strings of length \(5\) over \(\{A,B,C,D\}\) have the property that no letter appears exactly once?

Details
Problem: COM-B1-M01-P023
Difficulty: Level 4 of 5
Tag: Casework
Grade: Grade 8, Grade 9
#1.24
#1.24

Permutations Without Adjacent Consecutive Numbers

Permutations Grade 9 ★★★★★

How many permutations of \(1,2,\ldots,8\) have no adjacent elements differing by \(1\)?

Details
Problem: COM-B1-M01-P024
Difficulty: Level 5 of 5
Tag: Permutations
Grade: Grade 9

Ladders

No published ladders were found.
Next Chapter