Chapter 1 - Sets, Relations and Languages

Updated 4 Oct 2026

1. Sets

Definition

  • A set is a collection of distinct objects
  • Examples of sets:
    • The set of integers, denoted by Z\mathbb{Z}
    • The set of non-negative integers (natural numbers), denoted by N\mathbb{N}
    • The set of truth values, denoted by B={T,F}B = \{T, F\}
    • The set of students in this classroom

Set Membership

  • The elements or members of a set are the objects comprising it
  • If bb is an element of a set LL, then we write b∈Lb \in L
    • ภาษาอังกฤษอ่านว่า a member of!

Ways to Display a Set

There are two ways to display a set:

  1. Explicit listing: List the elements belonging to it

    • Example: B={T,F}B = \{T, F\} (set of truth values)
  2. Property specification: Specify the properties that characterize the elements

    • Example: The set of even integers: {x∣x∈Z and x mod 2=0}\{x | x \in \mathbb{Z} \text{ and } x \bmod 2 = 0\}
    • Alternative notation: {x∈Z∣x mod 2=0}\{x \in \mathbb{Z} | x \bmod 2 = 0\}
      • อ่านได้ว่า xx is an integer where x mod 2 = 0

Set Equality

  • Two sets are equal if they have the same elements
    X=Y iff (∀x∈X:x∈Y) and (∀x∈Y:x∈X)\boxed{X = Y \text{ iff } (\forall x \in X : x \in Y) \text{ and } (\forall x \in Y : x \in X)}

ต้องโชว์ each member in x must be in y && each member in y must be in x

Special Sets

  • Empty set: A set without any element, denoted by ∅\emptyset
  • Finite set: A set with finitely many elements
    • A set AA is finite if and only if there is a one-to-one correspondence between elements of AA and {1,2,…,n}\{1, 2, \ldots, n\} for some natural number nn (ยังไม่ต้องเข้าใจตอนนี้ก็ได้)
  • Infinite set: A set with infinitely many elements
    • Countably infinite sets: e.g., N\mathbb{N}
    • Uncountably infinite sets: e.g., [0,1][0, 1]

Subsets

  • Subset: A set XX is a subset of a set YY, written X⊆YX \subseteq Y, if each element of XX is also an element of YY
    X⊆Y iff ∀x∈X:x∈Y\boxed{X \subseteq Y \text{ iff } \forall x \in X : x \in Y}

  • Proper subset: XX is a proper subset of YY, written X⊂YX \subset Y, if XX is a subset of YY but XX and YY are not equal
    X⊂Y iff X⊆Y and X≠Y\boxed{X \subset Y \text{ iff } X \subseteq Y \text{ and } X \neq Y}

  • Examples:

    • The set of natural numbers N\mathbb{N} is a proper subset of the set of integers Z\mathbb{Z}

อันนี้มีให้พิสูจน์เช่นกัน

Basic Facts about Subsets

  • For any set AA:
    • The empty set ∅\emptyset is a subset of AA: ∅⊆A\emptyset \subseteq A
    • AA is a subset of itself: A⊆AA \subseteq A
  • If A⊆BA \subseteq B and B⊆AB \subseteq A, then A=BA = B (USED FREQUENTLY)

2. Set Operations: Union, Difference, Intersection

Union

  • The union of two sets A,BA, B is the set of elements which belongs to at least one of them, denoted A∪BA \cup B
    ∀x:x∈A∨x∈B⇔x∈A∪B\boxed{\forall x : x \in A \vee x \in B \Leftrightarrow x \in A \cup B}

Intersection

  • The intersection of two sets A,BA, B is the set of elements which belongs to both of them, denoted A∩BA \cap B
    ∀x:x∈A∧x∈B⇔x∈A∩B\boxed{\forall x : x \in A \wedge x \in B \Leftrightarrow x \in A \cap B}

Disjoint Sets

  • Two sets A,BA, B are disjoint if A∩B=∅A \cap B = \emptyset

Set Difference

  • The set difference of two sets A,BA, B is the set of those elements in AA that are not in BB, denoted A∖BA \setminus B (or A−BA - B)
    ∀x:x∈A∧x∉B⇔x∈A∖B\boxed{\forall x : x \in A \wedge x \notin B \Leftrightarrow x \in A \setminus B}
A∖B=A∩B′A\setminus B=A\cap B'

