IT235 Discrete Structure

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:

UABA₁, A₂, A₃, A₄, A₅B₁, B₂, B₃
|A ∪ B| = |A| + |B| = 5 + 3 = 8 (disjoint sets)

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:

A0B1C2
Permutations of {A, B, C} (order matters): 3! = 6 arrangements

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:

UABA, B, C, D
Combinations: {A,B,C,D} choose 2 = 6 (order ignored)

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:

UABCA₁, A₂, A₃B₁, B₂, B₃C₁, C₂A₄
|A ∪ B ∪ C| = |A| + |B| + |C| − |A∩B| − |A∩C| − |B∩C| + |A∩B∩C|

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:

-1-0.50.511.52-300-200-100100xyG(x) = (1 + x² + x⁴)(1 + x⁵ + x¹⁰)Coefficient of x¹⁰ = 3
Generating function: 3 ways to make 10 (2+2+5+1, 2+5+2+1, 5+5)

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.

UHolesPigeonsP₁,P₂,P₃,P₄,P₅H₁,H₂
Pigeonhole Principle: 5 pigeons → 2 holes → at least ⌈5/2⌉ = 3 pigeons share a hole

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:

  1. Combination step: Choose 2 stops from 3.
  2. Permutation step: Arrange the 2 stops (order matters).
  3. 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 --> L

6. 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

  1. Confusing permutations/combinations: Remember "permutation = order," "combination = group."
  2. Ignoring dependencies: Multiplication rule applies only to independent choices.
  3. Overcounting in inclusion-exclusion: Always subtract pairwise intersections, then add back triple intersections.
  4. Factorial errors: , and .

In the Real World

  1. 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.
  2. 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.
  3. Khalti’s Transaction IDs:

    • Generates unique IDs using the multiplication rule (e.g., 4 letters × 6 digits = possibilities).
    • Example: A transaction ID like ABCD123456 ensures uniqueness via combinatorial design.
  4. 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.
  5. 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

  1. Spot the key phrase:

    • "Arranged in a line" → Permutation.
    • "Selected as a team" → Combination.
    • "At least one" → Inclusion-Exclusion.
  2. Show all steps:

    • For or , write the formula and simplify.
    • For inclusion-exclusion, draw a Venn diagram and label all regions.
  3. 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?" → .
  4. Avoid memorization:

    • Focus on why you multiply/divide (e.g., "divide by because order doesn’t matter").
  5. 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…