Skip to content

Sets, Relations, and Functions

Basic operations:

  • Union: A∪B=x:x∈Aorx∈BA \cup B = \\{x : x \in A \mathrm{ or} x \in B\\}
  • Intersection: A∩B=x:x∈Aandx∈BA \cap B = \\{x : x \in A \mathrm{ and} x \in B\\}
  • Difference: A∖B=x:x∈Aandx∉BA \setminus B = \\{x : x \in A \mathrm{ and} x \notin B\\}
  • Complement: Ac=U∖AA^c = U \setminus A (where UU is the universal set)

De Morgan”s Laws:

(A∪B)c=Ac∩Bc,(A∩B)c=Ac∪Bc(A \cup B)^c = A^c \cap B^c, \quad (A \cap B)^c = A^c \cup B^c

Power set: P(A)=B:B⊆A\mathcal{P}(A) = \\{B : B \subseteq A\\}. If ∣A∣=n|A| = nThen ∣P(A)∣=2n|\mathcal{P}(A)| = 2^n.

A binary relation RR from set AA to set BB is a subset of A×BA \times B.

A relation RR on AA is:

  • Reflexive: ∀a∈A\forall a \in A, (a,a)∈R(a,a) \in R.
  • Symmetric: (a,b)∈R  ⟹  (b,a)∈R(a,b) \in R \implies (b,a) \in R.
  • Antisymmetric: (a,b)∈R(a,b) \in R and (b,a)∈R  ⟹  a=b(b,a) \in R \implies a = b.
  • Transitive: (a,b)∈R(a,b) \in R and (b,c)∈R  ⟹  (b,c) \in R \implies(a,c) \in R$.

Equivalence relation: reflexive, symmetric, transitive. Partitions the set into equivalence classes.

Partial order: reflexive, antisymmetric, transitive. Written (A,⪯)(A, \preceq).

A Hasse diagram is a graphical representation of a finite poset (A,⪯)(A, \preceq): an element aa Is drawn below bb whenever a≺ba \prec b (i.e., a⪯ba \preceq b and a≠ba \neq b), and an edge is drawn From aa to bb whenever bb covers aa (there is no cc with a≺c≺ba \prec c \prec b).