Laws for Set Operations

Idempotent Laws

  • A∪A=AA \cup A = A
  • A∩A=AA \cap A = A

Commutative Laws

  • A∪B=B∪AA \cup B = B \cup A
  • A∩B=B∩AA \cap B = B \cap A

Associative Laws (The Grouping is Not Important)

  • (A∪B)∪C=A∪(B∪C)(A \cup B) \cup C = A \cup (B \cup C)
  • (A∩B)∩C=A∩(B∩C)(A \cap B) \cap C = A \cap (B \cap C)

General Union and Intersection

Due to these rules, we can define:

  • General union: ⋃{A1,A2,A3,…}=A1∪A2∪A3∪…\bigcup\{A_1, A_2, A_3, \ldots\} = A_1 \cup A_2 \cup A_3 \cup \ldots
  • General intersection: ⋂{A1,A2,A3,…}=A1∩A2∩A3∩…\bigcap\{A_1, A_2, A_3, \ldots\} = A_1 \cap A_2 \cap A_3 \cap \ldots

Set Complement

Suppose there is a big set UU such that both AA and BB are subsets of UU.

  • Complement of AA: A‾=U∖A\overline{A} = U \setminus A
  • Complement of BB: B‾=U∖B\overline{B} = U \setminus B

Then:

  • A∖B=A∩B‾A \setminus B = A \cap \overline{B}
  • A∩B‾=A‾∪B‾\overline{A \cap B} = \overline{A} \cup \overline{B}
  • A∪B‾=A‾∩B‾\overline{A \cup B} = \overline{A} \cap \overline{B}

Absorption Law

  • A∪(A∩B)=AA \cup (A \cap B) = A
  • A∩(A∪B)=AA \cap (A \cup B) = A

Distributivity Law

#MidtermExam will show up (proving question) + DeMorgan’s

  • A∪(B∩C)=(A∪B)∩(A∪C)\boxed{A \cup (B \cap C) = (A \cup B) \cap (A \cup C)}
  • A∩(B∪C)=(A∩B)∪(A∩C)\boxed{A \cap (B \cup C) = (A \cap B) \cup (A \cap C)}

DeMorgan's Laws

  • A∖(B∪C)=(A∖B)∩(A∖C)\boxed{A \setminus (B \cup C) = (A \setminus B) \cap (A \setminus C)}
  • A∖(B∩C)=(A∖B)∪(A∖C)\boxed{A \setminus (B \cap C) = (A \setminus B) \cup (A \setminus C)}

Proof of Distributivity Law

To prove: A∪(B∩C)=(A∪B)∩(A∪C)A \cup (B \cap C) = (A \cup B) \cap (A \cup C)

We need to prove both directions:

  1. A∪(B∩C)⊆(A∪B)∩(A∪C)A \cup (B \cap C) \subseteq (A \cup B) \cap (A \cup C)
  2. (A∪B)∩(A∪C)⊆A∪(B∩C)(A \cup B) \cap (A \cup C) \subseteq A \cup (B \cap C)

Part 1: Consider x∈A∪(B∩C)x \in A \cup (B \cap C). There are two cases:

  • Case 1: If x∈Ax \in A, then x∈A∪Bx \in A \cup B and x∈A∪Cx \in A \cup C, hence x∈(A∪B)∩(A∪C)x \in (A \cup B) \cap (A \cup C)
  • Case 2: If x∈B∩Cx \in B \cap C, then x∈Bx \in B and x∈Cx \in C. Hence x∈A∪Bx \in A \cup B and x∈A∪Cx \in A \cup C. Therefore x∈(A∪B)∩(A∪C)x \in (A \cup B) \cap (A \cup C)

Hence A∪(B∩C)⊆(A∪B)∩(A∪C)A \cup (B \cap C) \subseteq (A \cup B) \cap (A \cup C)

Part 2: Consider x∈(A∪B)∩(A∪C)x \in (A \cup B) \cap (A \cup C). So x∈A∪Bx \in A \cup B and x∈A∪Cx \in A \cup C.
In other words, (x∈A or x∈B)(x \in A \text{ or } x \in B) and (x∈A or x∈C)(x \in A \text{ or } x \in C).

  • Case 1: If x∈Ax \in A, then x∈A∪(B∩C)x \in A \cup (B \cap C)
  • Case 2: If x∉Ax \notin A, then x∈Bx \in B and x∈Cx \in C, i.e., x∈B∩Cx \in B \cap C and hence x∈A∪(B∩C)x \in A \cup (B \cap C)

