CSC165 Discrete Structure

Discrete StructureUnit 126 min read

Inclusion-Exclusion Principle & Advanced Counting Techniques

Unit 12 of Discrete Structure covers the Inclusion-Exclusion Principle (IEP) for precise counting in overlapping sets, the Pigeonhole Principle (PP) and its generalized form, and advanced combinatorial applications including floor/ceiling functions, recurrence relations, and problem-solving strategies.

1. Floor and Ceiling Functions

1.1 Definitions

  • Floor function : Largest integer ≤ . Example: , .
  • Ceiling function : Smallest integer ≥ . Example: , .

1.2 When

This equality holds only if is an integer. Proof:

  • If , both functions return .
  • If , .

1.3 Applications

  • Discrete mathematics: Used in counting lattice points, algorithm analysis (e.g., time complexity).
  • Computer science: Rounding in programming (e.g., math.floor() in Python).

2. Pigeonhole Principle (PP)

2.1 Statement

If items are placed into containers, with , then at least one container holds ≥ 2 items.

2.2 Generalized Pigeonhole Principle (GPP)

For items and containers, the minimum number of items in the most crowded container is: Example: Among 11 integers, at least share the same last digit (PP).

2.3 Proof of GPP

Assume the opposite: all containers have ≤ items. Then total items ≤ . If , contradiction arises.

2.4 Applications

  • Collisions in hashing: Guarantees hash collisions if load factor > 1.
  • Graph theory: Proves existence of edges/vertices with shared properties.
  • Number theory: Shows non-unique representations (e.g., modulo operations).

3. Inclusion-Exclusion Principle (IEP)

3.1 Statement for Two Sets

For finite sets and : Example: Count integers from 1 to 30 divisible by 2 or 3.

  • (multiples of 2).
  • (multiples of 3).
  • (multiples of 6).
  • Result: .

3.2 Generalized IEP for Sets

For sets : Example: Count numbers ≤ 30 divisible by 2, 3, or 5.

  • , , .
  • , , .
  • .
  • Result: .

3.3 Why Use IEP?

  • Avoids overcounting: Correctly accounts for overlaps in unions.
  • Efficiency: Simplifies complex counting problems (e.g., derangements, lattice points).

3.4 Comparison: IEP vs. PP

Feature Inclusion-Exclusion Principle Pigeonhole Principle
Purpose Count elements in unions/intersections Prove existence of duplicates
Formula Type Summation with alternating signs Inequality ()
Use Case Overlapping sets, divisibility Hashing, graph coloring, collisions
Complexity Higher for sets Simple, intuitive

4. Advanced Counting Techniques

4.1 Counting with Restrictions

Example: Count 3-digit numbers where digits are distinct and even.

  • Digits: 2, 4, 6, 8 (4 choices for hundreds).
  • Tens: 3 remaining even digits.
  • Units: 2 remaining digits.
  • Total: .

IEP is used to solve recurrences via generating functions or characteristic equations. Example: Solve with , .

  • Characteristic equation: → .
  • Solution: .
  • Initial conditions:
    • .
    • .
  • Result: , → .

5. Applications in Computer Science

5.1 Hashing and Collisions

  • PP guarantees collisions in hash tables if .
  • IEP refines collision counts for multiple hash functions.

5.2 Graph Theory

  • Edge counting: IEP counts paths/edges in overlapping subgraphs.
  • Ramsey Theory: PP proves monochromatic subgraphs.

5.3 Probability

  • IEP calculates probabilities of union events:

Exam Tip

Common Pitfalls

  1. Misapplying IEP: Forgetting to alternate signs or missing intersections.
    • Fix: Write the formula explicitly for sets.
  2. PP overuse: Assuming PP applies when .
    • Fix: Verify before concluding.
  3. Floor/Ceiling errors: Confusing and .
    • Fix: Test with non-integer values (e.g., ).

High-Score Strategies

  • For IEP problems:
    • Draw Venn diagrams for .
    • Use symmetry to simplify intersections (e.g., ).
  • For PP problems:
    • State the generalized form if is not a multiple of .
    • Link to real-world examples (e.g., "In a room of 367 people, at least two share a birthday").
  • For floor/ceiling:
    • Always check if is integer for equality cases.
    • Relate to programming (e.g., array indexing).

Past Exam Patterns

  • Definition-based (5 marks): Expect questions on PP/IEP statements.
  • Application-based (10 marks): Solve counting problems using IEP or PP.
  • Proof-based (5 marks): Prove PP or derive IEP for .

Key Formula Summary

Concept Formula
Floor function
Ceiling function
Pigeonhole Principle
Generalized PP
Inclusion-Exclusion (2 sets)
Inclusion-Exclusion (n sets) Alternating sum of intersections

Based on the TU BSc CSIT syllabus for Discrete Structure (CSC165), unit 12.

Discussion

Loading…