Discrete StructureUnit 49 min read
Counting Techniques: Permutations, Combinations, Inclusion-Exclusion & Advanced Counting
Unit 4 of Discrete Structure covers fundamental counting principles (addition/multiplication rules), permutations/combinations, advanced techniques (inclusion-exclusion, generating functions), and real-world applications in scheduling, cryptography, and network routing.
TAKEAWAYS:
- Counting rules solve problems by breaking them into independent/dependent choices (addition vs. multiplication).
- Permutations count ordered arrangements (e.g., passwords, race rankings), while combinations count unordered selections (e.g., lottery numbers, committee members).
- Inclusion-Exclusion Principle corrects overcounting in overlapping sets (e.g., counting students in multiple clubs).
- Generating functions encode combinatorial problems as polynomials for elegant solutions (e.g., counting change combinations).
- Pigeonhole Principle proves existence via counting (e.g., "at least two people share a birthday in a room of 23").
- Real-world ties: Pathao’s ride-matching uses permutations for driver assignments; Ncell’s network routing relies on counting paths in graphs.
1. Fundamental Counting Principles
1.1 Addition Rule (Disjoint Events)
Definition: If two events and are mutually exclusive (cannot occur simultaneously), the number of ways either can happen is:
Visual:
Example: Counting ways to fail an exam (either by missing the test or getting <40%).
- Let = "missed test" (2 students), = "scored <40%" (3 students).
- Total failures: .
Real World:
- eSewa: Counting failed transactions (either "network error" or "insufficient balance").
- NTC: Counting delayed buses (either "mechanical failure" or "driver strike").
1.2 Multiplication Rule (Independent Choices)
Definition: If one event has outcomes and another has outcomes, the total combinations are:
Visual:
graph LR
A["Choice 1: 3 options"] --> B["Choice 2: 4 options"]
B --> C["Total: 3 × 4 = 12 paths"]Example: Counting license plates with 2 letters followed by 3 digits.
- Letters: combinations.
- Digits: combinations.
- Total plates: .
Real World:
- Khalti: Generating unique transaction IDs (e.g., 4 letters + 6 digits).
- Daraz: Counting possible product SKUs (category × subcategory × variant).
2. Permutations and Combinations
2.1 Permutations (Order Matters)
Definition: Arrangements of items from distinct items where order is important.
Visual:
Example: Ranking top 3 students from 10.
Real World:
- Pathao: Assigning 3 drivers to 5 available slots (order matters for efficiency).
- NEPSE: Ranking stocks by daily volume (permutation of top 10 from 100).
2.2 Combinations (Order Doesn’t Matter)
Definition: Selections of items from without regard to order.
Visual:
Example: Choosing 2 subjects from 5.
Real World:
- Ncell: Selecting 4 base stations to cover a city (order irrelevant).
- Lotto: Picking 6 numbers from 49 (combinations, not permutations).
3. Inclusion-Exclusion Principle
Definition: Corrects overcounting when sets overlap. For two sets: For three sets:
Visual:
Example: Counting students in at least one club (Math, Chess, Debate).
- Math: 30, Chess: 25, Debate: 20
- Math ∩ Chess: 10, Math ∩ Debate: 8, Chess ∩ Debate: 5
- Math ∩ Chess ∩ Debate: 3
Real World:
- Khalti: Counting users with either a savings account or a loan (but not double-counting overlaps).
- NTC: Counting buses delayed by either rain or strikes (but not both).
4. Advanced Counting Techniques
4.1 Generating Functions
Definition: Polynomials where coefficients represent counts. Example: Counting ways to make ₹10 with ₹2 and ₹5 coins. Generating function: Coefficient of gives the answer (3 ways).
Visual:
Real World:
- Daraz: Counting possible discount combinations (e.g., 10% off + free shipping).
- Ncell: Counting data plans with bundled minutes/calls.
4.2 Pigeonhole Principle
Definition: If items are placed into containers (), at least one container holds ≥2 items.
Example: In a room of 23 people, at least two share a birthday.
Real World:
- Pathao: With 101 drivers and 100 zones, at least one zone has ≥2 drivers (by Pigeonhole).
- NTC: With 500 buses and 499 stops, at least one stop has ≥2 buses.
5. Worked Example: Kathmandu Traffic Routes
Problem: How many ways can a taxi travel from Thamel to Lakshmi Chowk via exactly 2 intermediate stops (order matters)?
- Stops: Thamel (T), Durbar Square (D), Asan (A), Koteshwor (K), Lakshmi Chowk (L).
- Intermediate stops: Choose 2 from {D, A, K}, then arrange them.
Solution:
- Combination step: Choose 2 stops from 3.
- Permutation step: Arrange the 2 stops (order matters).
- Total paths: .
Visual:
graph TD
T --> D --> A --> L
T --> D --> K --> L
T --> A --> D --> L
T --> A --> K --> L
T --> K --> D --> L
T --> K --> A --> L6. Comparison Table: Permutations vs. Combinations
| Feature | Permutations () | Combinations () |
|---|---|---|
| Order matters? | Yes | No |
| Formula | ||
| Example | Passwords, rankings | Lottery numbers, committees |
| Real-world use | Pathao driver assignments | Ncell base station selection |
7. Common Mistakes to Avoid
- Confusing permutations/combinations: Remember "permutation = order," "combination = group."
- Ignoring dependencies: Multiplication rule applies only to independent choices.
- Overcounting in inclusion-exclusion: Always subtract pairwise intersections, then add back triple intersections.
- Factorial errors: , and .
In the Real World
Pathao’s Ride-Matching Algorithm:
- Uses permutations to assign drivers to requests based on proximity (order of pickup matters for efficiency).
- Example: If 5 drivers are available for 3 requests, the system calculates possible assignments.
Ncell’s Network Routing:
- Employs combinations to select optimal base stations for coverage (order irrelevant).
- Example: Covering a city with 4 base stations from 10 available: possible combinations.
Khalti’s Transaction IDs:
- Generates unique IDs using the multiplication rule (e.g., 4 letters × 6 digits = possibilities).
- Example: A transaction ID like
ABCD123456ensures uniqueness via combinatorial design.
NEPSE Stock Rankings:
- Uses permutations to rank top 10 stocks by trading volume (order matters for investors).
- Example: Ranking 5 stocks from 10: possible orderings.
Daraz’s Inventory Management:
- Applies the Pigeonhole Principle to ensure no product runs out of stock in all warehouses.
- Example: With 100 products and 5 warehouses, at least one warehouse must stock ≥20 products.
Exam Tip
Spot the key phrase:
- "Arranged in a line" → Permutation.
- "Selected as a team" → Combination.
- "At least one" → Inclusion-Exclusion.
Show all steps:
- For or , write the formula and simplify.
- For inclusion-exclusion, draw a Venn diagram and label all regions.
Real-world twist:
- Exams often ask: "How many ways can Pathao assign 3 drivers to 5 requests?" → .
- Or: "How many Ncell base station pairs cover a city?" → .
Avoid memorization:
- Focus on why you multiply/divide (e.g., "divide by because order doesn’t matter").
Practice with variations:
- "At least one" → Use inclusion-exclusion.
- "Exactly one" → Use .
Final Note: Combinatorics is about logical breakdown. Break problems into smaller, independent choices, and let the rules guide you!
Based on the TU BITM syllabus for Discrete Structure (IT235), unit 4.
Discussion
Loading…