So in any case x∈A∪(B∩C)x \in A \cup (B \cap C). Hence (A∪B)∩(A∪C)⊆A∪(B∩C)(A \cup B) \cap (A \cup C) \subseteq A \cup (B \cap C)

Proof of DeMorgan's Laws

มาแน่เลยว่ะ ๆ

To prove: A∖(B∪C)=(A∖B)∩(A∖C)A \setminus (B \cup C) = (A \setminus B) \cap (A \setminus C)

Let UU be a set such that all sets A,B,CA, B, C are subsets of UU. We have:

A∖(B∪C)A \setminus (B \cup C)
=A∩(B∪C)‾= A \cap \overline{(B \cup C)} (applying the law: X∖Y=X∩Y‾X \setminus Y = X \cap \overline{Y})
=A∩(B‾∩C‾)= A \cap (\overline{B} \cap \overline{C}) (DeMorgan's law for complements)
=(A∩B‾)∩(A∩C‾)= (A \cap \overline{B}) \cap (A \cap \overline{C}) (distributivity)
=(A∖B)∩(A∖C)= (A \setminus B) \cap (A \setminus C) (definition of set difference)

Exercise: Prove A∖(B∩C)=(A∖B)∪(A∖C)A \setminus (B \cap C) = (A \setminus B) \cup (A \setminus C) (EASY)

General Union

  • If SS is a collection of sets, then ⋃S\bigcup S is the set whose elements are the elements of the sets in SS

Examples:

  • If S={{a,b},{c},{a,d}}S = \{\{a, b\}, \{c\}, \{a, d\}\}, then ⋃S={a,b,c,d}\bigcup S = \{a, b, c, d\}
  • If S={{a,b},{c},{a,{d,a}}}S = \{\{a, b\}, \{c\}, \{a, \{d, a\}\}\}, then ⋃S={a,b,c,{d,a}}\bigcup S = \{a, b, c, \{d, a\}\}

How about ⋂\bigcaps?

The Power Set

  • If SS is a set, then 2S2^S, called the power set of SS, is the set of all subsets of SS

Examples:

  • S={a}S = \{a\}, 2S={∅,{a}}2^S = \{\emptyset, \{a\}\}
  • S={a,b}S = \{a, b\}, 2S={∅,{a},{b},{a,b}}2^S = \{\emptyset, \{a\}, \{b\}, \{a, b\}\}

Partition

A partition of a set SS is a set Π\Pi of subsets of SS (i.e., Π⊆2S\Pi \subseteq 2^S) such that:

  • Each element of Π\Pi is not empty
  • Distinct members of Π\Pi are disjoint
  • ⋃Π=S\bigcup \Pi = S (covers the entire set)

Example: S={a,b,c}S = \{a, b, c\}

  • Π={{a},{b,c}}\Pi = \{\{a\}, \{b, c\}\} is a partition of SS
  • A={{a},{a,b},{c}}A = \{\{a\}, \{a, b\}, \{c\}\} is not a partition (overlapping sets)
  • B={{a},{b,c},∅}B = \{\{a\}, \{b, c\}, \emptyset\} is not a partition (contains empty set)

3. Relations and Functions

Ordered Pairs

  • An ordered pair is written as (a,b)(a, b) where aa is the first component and bb is the second
  • An ordered pair (a,b)(a, b) can be understood as a set {a,{a,b}}\{a, \{a, b\}\}
  • Similarly (b,a)(b, a) as a set {b,{a,b}}\{b, \{a, b\}\}

Note: {a,b}={b,a}\{a, b\} = \{b, a\} but (a,b)≠(b,a)(a, b) \neq (b, a)

Cartesian Product

  • The Cartesian product of two sets A,BA, B, denoted A×BA \times B, is the set of all ordered pairs (a,b)(a, b) with a∈A,b∈Ba \in A, b \in B
    A×B={(a,b)∣a∈A,b∈B}\boxed{A \times B = \{(a, b) | a \in A, b \in B\}}

Examples:

  • {a,b}×{a}={(a,a),(b,a)}\{a, b\} \times \{a\} = \{(a, a), (b, a)\}
  • The plane can be represented as a Cartesian product R×R\mathbb{R} \times \mathbb{R} where R\mathbb{R} is the set of all real numbers

Functions

  • A map or function from a set AA to a set BB, denoted f:A→Bf : A \to B, is an assignment to each element a∈Aa \in A a single element, denoted by f(a)f(a), in BB

Function Components:

  • AA is called the domain of ff
  • BB is called the co-domain of ff
  • f(a)f(a) is called the image of aa under ff
  • The range of ff is denoted by f(A)={f(a)∣a∈A}f(A) = \{f(a) | a \in A\}
  • For A′⊆AA' \subseteq A, f(A′)={f(a)∣a∈A′}f(A') = \{f(a) | a \in A'\} is called the image of A′A' under ff

Example: +:N×N→N+ : \mathbb{N} \times \mathbb{N} \to \mathbb{N} where +(1,2)=3+(1, 2) = 3

Function Exercises

  1. If A=∅A = \emptyset, how many possible functions are there from AA to BB?
  2. If B=∅B = \emptyset, how many functions are there from AA to BB?
  3. If AA contains exactly one element, how many functions are there from AA to BB?

Types of Functions

  • A function f:A→Bf : A \to B is one-to-one (injective) if for any two distinct elements a,a′∈Aa, a' \in A, f(a)≠f(a′)f(a) \neq f(a')
  • A function f:A→Bf : A \to B is onto BB (surjective) if B=f(A)B = f(A)
  • A function f:A→Bf : A \to B is a bijection between AA and BB if it is both one-to-one and onto BB
  • Let AA and BB be two finite sets. AA and BB have the same number of elements iff there is a bijection between AA and BB

