Combinatorics & Probability · Combinatorics
Basic Counting Principles (Rule of Product and Rule of Sum)
Explanation
Intuition: Why do we count?
In combinatorics, our goal is to find the size of a finite set without explicitly listing all its elements. This is the foundation for algorithmic time complexity analysis (how many operations will be executed?) and probability theory (what is the sample space?). The two most fundamental tools are the Rule of Sum and the Rule of Product.
The Rule of Sum (Addition Principle)
Theorem: If a task can be done in one of ways, or in one of other ways, and none of the set of ways is the same as any of the set of ways (they are mutually exclusive), then there are ways to do the task.
Formal Definition:
Let and be two finite, disjoint sets (i.e., ). Then:
Edge Case - Non-disjoint sets:
If the actions can happen simultaneously (), the simple rule of sum fails, and we must use the Principle of Inclusion-Exclusion:
The Rule of Product (Multiplication Principle)
Theorem: If a procedure can be broken down into two successive stages, where the first stage can be performed in ways, and for each of these ways, the second stage can be performed in ways, then the entire procedure can be performed in ways.
Formal Definition:
For sets and , the size of their Cartesian product (the set of all ordered pairs) is the product of their sizes:
**Generalization to stages:**
If a process requires stages, and stage can be done in ways, the total number of ways is .
Visual UI Concept (Idea)
- Rule of Product: Best visualized using a Tree Diagram. Each node branches out according to the number of choices in the next stage. Counting the final leaves gives the product.- Rule of Sum: Visualized as two distinct "bins" of items that cannot be mixed, counting the total number of items collectively.
Interactive Visualization
Loading visualization
Worked Examples
Practice
Exercise 1 of 5
1
When we need to choose an element from set or set (assuming disjoint sets), which principle should we use?
★Quiz
Test your knowledge from this lesson
A mix of questions from the lesson — each attempt varies slightly
Answer at least 4 out of 5 questions correctly to pass (70%)