BCA151 Discrete Structure

Discrete StructureUnit 411 min read

Counting Principles: Rules, Trees & Real-World Applications

Unit 4 of Discrete Structure teaches the fundamental counting principles (addition, multiplication, permutations, combinations) and their applications in combinatorics, including tree diagrams, Pascal’s triangle, and problem-solving strategies with real-world ties to Nepalese tech (e.g., Daraz order queues, Ncell netwo

TAKEAWAYS:

  • Addition Principle: Count either-or scenarios by summing possibilities (e.g., choosing a transport: bus or taxi).
  • Multiplication Principle: Count and scenarios by multiplying choices (e.g., Daraz password: 3 letters and 3 digits).
  • Permutations vs. Combinations: Order matters in permutations (e.g., ranking 3 winners), not in combinations (e.g., selecting 3 friends for a group).
  • Tree Diagrams: Visualize step-by-step choices (e.g., Ncell’s call routing options).
  • Pascal’s Triangle: Generates binomial coefficients for combinations (e.g., NEPSE stock picks).
  • Inclusion-Exclusion: Adjust overcounts in overlapping sets (e.g., counting users on both eSewa and Khalti).

1. The Addition Principle: Counting "Either-Or" Scenarios

Definition: If an event can occur in ways and an event can occur in ways, and and are mutually exclusive (cannot happen simultaneously), then the total number of ways either or occurs is:

How it works:

  • Mutual exclusivity is key: and share no common outcomes.
  • Example: Choosing between bus (5 routes) or taxi (3 companies) to Kathmandu from Pokhara.

Visual:

graph TD
    A["Event A\n(m ways)"] -->|"Option 1"| B1["Outcome 1"]
    A -->|"Option 2"| B2["Outcome 2"]
    C["Event B\n(n ways)"] -->|"Option 1"| D1["Outcome 3"]
    C -->|"Option 2"| D2["Outcome 4"]

Real-World Tie:

  • eSewa Payments: When you pay via either QR code (1 option) or phone number (5 saved contacts), the addition principle counts the total ways to initiate payment:

2. The Multiplication Principle: Counting "And" Scenarios

Definition: If event has outcomes and event has outcomes (independent of ), then the total number of combined outcomes is:

How it works:

  • Independence: Choosing does not restrict .
  • Example: Setting a Daraz account password with:
    • 3 lowercase letters (26 options each)
    • 3 digits (10 options each)

Visual:

Outcome 1 (e.g., ABC123)Outcome 2 (e.g., ABC456)Step 2 (26 letters)Step 1 (26 letters)
Multiplication Principle: 26³ × 10³ = 17,576,000 possible passwords

Real-World Tie:

  • Pathao Ride Options: Choosing a driver (10 available) and a pickup location (3 nearby spots):
  • Ncell SIM Activation: Selecting a plan (4 options) and a data bundle (5 options):

3. Permutations: Order Matters

Definition: A permutation of items taken at a time () is the number of ordered arrangements:

  • Example: Ranking 3 winners (1st, 2nd, 3rd) from 10 contestants:

Visual:

graph TD
    A["10 contestants"] --> B["Choose 1st place\n9 left"]
    B --> C["Choose 2nd place\n8 left"]
    C --> D["Choose 3rd place\n7 left"]

Real-World Tie:

  • NEPSE Stock Picks: If you rank your top 2 stocks from 5 options:
  • Khalti Transaction Codes: A 4-digit code where order matters (e.g., "1234" ≠ "4321"):

4. Combinations: Order Doesn’t Matter

Definition: A combination of items taken at a time () is the number of unordered subsets:

  • Example: Forming a 3-person study group from 10 friends:

Visual:

UABFriend 1, Friend 2, Friend 3, Friend 4, Friend 5, Friend 6, Friend 8, Friend 9, Friend 10
Combination C(10,3): Selecting 3 friends where order doesn’t matter (120 ways)

Real-World Tie:

  • Daraz Product Bundles: Selecting 2 items from 5 in a "Buy 2 Get 1 Free" deal:
  • NTC Bus Routes: Choosing 3 stops from 6 on a Pokhara-Kathmandu route (order irrelevant):

5. Tree Diagrams for Counting

Purpose: Break complex problems into sequential steps. Example: Ncell Network Routing

  • Step 1: Choose a tower (3 options).
  • Step 2: Choose a frequency band (2 options).
  • Total paths:

Visual:

graph TD
    A["Start"] --> B1["Tower 1"]
    A --> B2["Tower 2"]
    A --> B3["Tower 3"]
    B1 --> C1["Band A"]
    B1 --> C2["Band B"]
    B2 --> C3["Band A"]
    B2 --> C4["Band B"]
    B3 --> C5["Band A"]
    B3 --> C6["Band B"]

Worked Example: Problem: How many ways can you order a burger (3 types) with a drink (2 types) and fries (1 type) at a food court? Solution:

  1. Burger: 3 choices.
  2. Drink: 2 choices.
  3. Fries: 1 choice. Total:

6. Inclusion-Exclusion Principle

Definition: For two sets and , the number of elements in is: Example: Counting users on eSewa (500 users) and Khalti (300 users), with 100 users on both:

Visual:

UeSewa users (500)Khalti users (300)4001002000
Inclusion-Exclusion: |A ∪ B| = 500 + 300 − 100 = 700

Real-World Tie:

  • NEPSE Investors: Tracking investors in Merchant Bank (200) and NIBL (150), with 50 in both:

7. Pascal’s Triangle and Binomial Coefficients

Purpose: Generate values for combinations. Rows 0–4:

        1
      1   1
    1   2   1
  1   3   3   1
1   4   6   4   1
  • Entry: is the -th number in the -th row (starting at 0).
  • Example: (from row 4: 1, 4, 6, 4, 1).
012345678910Row 0: 1Row 1: 1 1Row 2: 1 2 1Row 3: 1 3 3 1Row 4: 1 4 6 4 1
Pascal’s Triangle: Binomial coefficients C(n,k) for n=0 to 4

Application:

  • Daraz Discount Combinations: If a product has 5 discounts, the number of ways to choose 2 is .

8. Comparing Permutations and Combinations

Aspect Permutations Combinations
Order Matters (ABC ≠ BAC) Doesn’t matter (ABC = BAC)
Formula
Example Ranking 3 friends Selecting 3 friends for a group
Real-World Use NEPSE stock rankings Khalti transaction pairs

9. Worked Example: Ncell Call Routing

Problem: Ncell has 4 towers in Pokhara. A call can route through:

  1. Any 1 tower.
  2. Any 2 towers (if the first fails). How many possible routing paths are there? Solution:
  3. Single tower: ways.
  4. Two towers: (order matters for backup). Total:

10. Common Pitfalls

  1. Misapplying Addition vs. Multiplication:
    • ❌ Adding for "and" scenarios (e.g., → wrong!).
    • ✅ Multiply: .
  2. Ignoring Order in Combinations:
    • ❌ Using permutations for unordered groups (e.g., for a 2-person team).
    • ✅ Use .
  3. Overcounting in Inclusion-Exclusion:
    • Forgetting to subtract the overlap .
UPermutations (order matters)Combinations (order ignored)ABC, ACB, BAC, BCA, CAB, CBANoneABCNone
Pitfall: Permutations vs. Combinations (6 vs. 1 way to choose ABC)

In the Real World

  1. eSewa/Khalti Payments:

    • Idea: Addition Principle for payment methods (QR or phone number).
    • How: If you have 1 QR code and 4 saved contacts, total ways to pay:
  2. Daraz Order Fulfillment:

    • Idea: Multiplication Principle for order combinations.
    • How: Choosing 1 product from 10 categories and 1 shipping option (standard/express):
  3. Ncell Network Optimization:

    • Idea: Permutations for call routing redundancy.
    • How: If a call can retry via 2 backup towers, the number of ordered backup paths is .
  4. NEPSE Stock Analysis:

    • Idea: Combinations for portfolio selection.
    • How: An investor picking 3 stocks from 10 options:
  5. Pathao Driver Assignment:

    • Idea: Inclusion-Exclusion for overlapping ride requests.
    • How: If 50 users request rides in Thapathali and 30 in Lakshmi Chowk, with 10 requesting both, total unique requests:

Exam Tip

  1. Spot Keywords:

    • "Either...or" → Addition Principle.
    • "And" → Multiplication Principle.
    • "Order matters" → Permutations.
    • "Group/team" → Combinations.
    • "Overlap/both" → Inclusion-Exclusion.
  2. Draw Diagrams:

    • Always sketch a tree diagram for sequential choices (e.g., password creation, routing).
    • Use Venn diagrams for inclusion-exclusion problems.
  3. Unit Consistency:

    • Ensure answers are in the same unit (e.g., permutations vs. combinations).
    • Double-check factorial calculations (e.g., , not 60).
  4. Real-World Links:

    • Examiners love ties to Nepalese tech. Mention eSewa, Daraz, or Ncell in explanations to stand out.
  5. Common Exam Questions:

    • Calculate or for given .
    • Solve word problems using tree diagrams (e.g., "How many ways can you...").
    • Apply inclusion-exclusion to user/data overlaps (e.g., "How many unique users...").

Final Note: Combinatorics is the backbone of algorithm design (e.g., sorting, hashing) and probability. Master these principles, and you’ll ace problems in graph theory (Unit 6), recurrence relations (Unit 9), and even database query optimization in later semesters. Practice with Nepalese examples—they make the concepts stick!

Based on the TU BCA syllabus for Discrete Structure (BCA151), unit 4.

Discussion

Loading…