Function Composition

  • Given a function f:A→Bf : A \to B and g:B→Cg : B \to C, the composition f∘g:A→Cf \circ g : A \to C is defined by:
  • (f∘g)(a)=g(f(a))\boxed{(f \circ g)(a) = g(f(a))}

Example:

  • f:N×N→Nf : \mathbb{N} \times \mathbb{N} \to \mathbb{N} where f(m,n)=m+nf(m, n) = m + n
  • g:N→Ng : \mathbb{N} \to \mathbb{N} where g(k)=2kg(k) = 2k
  • (f∘g)(m,n)=2(m+n)(f \circ g)(m, n) = 2(m + n)

Relations

  • A binary relation on two sets A,BA, B is a subset of A×BA \times B
  • Example: The greater or equal relation ≥\geq in the set of integers: R={(m,n)∣m≥n}⊆Z×ZR = \{(m, n) | m \geq n\} \subseteq \mathbb{Z} \times \mathbb{Z}

n-tuples and n-ary Relations

  • An ordered n-tuple is written as (a1,a2,…,an)(a_1, a_2, \ldots, a_n) where aia_i is the ii-th component
  • The n-fold Cartesian product of sets A1,…,AnA_1, \ldots, A_n, denoted by A1×⋯×AnA_1 \times \cdots \times A_n, is the set of all ordered nn-tuples with ai∈Aia_i \in A_i for i=1,…,ni = 1, \ldots, n
  • An n-ary relation on sets A1,…,AnA_1, \ldots, A_n is a subset of A1×⋯×AnA_1 \times \cdots \times A_n

Terminology:

  • Binary = 2-ary (double = 2-tuple)
  • Ternary = 3-ary (triple = 3-tuple)
  • Quaternary = 4-ary (quadruple = 4-tuple)

Functions vs Relations

  • A function is a special relation
  • A function from a set AA to a set BB is a binary relation RR on A,BA, B such that:
    • For each a∈Aa \in A there is exactly one ordered pair in RR with first component aa

Tip: How to tell if RR is a function:

  • There must be only one outgoing link for each node on the left-hand side

Relation Operations

  • A binary relation R⊆A×BR \subseteq A \times B has an inverse R−1⊆B×AR^{-1} \subseteq B \times A defined by:

  • (b,a)∈R−1 if and only if (a,b)∈R\boxed{(b, a) \in R^{-1} \text{ if and only if } (a, b) \in R}

  • For binary relations Q⊆A×BQ \subseteq A \times B and R⊆B×CR \subseteq B \times C, the composition Q∘RQ \circ R is defined by:

  • Q∘R={(a,c)∣∃b∈B such that (a,b)∈Q and (b,c)∈R}\boxed{Q \circ R = \{(a, c) | \exists b \in B \text{ such that } (a, b) \in Q \text{ and } (b, c) \in R\}}

