Login

Concepts

Read through concept notes with worked explanations and diagrams, chapter by chapter.

Concept 02 / 10Sets, Relations and Functions

Set Operations, De Morgan's Laws and the Inclusion-Exclusion Principle

Union, intersection, difference, complement and symmetric difference, the algebra of sets and element-chasing proofs, and the inclusion-exclusion formulas for two and three sets, including 'exactly one', maximum and minimum overlap problems.

Figure 1
Once sets exist, we combine them. Work inside a universal set UU that contains everything under discussion. The basic operations are defined by what they do to a single element xx, and this element-wise view is the key to every proof in the topic. Union: A∪B={x:x∈A or x∈B}A \cup B = \{x : x \in A \text{ or } x \in B\}, where 'or' is inclusive. Intersection: A∩B={x:x∈A and x∈B}A \cap B = \{x : x \in A \text{ and } x \in B\}. If A∩B=ϕA \cap B = \phi the sets are disjoint. Difference: A−B={x:x∈A,x∉B}A - B = \{x : x \in A, x \notin B\}, which equals A∩B′A \cap B'. Complement: A′=U−AA' = U - A. Symmetric difference: AΔB=(A−B)∪(B−A)A \Delta B = (A - B) \cup (B - A), the elements in exactly one of the two sets. The algebra of sets mirrors the algebra of logic, with ∪\cup as 'or', ∩\cap as 'and' and complement as 'not'. Commutative laws: A∪B=B∪AA \cup B = B \cup A and A∩B=B∩AA \cap B = B \cap A. Associative laws: (A∪B)∪C=A∪(B∪C)(A \cup B) \cup C = A \cup (B \cup C) and likewise for ∩\cap. Distributive laws, which go both ways (unlike ordinary arithmetic): A∩(B∪C)=(A∩B)∪(A∩C)A \cap (B \cup C) = (A \cap B) \cup (A \cap C) and A∪(B∩C)=(A∪B)∩(A∪C)A \cup (B \cap C) = (A \cup B) \cap (A \cup C). Identity and domination: A∪ϕ=AA \cup \phi = A, A∩U=AA \cap U = A, A∩ϕ=ϕA \cap \phi = \phi, A∪U=UA \cup U = U. Complement laws: A∪A′=UA \cup A' = U, A∩A′=ϕA \cap A' = \phi, (A′)′=A(A')' = A. De Morgan's laws are the most tested identities: (A∪B)′=A′∩B′(A \cup B)' = A' \cap B' and (A∩B)′=A′∪B′(A \cap B)' = A' \cup B'. In words, the complement turns unions into intersections and vice versa. Proof of the first by element chasing: x∈(A∪B)′  ⟺  x∉A∪B  ⟺  x \in (A \cup B)' \iff x \notin A \cup B \iff it is not true that (x∈Ax \in A or x∈Bx \in B)   ⟺  x∉A\iff x \notin A and x∉B  ⟺  x∈A′∩B′x \notin B \iff x \in A' \cap B'. Every step is reversible, so the sets are equal. Relative versions hold too: A−(B∪C)=(A−B)∩(A−C)A - (B \cup C) = (A - B) \cap (A - C) and A−(B∩C)=(A−B)∪(A−C)A - (B \cap C) = (A - B) \cup (A - C). Counting: inclusion-exclusion. For finite sets, adding n(A)n(A) and n(B)n(B) counts every element of A∩BA \cap B twice, so we subtract it once: n(A∪B)=n(A)+n(B)−n(A∩B)n(A \cup B) = n(A) + n(B) - n(A \cap B). The Venn diagram shows the three disjoint regions A−BA - B, A∩BA \cap B and B−AB - A whose sizes add up to n(A∪B)n(A \cup B). For three sets the same logic gives n(A∪B∪C)=n(A)+n(B)+n(C)−n(A∩B)−n(B∩C)−n(C∩A)+n(A∩B∩C)n(A \cup B \cup C) = n(A) + n(B) + n(C) - n(A \cap B) - n(B \cap C) - n(C \cap A) + n(A \cap B \cap C). Why add the triple intersection back? An element in all three sets is counted 33 times in the first group, subtracted 33 times in the second group, so it has been counted 00 times; adding n(A∩B∩C)n(A \cap B \cap C) restores it to exactly once. The general principle alternates signs over intersections of 1,2,3,…1, 2, 3, \ldots sets, and it underlies the formulas for derangements and onto functions later in the course. Region formulas that follow directly: n(A−B)=n(A)−n(A∩B)n(A - B) = n(A) - n(A \cap B); the number in exactly one of A,BA, B is n(AΔB)=n(A)+n(B)−2n(A∩B)n(A \Delta B) = n(A) + n(B) - 2n(A \cap B); the number in neither is n(U)−n(A∪B)n(U) - n(A \cup B), which equals n(A′∩B′)n(A' \cap B') by De Morgan. For three sets, the number in exactly one set is ∑n(A)−2∑n(A∩B)+3n(A∩B∩C)\sum n(A) - 2\sum n(A \cap B) + 3n(A \cap B \cap C), and the number in exactly two sets is ∑n(A∩B)−3n(A∩B∩C)\sum n(A \cap B) - 3n(A \cap B \cap C). Bounds on overlaps. Since n(A∪B)≤n(U)n(A \cup B) \le n(U), we get n(A∩B)≥n(A)+n(B)−n(U)n(A \cap B) \ge n(A) + n(B) - n(U), and trivially n(A∩B)≥0n(A \cap B) \ge 0. Since A∩BA \cap B sits inside both sets, n(A∩B)≤min⁡(n(A),n(B))n(A \cap B) \le \min(n(A), n(B)). So max⁡(0,n(A)+n(B)−n(U))≤n(A∩B)≤min⁡(n(A),n(B))\max(0, n(A) + n(B) - n(U)) \le n(A \cap B) \le \min(n(A), n(B)). The minimum is reached when the two sets are spread out as much as possible, the maximum when the smaller set sits entirely inside the larger. Key Takeaways: - A−B=A∩B′A - B = A \cap B'; AΔB=(A∪B)−(A∩B)A \Delta B = (A \cup B) - (A \cap B). - De Morgan: (A∪B)′=A′∩B′(A \cup B)' = A' \cap B' and (A∩B)′=A′∪B′(A \cap B)' = A' \cup B'. - Both distributive laws hold: ∩\cap over ∪\cup and ∪\cup over ∩\cap. - n(A∪B)=n(A)+n(B)−n(A∩B)n(A \cup B) = n(A) + n(B) - n(A \cap B); the three-set version adds back n(A∩B∩C)n(A \cap B \cap C). - Exactly one of A,BA, B: n(A)+n(B)−2n(A∩B)n(A) + n(B) - 2n(A \cap B). - max⁡(0,n(A)+n(B)−n(U))≤n(A∩B)≤min⁡(n(A),n(B))\max(0, n(A) + n(B) - n(U)) \le n(A \cap B) \le \min(n(A), n(B)). - To prove an identity, either chase an element through both sides or reduce both sides to the same expression using the laws. A Venn diagram illustrates an identity but does not prove it. - Pitfall: A−B≠B−AA - B \neq B - A in general, and (A−B)∪B=A∪B(A - B) \cup B = A \cup B, not AA. Brain-Teaser 1: In a class of 100100 students, 6060 like Mathematics and 5050 like Physics. What are the least and greatest possible numbers who like both? If every student likes at least one of the two, what is the answer? Solution: With n(U)=100n(U) = 100, n(M)=60n(M) = 60 and n(P)=50n(P) = 50, the lower bound is n(M∩P)≥60+50−100=10n(M \cap P) \ge 60 + 50 - 100 = 10, reached when nobody dislikes both. The upper bound is min⁡(60,50)=50\min(60, 50) = 50, reached when every Physics lover also likes Mathematics. So the overlap lies between 1010 and 5050. If every student likes at least one subject, then n(M∪P)=100n(M \cup P) = 100 is forced, and n(M∩P)=60+50−100=10n(M \cap P) = 60 + 50 - 100 = 10 exactly. The extra condition collapses the range to a single value. Brain-Teaser 2: Prove that A−(B∪C)=(A−B)∩(A−C)A - (B \cup C) = (A - B) \cap (A - C) without drawing a diagram. Solution: Rewrite differences as intersections with complements and apply De Morgan. A−(B∪C)=A∩(B∪C)′=A∩(B′∩C′)A - (B \cup C) = A \cap (B \cup C)' = A \cap (B' \cap C'). Because ∩\cap is associative, commutative and idempotent (A=A∩AA = A \cap A), this equals (A∩B′)∩(A∩C′)=(A−B)∩(A−C)(A \cap B') \cap (A \cap C') = (A - B) \cap (A - C). The logic behind it: to be outside 'BB or CC', an element must be outside BB and outside CC. Converting '−-' into '∩\cap complement' is the single most useful move in set algebra, because it turns every difference into something the standard laws can act on. Brain-Teaser 3: How many integers from 11 to 10001000 are divisible by at least one of 22, 33, 55? How many are divisible by none? Solution: Let AkA_{k} be the multiples of kk in 11 to 10001000, so n(Ak)=⌊1000/k⌋n(A_{k}) = \lfloor 1000/k \rfloor. A number is divisible by both 22 and 33 exactly when it is divisible by 66, so the intersections are multiples of the least common multiples. Then n(A2)=500n(A_{2}) = 500, n(A3)=333n(A_{3}) = 333, n(A5)=200n(A_{5}) = 200, n(A6)=166n(A_{6}) = 166, n(A10)=100n(A_{10}) = 100, n(A15)=66n(A_{15}) = 66 and n(A30)=33n(A_{30}) = 33. Inclusion-exclusion gives 500+333+200−166−100−66+33=734500 + 333 + 200 - 166 - 100 - 66 + 33 = 734. So 734734 are divisible by at least one, and 1000−734=2661000 - 734 = 266 by none. As a sanity check, the density of integers coprime to 3030 is (1−12)(1−13)(1−15)=415(1 - \frac{1}{2})(1 - \frac{1}{3})(1 - \frac{1}{5}) = \frac{4}{15}, and 415×1000≈266.7\frac{4}{15} \times 1000 \approx 266.7, which agrees.