Skip to content

Sets, Relations, and Functions

2.1 Sets

Basic operations:

  • Union: AB=x:xAorxBA \cup B = \\{x : x \in A \mathrm{ or} x \in B\\}
  • Intersection: AB=x:xAandxBA \cap B = \\{x : x \in A \mathrm{ and} x \in B\\}
  • Difference: AB=x:xAandxBA \setminus B = \\{x : x \in A \mathrm{ and} x \notin B\\}
  • Complement: Ac=UAA^c = U \setminus A (where UU is the universal set)

De Morgan”s Laws:

(AB)c=AcBc,(AB)c=AcBc(A \cup B)^c = A^c \cap B^c, \quad (A \cap B)^c = A^c \cup B^c

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

2.2 Relations

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: aA\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 aba \prec b (i.e., aba \preceq b and aba \neq b), and an edge is drawn From aa to bb whenever bb covers aa (there is no cc with acba \prec c \prec b).

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

Solution

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

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

Transitive: If 5(ab)5 \mid (a - b) and 5(bc)5 \mid (b - c)Then 5(ab)+(bc)=ac5 \mid (a - b) + (b - c) = a - cSo ac(mod5)a \equiv c \pmod{5}.

The equivalence classes are [0]=5k:kZ[0] = \\{5k : k \in \mathbb{{'}Z{}'}\\} [1]=5k+1:kZ[1] = \\{5k+1 : k \in \mathbb{{'}Z{}'}\\} [2]=5k+2:kZ[2] = \\{5k+2 : k \in \mathbb{{'}Z{}'}\\} [3]=5k+3:kZ[3] = \\{5k+3 : k \in \mathbb{{'}Z{}'}\\} [4]=5k+4:kZ[4] = \\{5k+4 : k \in \mathbb{{'}Z{}'}\\}. There are exactly 5 equivalence classes, forming the quotient Z/5Z\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\\}: aba \preceq b iff aba \mid b. Verify this is a partial order and identify the cover relations.

Solution

Reflexive: aaa \mid a for all aAa \in A. ✓

Antisymmetric: If aba \mid b and bab \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 aba \mid b and bcb \mid cThen c=lb=l(ka)=(lk)ac = lb = l(ka) = (lk)aSo aca \mid c. ✓

Cover relations (bb covers aa when aba \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.

2.3 Functions

A function f:ABf : A \to B is a relation where each aAa \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 bBb \in BThere exists aAa \in A with f(a)=bf(a) = b.
  • Bijective: both injective and surjective.

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

  • Injective if and only if AB|A| \leq |B|.
  • Surjective if and only if AB|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:ABf : 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:ABf : A \to B and g:BCg : B \to CThe composition gf:ACg \circ f : A \to C is defined by (gf)(a)=g(f(a))(g \circ f)(a) = g(f(a)) for all aAa \in A.

Theorem 2.3. If f:ABf : A \to B and g:BCg : B \to C are both injective, then gfg \circ f is injective.

Proof. Suppose (gf)(a1)=(gf)(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 gfg \circ f is injective. \blacksquare

Theorem 2.4. If f:ABf : A \to B and g:BCg : B \to C are both surjective, then gfg \circ f is surjective.

Proof. Let cCc \in C. Since gg is surjective, bB\exists\, b \in B with g(b)=cg(b) = c. Since ff is Surjective, aA\exists\, a \in A with f(a)=bf(a) = b. Then (gf)(a)=g(f(a))=g(b)=c(g \circ f)(a) = g(f(a)) = g(b) = c. Hence gfg \circ f is surjective. \blacksquare

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

A function f:ABf : A \to B is invertible if there exists f1:BAf^{-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.

2.4 Countability

Definition. A set SS is countable if it is finite or countably infinite. A set is countably infinite if there exists a bijection NS\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:NZf : \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,qN+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/qp/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.di1di2di3r_i = 0.d_{i1}d_{i2}d_{i3}\ldots with each dij0,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.s1s2s3s = 0.s_1 s_2 s_3 \ldots by

si={5if  dii56if  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 sr1,r2,s \notin \\{r_1, r_2, \ldots\\}Contradicting the assumption that the list was complete. Therefore R\mathbb{{'}R{}'} is uncountable. \blacksquare