Exercise: Show that if f:A→Bf : A \to B is a bijection, then f−1f^{-1} is also a bijection from BB to AA.

Types of Relations

For a relation R⊆A×AR \subseteq A \times A:

  • Reflexive: if for each a∈Aa \in A, (a,a)∈R(a, a) \in R (self loops)
  • Symmetric: if (a,b)∈R(a, b) \in R whenever (b,a)∈R(b, a) \in R (back and forth)
  • Transitive: if whenever (a,b)∈R(a, b) \in R and (b,c)∈R(b, c) \in R then (a,c)∈R(a, c) \in R
  • Equivalence relation: if it is reflexive, transitive, and symmetric

Examples of relation types:

  • Married relationship: symmetric
  • Ancestor relationship: transitive
  • Same nationality: equivalence relation

Equivalence Classes

  • Let RR be an equivalence relation on a set AA. For each a∈Aa \in A, the equivalence class of aa with respect to RR is:
  • [a]R={b∣(a,b)∈R}\boxed{[a]_R = \{b | (a, b) \in R\}}
  • When the relation RR is understood, we simply write [a][a] for [a]R[a]_R

Property: Let RR be an equivalence relation on a set AA. Then for any two elements a,b∈Aa, b \in A, either [a]R=[b]R[a]_R = [b]_R or [a]R,[b]R[a]_R, [b]_R are disjoint.

  • A modulo R: A/R={[a]R∣a∈A}A/R = \{[a]_R | a \in A\}

Theorem: Let RR be an equivalence relation on a set AA. Then A/RA/R is a partition of AA.

Example of Equivalence Relations

  • Let Z+\mathbb{Z}^+ be the set of positive integers
  • Define an equivalence relation ∼⊆(Z+×Z+)×(Z+×Z+)\sim \subseteq (\mathbb{Z}^+ \times \mathbb{Z}^+) \times (\mathbb{Z}^+ \times \mathbb{Z}^+) as follows:
  • (p,q)∼(r,s)(p, q) \sim (r, s) iff ps=qrps = qr
  • The ∼\sim is an equivalence relation characterizing the rational numbers
  • The set (Z+×Z+)/∼(\mathbb{Z}^+ \times \mathbb{Z}^+)/\sim is the set of rational numbers

Orders

  • A relation R⊆A×AR \subseteq A \times A is antisymmetric if whenever (a,b)∈R(a, b) \in R and a≠ba \neq b then (b,a)∉R(b, a) \notin R
  • A relation that is reflexive, transitive and antisymmetric is called a partial order
  • A partial order R⊆A×AR \subseteq A \times A is called a total order if for all a,b∈Aa, b \in A, either (a,b)∈R(a, b) \in R or (b,a)∈R(b, a) \in R

Paths and Cycles

  • A path from aa to bb in a binary relation R⊆A×AR \subseteq A \times A is a sequence a1,…,an,n≥1a_1, \ldots, a_n, n \geq 1 such that:
    • a=a1a = a_1, b=anb = a_n
    • For each i∈{1,…,n−1}i \in \{1, \ldots, n-1\}, (ai,ai+1)∈R(a_i, a_{i+1}) \in R
  • A path a1,…,ana_1, \ldots, a_n is a cycle if a1=ana_1 = a_n and all $a_i

4. Finite Sets and Infinite Sets

Counting

  • Equinumerous sets: Two sets A,BA, B are equinumerous if there is a bijection f:A→Bf : A \to B
  • Cardinality: We say that the cardinality of AA is nn if AA is equinumerous with the set {1,...,n}\{1,..., n\}
  • Countably infinite: AA is countably infinite if it is equinumerous with the set of natural numbers N={0,1,2,...}\mathbb{N} = \{0, 1, 2,...\}
  • Uncountably infinite: AA is uncountably infinite if it is infinite and not equinumerous with the set of natural numbers

Think of cardinality as a way to measure "how many" elements are in a set. It's like counting, but extended to infinite sets too.

