Sets and Functions

Overlap sets in pictures to see unions and intersections. Judge by eye whether a map is injective or surjective.

A union takes anything in at least one set. An intersection needs both. A complement is everything outside. Colliding or missing arrows decide injective versus surjective.

For example, some πŸ§‘ classmates love πŸ“š books, while others love ⚽ soccer. Friends loving both stand in the overlap. Loving at least one puts you in the union.

(AβˆͺB)c=Ac∩Bc(A \cup B)^c = A^c \cap B^c
fΒ bijectiveβ€…β€ŠβŸΊβ€…β€Šβˆƒg:g∘f=idf \text{ bijective} \iff \exists g: g \circ f = \mathrm{id}

Part of these learning paths

Examples & Exercises

Prove (AβˆͺB)c=Ac∩Bc(A \cup B)^c = A^c \cap B^c element by element.

x∈(AβˆͺB)cβ€…β€ŠβŸΊβ€…β€Šxβˆ‰AβˆͺBβ€…β€ŠβŸΊβ€…β€Šxβˆ‰AΒ andΒ xβˆ‰Bβ€…β€ŠβŸΊβ€…β€Šx∈Ac∩Bcx \in (A \cup B)^c \iff x \notin A \cup B \iff x \notin A \text{ and } x \notin B \iff x \in A^c \cap B^c
Venn diagram with the union lit β€” complementing leaves only the outside region.
Show proof
  1. Take an element xx. By the definition of complement, x∈(AβˆͺB)cβ€…β€ŠβŸΊβ€…β€Šxβˆ‰AβˆͺBx \in (A \cup B)^c \iff x \notin A \cup B.

  2. xβˆ‰AβˆͺBβ€…β€ŠβŸΊβ€…β€ŠΒ¬(x∈A∨x∈B)x \notin A \cup B \iff \lnot(x \in A \lor x \in B). By the propositional De Morgan's law this is Β¬(x∈A)∧¬(x∈B)\lnot(x \in A) \land \lnot(x \in B), i.e. (xβˆ‰A)∧(xβˆ‰B)(x \notin A) \land (x \notin B).

  3. (xβˆ‰A)∧(xβˆ‰B)β€…β€ŠβŸΊβ€…β€Šx∈Ac∧x∈Bcβ€…β€ŠβŸΊβ€…β€Šx∈Ac∩Bc(x \notin A) \land (x \notin B) \iff x \in A^c \land x \in B^c \iff x \in A^c \cap B^c. Since xx was arbitrary, (AβˆͺB)c=Ac∩Bc(A \cup B)^c = A^c \cap B^c.

Prove f:A→Bf: A \to B is bijective iff a two-sided inverse g:B→Ag: B \to A exists.

Bijective mode β€” every dot is hit exactly once.
Show proof
  1. (β‡’) For each b∈Bb \in B there is an aa with f(a)=bf(a) = b (surjective), and by injectivity that aa is unique. Call it g(b)g(b); this defines g:Bβ†’Ag: B \to A.

  2. g(f(a))=ag(f(a)) = a because the unique element mapping to f(a)f(a) is aa itself; and f(g(b))=bf(g(b)) = b is exactly the definition of g(b)g(b).

  3. (⇐) Suppose such a gg exists. If f(a1)=f(a2)f(a_1) = f(a_2), applying gg gives a1=g(f(a1))=g(f(a2))=a2a_1 = g(f(a_1)) = g(f(a_2)) = a_2 β€” injective.

    And for b∈Bb \in B, putting a=g(b)a = g(b) gives f(a)=f(g(b))=bf(a) = f(g(b)) = b β€” surjective. Hence ff is bijective.

Prove ∣AβˆͺB∣=∣A∣+∣Bβˆ£βˆ’βˆ£A∩B∣\lvert A \cup B\rvert = \lvert A\rvert + \lvert B\rvert - \lvert A \cap B\rvert for finite sets, and evaluate it for ∣A∣=5\lvert A\rvert=5, ∣B∣=4\lvert B\rvert=4, ∣A∩B∣=2\lvert A\cap B\rvert=2.

∣AβˆͺB∣=5+4βˆ’2=7\lvert A \cup B\rvert = 5 + 4 - 2 = 7
∣A∣=5\lvert A\rvert=5, ∣B∣=4\lvert B\rvert=4, overlap 22 β€” the union has 77.
Show proof
  1. AβˆͺBA \cup B is the disjoint union of the three pairwise-disjoint pieces Aβˆ–BA \setminus B, Bβˆ–AB \setminus A, and A∩BA \cap B.

  2. ∣A∣=∣Aβˆ–B∣+∣A∩B∣\lvert A \rvert = \lvert A \setminus B \rvert + \lvert A \cap B \rvert and ∣B∣=∣Bβˆ–A∣+∣A∩B∣\lvert B \rvert = \lvert B \setminus A \rvert + \lvert A \cap B \rvert (both are disjoint unions).

  3. Adding the two equations gives ∣A∣+∣B∣=∣AβˆͺB∣+∣A∩B∣\lvert A \rvert + \lvert B \rvert = \lvert A \cup B \rvert + \lvert A \cap B \rvert β€” the overlap was counted twice. Rearranging yields ∣AβˆͺB∣=∣A∣+∣Bβˆ£βˆ’βˆ£A∩B∣\lvert A \cup B \rvert = \lvert A \rvert + \lvert B \rvert - \lvert A \cap B \rvert.

  4. Substituting ∣A∣=5\lvert A \rvert = 5, ∣B∣=4\lvert B \rvert = 4, ∣A∩B∣=2\lvert A \cap B \rvert = 2 gives ∣AβˆͺB∣=5+4βˆ’2=7\lvert A \cup B \rvert = 5 + 4 - 2 = 7.

2. Number Systems