Sets, Relations, and Functions
2.1 Sets
Section titled “2.1 Sets”Basic operations:
- Union:
- Intersection:
- Difference:
- Complement: (where is the universal set)
De Morgan”s Laws:
Power set: . If Then .
2.2 Relations
Section titled “2.2 Relations”A binary relation from set to set is a subset of .
A relation on is:
- Reflexive: , .
- Symmetric: .
- Antisymmetric: and .
- Transitive: and (a,c) \in R$.
Equivalence relation: reflexive, symmetric, transitive. Partitions the set into equivalence classes.
Partial order: reflexive, antisymmetric, transitive. Written .
A Hasse diagram is a graphical representation of a finite poset : an element Is drawn below whenever (i.e., and ), and an edge is drawn From to whenever covers (there is no with ).
Worked Example. Show that on defined by iff is An equivalence relation. Describe the equivalence classes.
Solution
Reflexive: So for all .
Symmetric: If Then So Giving .
Transitive: If and Then So .
The equivalence classes are . There are exactly 5 equivalence classes, forming the quotient .
Worked Example. Let be divisibility on : iff . Verify this is a partial order and identify the cover relations.
Solution
Reflexive: for all . ✓
Antisymmetric: If and Then and for positive So Giving and Hence . ✓
Transitive: If and Then So . ✓
Cover relations ( covers when 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: at the bottom with edges to and ; connects up to and ; connects up to ; and connect up to at the top.
2.3 Functions
Section titled “2.3 Functions”A function is a relation where each appears exactly once as a first element.
- Injective (one-to-one): .
- Surjective (onto): for every There exists with .
- Bijective: both injective and surjective.
Theorem 2.1. If and are finite sets, is:
- Injective if and only if .
- Surjective if and only if .
- Bijective if and only if .
Theorem 2.2 (Pigeonhole Principle). If Then no function is injective. Equivalently, placing items into boxes with forces at least one box to contain at least items.
Function composition. Given and The composition is defined by for all .
Theorem 2.3. If and are both injective, then is injective.
Proof. Suppose . Then . Since is Injective, . Since is injective, . Hence is injective.
Theorem 2.4. If and are both surjective, then is surjective.
Proof. Let . Since is surjective, with . Since is Surjective, with . Then . Hence is surjective.
Corollary 2.5. The composition of two bijections is a bijection.
A function is invertible if there exists 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
Section titled “2.4 Countability”Definition. A set is countable if it is finite or countably infinite. A set is countably infinite if there exists a bijection . A set that is not countable Is uncountable.
Theorem 2.6. is countably infinite.
Proof. The function defined by
Is a bijection, enumerating
Theorem 2.7. is countably infinite.
Proof. Every positive rational can be written as with . Arrange the Pairs in an infinite grid and traverse them diagonally:
Skipping duplicates (where in reduced form) yields an enumeration of . Extending with negatives and zero gives an enumeration of .
Theorem 2.8 (Cantor, 1891). is uncountable.
Proof (Diagonal argument). Suppose for contradiction that is countable. Then the Interval can be listed as where each has a unique decimal Expansion with each (choosing the expansion that does not end in all 9s to avoid dual representations).
Define by
Then and differs from in the -th decimal place for every So Contradicting the assumption that the list was complete. Therefore is uncountable.
flowchart TD A[2_Sets Relations And Functions] --> B[Key Concepts] A --> C[Core Principles] A --> D[Practical Applications] B --> E[Fundamental definitions] C --> F[Design patterns] D --> G[Real-world usage]Intuition
Section titled “Intuition”Sets are unordered collections of distinct elements. Relations connect elements from different sets, with properties like reflexivity, symmetry, and transitivity. Functions are special relations where each input maps to exactly one output. These concepts underpin database theory (relations), type systems (functions), and abstract algebra (groups, rings). Understanding set operations (union, intersection, complement) is essential for query languages and logic.
Common Mistakes
Section titled “Common Mistakes”Confusing reflexivity with symmetry. A reflexive relation requires for every , while symmetry requires that if then . These are independent properties: a relation can be reflexive without being symmetric, and vice versa. Always verify each property separately.
Misapplying the Pigeonhole Principle. Students often state that placing items into boxes guarantees one box has at least items, but forget the ceiling function. The correct bound is , not . For example, 5 items into 3 boxes guarantees at least 2 in one box, not 1.67.
Assuming injectivity from surjectivity (or vice versa). For finite sets, a function is injective if and only if , and surjective if and only if . These are not interchangeable: an injective function from a smaller set to a larger set cannot be surjective.
Cross-References
Section titled “Cross-References”- [[1-discrete-mathematics/1_propositional-and-predicate-logic]] - Logic foundations
- [[1-discrete-mathematics/3_proof-techniques]] - Proof techniques
- [[2-systems/databases]] - Relational database theory
- [[1-discrete-mathematics/4_combinatorics]] - Counting and sets