Examples and Properties

  • Positive odd numbers: A={1,3,5,7,...}A = \{1, 3, 5, 7, ...\} is countably infinite
    • Can map each element to a distinct integer using f(n)=2n−1f(n) = 2n - 1
  • Positive even numbers: B={2,4,6,8,...}B = \{2, 4, 6, 8, ...\} is countably infinite
    • Can map using f(n)=2nf(n) = 2n

Key Theorems

  • Every subset of a finite set is finite
  • Every subset of a countably infinite set is finite or countably infinite
  • The set N×N\mathbb{N} \times \mathbb{N} is countably infinite (using dovetailing technique)
  • Union theorem: The union of countably infinite collection of countably infinite sets is again countably infinite

The dovetailing technique is like systematically traversing a grid - you can count all pairs (i,j)(i,j) by going diagonally through the infinite grid.

5. Three Fundamental Proof Techniques

1. Principle of Mathematical Induction

Statement: Let AA be a set of natural numbers such that:

  1. 0∈A0 \in A
  2. For each natural number nn, if {0,1,...,n}⊆A\{0, 1,..., n\} \subseteq A then n+1∈An + 1 \in A

Then A=NA = \mathbb{N}

Mathematical induction is like climbing an infinite ladder - if you can get on the first rung (base case) and you can always step from one rung to the next (inductive step), then you can reach any rung.

Example 1: Sum Formula

Prove: 1+2+⋯+n=n(n+1)2\boxed{1 + 2 + \cdots + n = \frac{n(n + 1)}{2}}

Base case: n=1n = 1: 1=1(1+1)2=11 = \frac{1(1 + 1)}{2} = 1 ✓

Inductive step: Assume true for nn, prove for n+1n + 1:
1+2+⋯+n+(n+1)=(1+2+⋯+n)+(n+1)1 + 2 + \cdots + n + (n+1) = (1 + 2 + \cdots + n) + (n+1)
=n(n+1)2+(n+1) (by induction hypothesis)= \frac{n(n+1)}{2} + (n+1) \text{ (by induction hypothesis)}
=n(n+1)+2(n+1)2=(n+1)(n+2)2= \frac{n(n+1) + 2(n+1)}{2} = \frac{(n+1)(n+2)}{2}

Example 2: Power Set Cardinality

Prove: For any finite set AA, ∣2A∣=2∣A∣\boxed{|2^A| = 2^{|A|}}

Base case: ∣A∣=0|A| = 0, then A=∅A = \emptyset, and 2A={∅}2^A = \{\emptyset\}, so ∣2A∣=1=20|2^A| = 1 = 2^0

Inductive step: Let ∣A∣=n+1|A| = n + 1. Pick element a∈Aa \in A, let B=A−{a}B = A - \{a\}.

  • By induction hypothesis: ∣2B∣=2n|2^B| = 2^n
  • The power set 2A2^A can be partitioned into:
    • Sets not containing aa: these are exactly 2B2^B
    • Sets containing aa: these are {C∪{a}:C∈2B}\{C \cup \{a\} : C \in 2^B\}
  • Therefore: ∣2A∣=∣2B∣+∣2B∣=2⋅2n=2n+1|2^A| = |2^B| + |2^B| = 2 \cdot 2^n = 2^{n+1}

2. The Pigeonhole Principle

Statement: If A,B are finite sets and ∣A∣>∣B∣, then there is no one-to-one function from A to B\boxed{\text{If } A, B \text{ are finite sets and } |A| > |B|, \text{ then there is no one-to-one function from } A \text{ to } B}

If you have more pigeons than pigeonholes, at least one pigeonhole must contain more than one pigeon.

Exercises
  • 79 students, 70 chairs: Is it possible to give each student a separate chair?

    • Answer: No, by pigeonhole principle since 79>7079 > 70
  • Society problem: 5×1065 \times 10^6 men and 5×106+15 \times 10^6 + 1 women. Can each woman get her own man?

    • Answer: No, since there are more women than men
Proof by Induction

Base case: ∣B∣=0|B| = 0, so B=∅B = \emptyset. No function f:A→Bf: A \to B exists at all.

Inductive hypothesis: Assume true when ∣B∣≤n|B| \leq n