Worked Example. Show that RR on ′Z′\mathbb{{'}Z{}'} defined by a R ba\,R\,b iff a≡b(mod5)a \equiv b \pmod{5} is An equivalence relation. Describe the equivalence classes.

Solution

Reflexive: a−a=0=5⋅0a - a = 0 = 5 \cdot 0So a≡a(mod5)a \equiv a \pmod{5} for all aa.

Symmetric: If a≡b(mod5)a \equiv b \pmod{5}Then 5∣(a−b)5 \mid (a - b)So 5∣(b−a)5 \mid (b - a)Giving b≡a(mod5)b \equiv a \pmod{5}.

Transitive: If 5∣(a−b)5 \mid (a - b) and 5∣(b−c)5 \mid (b - c)Then 5∣(a−b)+(b−c)=a−c5 \mid (a - b) + (b - c) = a - cSo a≡c(mod5)a \equiv c \pmod{5}.

The equivalence classes are [0]=5k:k∈′Z′[0] = \\{5k : k \in \mathbb{{'}Z{}'}\\} [1]=5k+1:k∈′Z′[1] = \\{5k+1 : k \in \mathbb{{'}Z{}'}\\} [2]=5k+2:k∈′Z′[2] = \\{5k+2 : k \in \mathbb{{'}Z{}'}\\} [3]=5k+3:k∈′Z′[3] = \\{5k+3 : k \in \mathbb{{'}Z{}'}\\} [4]=5k+4:k∈′Z′[4] = \\{5k+4 : k \in \mathbb{{'}Z{}'}\\}. There are exactly 5 equivalence classes, forming the quotient ′Z′/5′Z′\mathbb{{'}Z{}'}/5\mathbb{{'}Z{}'}.

Worked Example. Let ⪯\preceq be divisibility on A=1,2,3,4,6,12A = \\{1, 2, 3, 4, 6, 12\\}: a⪯ba \preceq b iff a∣ba \mid b. Verify this is a partial order and identify the cover relations.

Solution

Reflexive: a∣aa \mid a for all a∈Aa \in A. ✓

Antisymmetric: If a∣ba \mid b and b∣ab \mid aThen b=kab = ka and a=lba = lb for positive k,lk, l So a=lkaa = lkaGiving lk=1lk = 1 and l=k=1l = k = 1Hence a=ba = b. ✓

Transitive: If a∣ba \mid b and b∣cb \mid cThen c=lb=l(ka)=(lk)ac = lb = l(ka) = (lk)aSo a∣ca \mid c. ✓

Cover relations (bb covers aa when a∣ba \mid b and no element lies strictly between):

  • 12 covers 6, 4
  • 6 covers 2, 3
  • 4 covers 2
  • 3 covers 1
  • 2 covers 1

Reading from bottom to top the Hasse diagram is: 11 at the bottom with edges to 22 and 33; 22 connects up to 44 and 66; 33 connects up to 66; 44 and 66 connect up to 1212 at the top.

A function f:A→Bf : A \to B is a relation where each a∈Aa \in A appears exactly once as a first element.

  • Injective (one-to-one): f(a1)=f(a2)  ⟹  a1=a2f(a_1) = f(a_2) \implies a_1 = a_2.
  • Surjective (onto): for every b∈Bb \in BThere exists a∈Aa \in A with f(a)=bf(a) = b.
  • Bijective: both injective and surjective.

Theorem 2.1. If AA and BB are finite sets, f:A→Bf : A \to B is:

  • Injective if and only if ∣A∣≤∣B∣|A| \leq |B|.
  • Surjective if and only if ∣A∣≥∣B∣|A| \geq |B|.
  • Bijective if and only if ∣A∣=∣B∣|A| = |B|.

Theorem 2.2 (Pigeonhole Principle). If ∣A∣>∣B∣|A| \gt{} |B|Then no function f:A→Bf : A \to B is injective. Equivalently, placing nn items into mm boxes with n>mn \gt{} m forces at least one box to contain at least ⌈n/m⌉\lceil n/m \rceil items.

Function composition. Given f:A→Bf : A \to B and g:B→Cg : B \to CThe composition g∘f:A→Cg \circ f : A \to C is defined by (g∘f)(a)=g(f(a))(g \circ f)(a) = g(f(a)) for all a∈Aa \in A.

Theorem 2.3. If f:A→Bf : A \to B and g:B→Cg : B \to C are both injective, then g∘fg \circ f is injective.

Proof. Suppose (g∘f)(a1)=(g∘f)(a2)(g \circ f)(a_1) = (g \circ f)(a_2). Then g(f(a1))=g(f(a2))g(f(a_1)) = g(f(a_2)). Since gg is Injective, f(a1)=f(a2)f(a_1) = f(a_2). Since ff is injective, a1=a2a_1 = a_2. Hence g∘fg \circ f is injective. ■\blacksquare

Theorem 2.4. If f:A→Bf : A \to B and g:B→Cg : B \to C are both surjective, then g∘fg \circ f is surjective.

Proof. Let c∈Cc \in C. Since gg is surjective, ∃ b∈B\exists\, b \in B with g(b)=cg(b) = c. Since ff is Surjective, ∃ a∈A\exists\, a \in A with f(a)=bf(a) = b. Then (g∘f)(a)=g(f(a))=g(b)=c(g \circ f)(a) = g(f(a)) = g(b) = c. Hence g∘fg \circ f is surjective. ■\blacksquare

Corollary 2.5. The composition of two bijections is a bijection.

A function f:A→Bf : A \to B is invertible if there exists f−1:B→Af^{-1} : B \to A such that f^{-1} \circ f = \mathrm{id{}_A and f \circ f^{-1} = \mathrm{id{}_B. A function is invertible If and only if it is bijective.

Definition. A set SS is countable if it is finite or countably infinite. A set is countably infinite if there exists a bijection ′N′→S\mathbb{{'}N{}'} \to S. A set that is not countable Is uncountable.

Theorem 2.6. ′Z′\mathbb{{'}Z{}'} is countably infinite.

Proof. The function f:′N′→′Z′f : \mathbb{{'}N{}'} \to \mathbb{{'}Z{}'} defined by

f(n)={n/2if  n  is  even−(n+1)/2if  n  is  oddf(n) = \begin{cases} n/2 & \mathrm{if}\; n\; \mathrm{is}\; even \\ -(n+1)/2 & \mathrm{if}\; n\; \mathrm{is}\; odd \end{cases}

Is a bijection, enumerating 0,−1,1,−2,2,−3,3,…0, -1, 1, -2, 2, -3, 3, \ldots ■\blacksquare

Theorem 2.7. ′Q′\mathbb{{'}Q{}'} is countably infinite.

Proof. Every positive rational can be written as p/qp/q with p,q∈′N′+p, q \in \mathbb{{'}N{}'}^+. Arrange the Pairs (p,q)(p, q) in an infinite grid and traverse them diagonally:

1/1,  1/2,  2/1,  3/1,  1/3,  1/4,  2/3,  3/2,  4/1,…1/1,\; 1/2,\; 2/1,\; 3/1,\; 1/3,\; 1/4,\; 2/3,\; 3/2,\; 4/1, \ldots

Skipping duplicates (where p/q=p′/q′p/q = p'/q' in reduced form) yields an enumeration of ′Q′+\mathbb{{'}Q{}'}^+. Extending with negatives and zero gives an enumeration of ′Q′\mathbb{{'}Q{}'}. ■\blacksquare

Theorem 2.8 (Cantor, 1891). ′R′\mathbb{{'}R{}'} is uncountable.

Proof (Diagonal argument). Suppose for contradiction that ′R′\mathbb{{'}R{}'} is countable. Then the Interval [0,1)[0, 1) can be listed as r1,r2,r3,…r_1, r_2, r_3, \ldots where each rir_i has a unique decimal Expansion ri=0.di1di2di3…r_i = 0.d_{i1}d_{i2}d_{i3}\ldots with each dij∈0,1,…,9d_{ij} \in \\{0, 1, \ldots, 9\\} (choosing the expansion that does not end in all 9s to avoid dual representations).

Define s=0.s1s2s3…s = 0.s_1 s_2 s_3 \ldots by

si={5if  dii≠56if  dii=5s_i = \begin{cases} 5 & \mathrm{if}\; d_{ii} \neq 5 \\ 6 & \mathrm{if}\; d_{ii} = 5 \end{cases}

Then s∈[0,1)s \in [0, 1) and ss differs from rir_i in the ii-th decimal place for every ii So s∉r1,r2,…s \notin \\{r_1, r_2, \ldots\\}Contradicting the assumption that the list was complete. Therefore ′R′\mathbb{{'}R{}'} is uncountable. ■\blacksquare