ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Discrete Structures
    GE-167
    Progress0 / 67 topics
    Topics
    1. Mathematical Reasoning: Propositional and Predicate Logic2. Propositional Logic: Logical Operators3. Translations Between Symbolic Expressions and Formal English Expression4. Logical Equivalences5. Predicate Logic: Quantifiers6. Nested Quantification7. Equivalences in Predicate Logic8. Translations Between Symbolic Forms and Formal English9. Rules of Inference: Proof Methods and Strategies10. Direct Proof11. Proof by Contraposition12. Proof by Induction13. Proof by Implication14. Existence Proof15. Uniqueness Proofs16. Trivial Proofs17. Vacuous Proofs18. Sets: Notations and Set Operations19. Venn Diagrams20. Countable and Uncountable Sets21. Relations: Equivalence Relations and Partitions22. Partial Orderings23. Recurrence Relations24. Functions: Injective, Surjective, Bijective25. Special Types of Functions26. Function Composition27. Inverse Functions28. Recursive Functions29. Compositions30. Number Theory: Sequences and Series31. Counting: Inclusion and Exclusion Principle32. Pigeonhole Principle33. Permutations and Combinations34. Integers and Divisibility: Division Theorem35. Modular Arithmetic36. LCM and GCD37. Euclidean and Extended Euclidean Method38. Finding Solutions to Congruence39. Primes: Fundamental Theorem of Arithmetic40. Characterizations of Primes41. Mersenne Primes42. Induction: Weak Induction43. Strong Induction44. Recursion and Recurrences: Formulation of Recurrences45. Closed Formulas46. Counting: Product Rule and Sum Rule47. Principle of Inclusion-Exclusion48. Binomial Coefficients49. Pascal's Identity and Pascal’s Triangle50. Binomial Theorem51. Relations: Reflexive, Symmetric, Transitive, and Antisymmetric52. Equivalence Relations and Equivalence Classes53. Partial Orders54. Graph Theory: Terminologies55. Elements of Graph Theory56. Planar Graphs57. Graph Coloring58. Euler Graph59. Hamiltonian Path60. Rooted Trees61. Graph Traversals62. Handshaking Lemma and Corollary63. Special Families of Graphs64. Graph Isomorphism65. Planarity in Graphs66. Eulerian and Hamiltonian Graphs67. Trees in Graph Theory
    GE-167›Principle of Inclusion-Exclusion
    Discrete StructuresTopic 47 of 67

    Principle of Inclusion-Exclusion

    10 minread
    1,711words
    Intermediatelevel

    Principle of Inclusion-Exclusion

    The Principle of Inclusion-Exclusion (PIE) is a fundamental combinatorial method used to count the number of elements in the union of multiple sets when those sets may overlap. It provides a way to account for the overlap between sets and ensure that elements are counted the correct number of times.

    The principle is especially useful in situations where you want to find the total number of elements in the union of several sets, but some elements are counted more than once due to overlaps between the sets.

    Basic Idea

    The general idea behind the inclusion-exclusion principle is:

    1. Start by including all elements from the sets you are interested in (counting every element in each set).
    2. Subtract the overlap between pairs of sets to avoid counting those elements multiple times.
    3. Add back the overlap between triples of sets (since elements from three sets were subtracted too much in step 2).
    4. Continue this process, alternating adding and subtracting, for all possible overlaps among the sets.

    General Formula

    For two sets AAA and BBB, the principle of inclusion-exclusion can be stated as:

    ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|∣A∪B∣=∣A∣+∣B∣−∣A∩B∣

    Where:

    • ∣A∪B∣|A \cup B|∣A∪B∣ is the number of elements in the union of sets AAA and BBB.
    • ∣A∣|A|∣A∣ is the number of elements in set AAA.
    • ∣B∣|B|∣B∣ is the number of elements in set BBB.
    • ∣A∩B∣|A \cap B|∣A∩B∣ is the number of elements in the intersection of sets AAA and BBB (i.e., elements common to both sets).

    This formula ensures that elements in A∩BA \cap BA∩B are not counted twice.

    For three sets AAA, BBB, and CCC, the formula is extended as:

    ∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣B∩C∣−∣A∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |B \cap C| - |A \cap C| + |A \cap B \cap C|∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣B∩C∣−∣A∩C∣+∣A∩B∩C∣

    Where:

    • The first three terms count the elements in each of the sets.
    • The next three terms subtract the overlaps of pairs of sets (because these elements were counted twice).
    • The last term adds back the intersection of all three sets (because these elements were subtracted too many times).

    For nnn sets, the general formula for the principle of inclusion-exclusion is:

    ∣A1∪A2∪⋯∪An∣=∑i=1n∣Ai∣−∑1≤i<j≤n∣Ai∩Aj∣+∑1≤i<j<k≤n∣Ai∩Aj∩Ak∣−⋯+(−1)n+1∣A1∩A2∩⋯∩An∣|A_1 \cup A_2 \cup \dots \cup A_n| = \sum_{i=1}^{n} |A_i| - \sum_{1 \leq i < j \leq n} |A_i \cap A_j| + \sum_{1 \leq i < j < k \leq n} |A_i \cap A_j \cap A_k| - \dots + (-1)^{n+1} |A_1 \cap A_2 \cap \dots \cap A_n|∣A1​∪A2​∪⋯∪An​∣=i=1∑n​∣Ai​∣−1≤i<j≤n∑​∣Ai​∩Aj​∣+1≤i<j<k≤n∑​∣Ai​∩Aj​∩Ak​∣−⋯+(−1)n+1∣A1​∩A2​∩⋯∩An​∣

    Where the summations alternate between adding and subtracting the sizes of intersections of increasing numbers of sets.

    Steps for Applying Inclusion-Exclusion

    1. Identify the sets you are working with and what you want to count.
    2. Start with the size of each individual set, summing them up.
    3. Subtract the size of pairwise intersections to account for elements that have been counted twice.
    4. Add the size of triple intersections, as these elements were subtracted too much in the previous step.
    5. Continue the process for intersections of higher numbers of sets, alternating between subtracting and adding the sizes of the intersections.
    6. Finally, you will have the correct count for the union of the sets.

    Example 1: Counting the Number of Students in a Class

    Suppose in a class of 30 students:

    • 15 students play basketball.
    • 12 students play soccer.
    • 10 students play both basketball and soccer.

    How many students play either basketball or soccer?

    Let:

    • AAA be the set of students who play basketball.
    • BBB be the set of students who play soccer.

    We are interested in the number of students in A∪BA \cup BA∪B, which represents students who play basketball or soccer. Using the inclusion-exclusion principle:

    ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|∣A∪B∣=∣A∣+∣B∣−∣A∩B∣

    Substituting the given values:

    ∣A∪B∣=15+12−10=17|A \cup B| = 15 + 12 - 10 = 17∣A∪B∣=15+12−10=17

    So, 17 students play either basketball or soccer.

    Example 2: Generalizing to Three Sets

    Consider a situation where:

    • There are 50 people at a party.
    • 30 people drink coffee.
    • 20 people drink tea.
    • 10 people drink both coffee and tea.
    • 5 people drink coffee, tea, and juice.

    We want to know how many people drink either coffee, tea, or juice.

    Let:

    • AAA be the set of people who drink coffee.
    • BBB be the set of people who drink tea.
    • CCC be the set of people who drink juice.

    We want to find ∣A∪B∪C∣|A \cup B \cup C|∣A∪B∪C∣, the total number of people who drink coffee, tea, or juice.

    Using the inclusion-exclusion principle for three sets:

    ∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣B∩C∣−∣A∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |B \cap C| - |A \cap C| + |A \cap B \cap C|∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣B∩C∣−∣A∩C∣+∣A∩B∩C∣

    Substituting the given values:

    • ∣A∣=30|A| = 30∣A∣=30, ∣B∣=20|B| = 20∣B∣=20, ∣C∣=50|C| = 50∣C∣=50
    • ∣A∩B∣=10|A \cap B| = 10∣A∩B∣=10 (people who drink both coffee and tea)
    • ∣B∩C∣=0|B \cap C| = 0∣B∩C∣=0 (no one drinks both tea and juice)
    • ∣A∩C∣=0|A \cap C| = 0∣A∩C∣=0 (no one drinks both coffee and juice)
    • ∣A∩B∩C∣=5|A \cap B \cap C| = 5∣A∩B∩C∣=5 (people who drink coffee, tea, and juice)

    Now we compute:

    ∣A∪B∪C∣=30+20+50−10−0−0+5=95|A \cup B \cup C| = 30 + 20 + 50 - 10 - 0 - 0 + 5 = 95∣A∪B∪C∣=30+20+50−10−0−0+5=95

    Thus, 95 people drink either coffee, tea, or juice.

    Applications of Inclusion-Exclusion

    The principle of inclusion-exclusion is widely used in many areas, including:

    1. Counting Problems: Calculating the number of elements in the union of several sets.
    2. Probability Theory: Computing the probability of the union of events, particularly when events are not mutually exclusive.
    3. Set Theory: Understanding the relationships between multiple sets and their intersections.
    4. Graph Theory: Counting paths, cycles, or other structures in graphs with multiple conditions.
    5. Algorithm Analysis: Determining the complexity of algorithms that involve multiple subproblems or components.

    Conclusion

    The Principle of Inclusion-Exclusion is a powerful combinatorial tool used to correctly count the elements in the union of multiple sets by considering the overlaps between them. It ensures that elements are not counted multiple times and provides an efficient way to compute set sizes in complex problems involving intersections of sets.

    Previous topic 46
    Counting: Product Rule and Sum Rule
    Next topic 48
    Binomial Coefficients

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time10 min
      Word count1,711
      Code examples0
      DifficultyIntermediate