Inductive step: Let ∣B∣=n+1|B| = n + 1 and ∣A∣>∣B∣|A| > |B|. Pick a∈Aa \in A.

  • If another element a′∈Aa' \in A satisfies f(a)=f(a′)f(a) = f(a'), then ff is not one-to-one
  • Otherwise, consider g:A−{a}→B−{f(a)}g: A - \{a\} \to B - \{f(a)\} that agrees with ff
  • Since ∣A−{a}∣=∣A∣−1>∣B∣−1=∣B−{f(a)}∣|A - \{a\}| = |A| - 1 > |B| - 1 = |B - \{f(a)\}|, by induction hypothesis gg is not one-to-one
  • Therefore ff is not one-to-one
Application: Path Length Theorem

Theorem: Let RR be a binary relation on a finite set AA, and let a,b∈Aa, b \in A. If there is a path from aa to bb in RR, then there is a path of length at most ∣A∣|A|.

Proof: If the shortest path has length >∣A∣> |A|, then by pigeonhole principle, some element repeats in the path. We can remove the cycle to get a shorter path, contradiction.

3. The Diagonalization Principle

อาจจะให้โชว์ D เฉย ๆ นะ

Statement: Let RR be a binary relation on a set AA, and let:

  • D={a:a∈A and (a,a)∉R}D = \{a : a \in A \text{ and } (a, a) \notin R\} (diagonal set)
  • For each a∈Aa \in A: Ra={b:b∈A and (a,b)∈R}R_a = \{b : b \in A \text{ and } (a, b) \in R\} (row set)

Then D is distinct from each Ra\boxed{D \text{ is distinct from each } R_a}

Imagine RR as a grid/table where rows and columns are labeled with elements of AA. The diagonal set DD is constructed by "flipping" the main diagonal - if there's a cross, remove it; if there's no cross, add one. This new diagonal will be different from every row.

Example

Let A={1,2,3,4,5}A = \{1, 2, 3, 4, 5\} and
R={(1,3),(2,4),(3,5),(5,1),(2,3),(1,1),(4,2),(4,4)}R = \{(1, 3), (2, 4), (3, 5), (5, 1), (2, 3), (1, 1), (4, 2), (4, 4)\}

Finding the sets:

  • R1={1,3}R_1 = \{1, 3\} (elements related to 1)
  • R2={3,4}R_2 = \{3, 4\} (elements related to 2)
  • R3={5}R_3 = \{5\} (elements related to 3)
  • R4={2,4}R_4 = \{2, 4\} (elements related to 4)
  • R5={1}R_5 = \{1\} (elements related to 5)
  • D={2,3,5}D = \{2, 3, 5\} (elements not related to themselves)

You can verify that DD doesn't match any RiR_i.

Variations
  • Column sets: Ca={b:b∈A and (b,a)∈R}C_a = \{b : b \in A \text{ and } (b, a) \in R\}

    • Would the diagonal principle still hold? (Exercise for consideration)
  • Complement diagonal: D′={a:a∈A and (a,a)∈R}D' = \{a : a \in A \text{ and } (a, a) \in R\}

    • Would the diagonal principle still hold? (Exercise for consideration)
Major Application: Uncountability of Power Set

Theorem: The set 2N is uncountably infinite\boxed{\text{The set } 2^{\mathbb{N}} \text{ is uncountably infinite}}

Proof by contradiction:

  1. Assume 2N2^{\mathbb{N}} is countably infinite
  2. Then there exists a bijection f:N→2Nf: \mathbb{N} \to 2^{\mathbb{N}}
  3. Define relation R={(n,m):m∈f(n)}R = \{(n, m) : m \in f(n)\}
  4. By diagonalization principle, the diagonal set D={n:n∉f(n)}D = \{n : n \notin f(n)\} is different from every Rn=f(n)R_n = f(n)
  5. But this means DD is not in the range of ff, contradicting that ff is onto
  6. Therefore, 2N2^{\mathbb{N}} is uncountably infinite

This proof shows there are "more" subsets of natural numbers than there are natural numbers themselves - a profound result about the nature of infinity.

Summary

These three proof techniques are fundamental tools in mathematics:

  • Mathematical Induction: Proves statements about all natural numbers by establishing a base case and inductive step
  • Pigeonhole Principle: Shows impossibility of certain mappings when there are more objects than containers
  • Diagonalization Principle: Constructs objects that differ from all objects in a given collection, often used to prove impossibility results

Each technique has its own domain of application and together they form a powerful toolkit for mathematical reasoning.

6. Alphabet and Languages

[This section would be covered in subsequent pages of the document]