BIT152 Discrete Structure

Discrete StructureUnit 47 min read

Counting Principles, Permutations, Combinations & Advanced Techniques

Unit 4 of Discrete Structure covers fundamental counting principles (addition/multiplication), permutations/combinations with/without repetition, advanced techniques (inclusion-exclusion, generating functions), and real-world applications in algorithms, cryptography, and probability.

TAKEAWAYS:

  • Counting Basics: The Addition Principle (OR) and Multiplication Principle (AND) solve disjoint vs. sequential counting problems.
  • Permutations vs. Combinations: Permutations () order matters; combinations () do not—use factorials () to compute.
  • Advanced Techniques: Inclusion-Exclusion Principle (for overlapping sets) and Generating Functions (for complex counting problems).
  • Real-World Links: Used in Nepal’s Ncell (call routing), Daraz (order fulfillment), and Khalti (transaction security).
  • Exam Focus: Prove counting formulas, solve word problems, and distinguish between scenarios requiring permutations vs. combinations.

1. Fundamental Counting Principles

1.1 Addition Principle (OR Rule)

Definition: If a task can be done in ways or in ways, and these ways are mutually exclusive, the total number of ways is .

Example:

  • Scenario: You can reach Kathmandu from Pokhara by bus (5 routes) or flight (3 routes). How many total ways?
  • Solution: (since bus and flight routes are distinct).
  • Visual:
    flowchart TD
      A["Start"] --> B["Bus: 5 ways"]
      A --> C["Flight: 3 ways"]
      B --> D["Kathmandu"]
      C --> D

Real-World Tie-In:

  • eSewa: When you pay bills, you choose online (credit/debit card) or offline (bank counter). The Addition Principle counts total payment methods.

1.2 Multiplication Principle (AND Rule)

Definition: If a task requires sequential steps, where the step has options, the total number of ways is the product of all options: .

Example:

  • Scenario: A Daraz order has:
    • 3 product choices,
    • 2 shipping methods,
    • 4 payment options.
  • Solution: total possible orders.
  • Visual:
    flowchart TD
      A["Order"] --> B["Product: 3"]
      B --> C["Shipping: 2"]
      C --> D["Payment: 4"]
      D --> E["Total: 24"]

Real-World Tie-In:

  • Ncell: Your 10-digit phone number is assigned by:
    • 7-digit prefix (e.g., 98xxxxxx),
    • 3-digit suffix (000–999). Total possible numbers: (though not all are used).

2. Permutations and Combinations

2.1 Permutations (): Order Matters

Definition: The number of ways to arrange items from distinct items where order is important. Formula:

Example:

  • Scenario: How many ways can 3 friends (A, B, C) stand in a line for a Pathao ride?
  • Solution:
  • Visual:
    flowchart TD
      A["ABC"] --> B["ACB"]
      A --> C["BAC"]
      A --> D["BCA"]
      A --> E["CAB"]
      A --> F["CBA"]

Real-World Tie-In:

  • NEPSE: Stock traders care about the order of trades. If you buy 3 stocks (A, B, C), the sequence matters for tax calculations.

2.2 Combinations (): Order Doesn’t Matter

Definition: The number of ways to choose items from without regard to order. Formula:

Example:

  • Scenario: How many ways can you pick 2 fruits from 3 (apple, banana, orange) for a snack?
  • Solution:
  • Visual:
    flowchart TD
      A["Apple + Banana"] --> B["Apple + Orange"]
      A --> C["Banana + Orange"]

Real-World Tie-In:

  • Khalti: When you transfer money to 2 friends out of 5, the order doesn’t matter—only the group does.

2.3 Permutations vs. Combinations: Comparison Table

Feature Permutations () Combinations ()
Order Matters? Yes No
Formula
Example Passwords, races, rankings Lottery picks, committees
Real-World Use Ncell call routing (order of digits) Daraz customer feedback groups

3. Advanced Counting Techniques

3.1 Inclusion-Exclusion Principle

Definition: Counts the number of elements in overlapping sets without double-counting. Formula (for 2 sets): Example:

  • Scenario: In a class of 30 students:
    • 18 like math,
    • 12 like physics,
    • 5 like both.
  • Solution:
  • Visual:

Real-World Tie-In:

  • NTC: Counting subscribers who use both landline and mobile services without duplication.

3.2 Generating Functions (Introductory)

Definition: A formal power series where coefficients represent counts of combinations. Example:

  • Scenario: Count the number of ways to make ₹5 using ₹1 and ₹2 coins.
  • Solution:
    • Let represent ₹1, represent ₹2.
    • Generating function: .
    • Coefficient of gives the count (here, 3 ways: 5×₹1, 2×₹2+₹1, 1×₹2+3×₹1).

Visual:

graph LR
  A["₹1 coins"] --> B["₹2 coins"]
  B --> C["Total: ₹5"]

Real-World Tie-In:

  • Daraz: Calculating discount combinations (e.g., 10% off + free shipping) for orders.

4. Recursive Counting and Trees

4.1 Recursive Definitions

Definition: A problem defined in terms of smaller versions of itself. Example:

  • Scenario: Count the number of binary trees with nodes.
  • Solution:
    • Base case: 1 tree for (empty tree).
    • Recursive step: For nodes, choose a root (1 ≤ ≤ ), then combine left and right subtrees.
    • Formula: .

Visual:

Real-World Tie-In:

  • WhatsApp: Message thread hierarchies (replies form recursive trees).

Exam Tip

  1. Memorize Formulas:

    • Inclusion-Exclusion:
  2. Practice Word Problems:

    • Permutation: "Arrange," "order," "rank."
    • Combination: "Choose," "select," "group."
  3. Draw Diagrams:

    • Use Venn diagrams for inclusion-exclusion.
    • Use trees for recursive counting.
  4. Real-World Scenarios:

    • Ncell: Phone number generation (Multiplication Principle).
    • Khalti: Transaction groups (Combinations).
    • Daraz: Order fulfillment (Permutations).
  5. Common Pitfalls:

    • Forgetting order matters in permutations.
    • Misapplying inclusion-exclusion (overlapping sets).
    • Confusing with/without repetition in combinations.

binary tree structureA labelled binary tree showing recursive node splitting. (Image: Public domain, via Wikimedia Commons) Venn diagram with three setsOverlapping circles for inclusion-exclusion. (Image: Sommacal alfonso, CC BY-SA 3.0, via Wikimedia Commons)

Based on the TU BIT syllabus for Discrete Structure (BIT152), unit 4.

Discussion

Loading…