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›Counting: Inclusion and Exclusion Principle
    Discrete StructuresTopic 31 of 67

    Counting: Inclusion and Exclusion Principle

    12 minread
    2,075words
    Intermediatelevel

    Counting: Inclusion and Exclusion Principle

    The Inclusion-Exclusion Principle is a fundamental concept in combinatorics and counting, helping to calculate the size of the union of multiple sets when the sets have overlapping elements. This principle is especially useful in problems involving overlapping sets, where simply adding up the sizes of individual sets would overcount the elements that are shared by multiple sets.

    The Inclusion-Exclusion Principle allows us to account for the overlap in a systematic way by subtracting the overcounted elements from the total.


    1. Basic Principle of Inclusion and Exclusion

    Given two sets AAA and BBB, the number of elements in their union (denoted as ∣A∪B∣|A \cup B|∣A∪B∣) is calculated by adding the sizes of the individual sets and then subtracting the size of their intersection (since the elements in the intersection were counted twice). This is the basic idea of the Inclusion-Exclusion Principle:

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

    Where:

    • ∣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 common to both sets AAA and BBB.

    Example:

    Suppose we have:

    • A={1,2,3,4}A = \{1, 2, 3, 4\}A={1,2,3,4}, so ∣A∣=4|A| = 4∣A∣=4,
    • B={3,4,5,6}B = \{3, 4, 5, 6\}B={3,4,5,6}, so ∣B∣=4|B| = 4∣B∣=4,
    • The intersection A∩B={3,4}A \cap B = \{3, 4\}A∩B={3,4}, so ∣A∩B∣=2|A \cap B| = 2∣A∩B∣=2.

    Then the number of elements in A∪BA \cup BA∪B is:

    ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣=4+4−2=6.|A \cup B| = |A| + |B| - |A \cap B| = 4 + 4 - 2 = 6.∣A∪B∣=∣A∣+∣B∣−∣A∩B∣=4+4−2=6.

    Thus, the union A∪B={1,2,3,4,5,6}A \cup B = \{1, 2, 3, 4, 5, 6\}A∪B={1,2,3,4,5,6} has 6 elements.


    2. Generalized Inclusion-Exclusion Principle

    The principle can be extended to more than two sets. The generalized Inclusion-Exclusion formula for three sets AAA, BBB, and CCC is as follows:

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

    This formula accounts for:

    1. Adding the sizes of the individual sets AAA, BBB, and CCC.
    2. Subtracting the sizes of the pairwise intersections A∩BA \cap BA∩B, A∩CA \cap CA∩C, and B∩CB \cap CB∩C to avoid double-counting the elements that are in more than one set.
    3. Adding back the size of the intersection of all three sets, A∩B∩CA \cap B \cap CA∩B∩C, because it was subtracted three times (once for each pairwise intersection) and must be added back.

    Example:

    Suppose we have:

    • A={1,2,3,4}A = \{1, 2, 3, 4\}A={1,2,3,4},
    • B={3,4,5,6}B = \{3, 4, 5, 6\}B={3,4,5,6},
    • C={4,5,6,7}C = \{4, 5, 6, 7\}C={4,5,6,7}.

    The intersections are:

    • ∣A∩B∣=2|A \cap B| = 2∣A∩B∣=2 (common elements: 3,43, 43,4),
    • ∣A∩C∣=1|A \cap C| = 1∣A∩C∣=1 (common element: 444),
    • ∣B∩C∣=2|B \cap C| = 2∣B∩C∣=2 (common elements: 4,54, 54,5),
    • ∣A∩B∩C∣=1|A \cap B \cap C| = 1∣A∩B∩C∣=1 (common element: 444).

    The number of elements in the union A∪B∪CA \cup B \cup CA∪B∪C is:

    ∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣ ∣A∪B∪C∣=4+4+4−2−1−2+1=4.|A \cup B \cup C| = 4 + 4 + 4 - 2 - 1 - 2 + 1 = 4.∣A∪B∪C∣=4+4+4−2−1−2+1=4.

    Thus, the union A∪B∪CA \cup B \cup CA∪B∪C has 4 elements, which are {1,2,3,4,5,6,7}\{1, 2, 3, 4, 5, 6, 7\}{1,2,3,4,5,6,7}.


    3. The General Formula for nnn Sets

    For nnn sets A1,A2,…,AnA_1, A_2, \dots, A_nA1​,A2​,…,An​, the Inclusion-Exclusion Principle is expressed as:

    ∣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​∣

    This formula alternates between adding and subtracting the sizes of intersections of the sets to account for overcounting.

    Example:

    Suppose we have three sets A,B,CA, B, CA,B,C, and we want to count the number of elements in A∪B∪CA \cup B \cup CA∪B∪C. Using the Inclusion-Exclusion formula:

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

    This can be extended further for more sets, ensuring no element is counted multiple times.


    4. Applications of the Inclusion-Exclusion Principle

    1. Counting Problems: The Inclusion-Exclusion Principle is often used in counting problems to determine the size of the union of several sets, particularly in combinatorics, probability, and computer science.

    2. Probability: It is used to calculate the probability of the union of events in probability theory. If events AAA and BBB are not mutually exclusive, the probability of A∪BA \cup BA∪B is given by:

      P(A∪B)=P(A)+P(B)−P(A∩B).P(A \cup B) = P(A) + P(B) - P(A \cap B).P(A∪B)=P(A)+P(B)−P(A∩B).
    3. Set Theory: It provides a method for solving problems involving intersections and unions of sets, particularly when the sets overlap.

    4. Graph Theory: In graph theory, the Inclusion-Exclusion Principle is used to count the number of subgraphs or paths that satisfy certain conditions, especially when overlapping criteria are involved.

    5. Permutations and Combinations: In problems involving arrangements or selections, it helps to compute the number of ways certain conditions can be satisfied, especially when some conditions overlap.


    5. Conclusion

    The Inclusion-Exclusion Principle is a powerful tool in combinatorics and counting, allowing for the accurate calculation of the size of unions of multiple sets by systematically accounting for overlaps. It works by initially adding the sizes of the individual sets and then subtracting the overcounted elements from the intersections, ensuring no element is counted more than once. This principle has broad applications in various areas of mathematics, including probability, set theory, graph theory, and more.

    Previous topic 30
    Number Theory: Sequences and Series
    Next topic 32
    Pigeonhole Principle

    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 time12 min
      Word count2,075
      Code examples0
      DifficultyIntermediate