Lesson 1 of the mathematical toolkit for automata theory. It covers sets and set-builder notation, the algebra of union, intersection, and complement, power sets, and Cartesian products. It then works through binary relations and their properties, equivalence relations and partitions, partial orders, and functions classified as injective, surjective, and bijective. It targets the classic confusions between membership and the subset relation, between a codomain and a range, and between the ordered pair (a,b) and the set {a,b}. All computations were verified by hand.
Subject: Theory of Computation · 105 slides · symbolic lesson
Open the interactive version of this deck · Homework for this lesson
Title
Theory of Computation · Lesson 1
The mathematical language every automaton, grammar, and proof is written in.
Objectives
This is the vocabulary the whole course is built on. By the end you can:
Section
Section 1
Concept
A set is any well-defined collection of distinct objects. The only question a set ever answers is: is this thing in, or out?
We write membership with the epsilon symbol and non-membership with a slash through it:
\[ 3 \in \{1,2,3\} \qquad 4 \notin \{1,2,3\} \]
element — An object that belongs to a set. Membership is all-or-nothing: an object is either an element of a set or it is not.
Counterexample
Discussion prompt
A set is any well-defined collection of distinct objects. The only question a set ever answers is: is this thing in, or out?
That is stated as though it always holds. Do one of two things: produce a case where it fails, or say precisely what rules such a case out. "It just does" is not on the menu.
Hint: Hunt at the extremes first — zero, one, negative, empty, equal. If every extreme survives, the reason they survive is the proof.
Answer:
We write membership with the epsilon symbol and non-membership with a slash through it:
Intuition
Think of a set as a bag. You can ask whether something is inside, but the bag has no first item, no order, and no repeats — putting the same thing in twice changes nothing.
So these three descriptions are the same set — order and repetition are invisible:
\[ \{1,2,3\} = \{3,1,2\} = \{1,2,2,3,3,3\} \]
Two sets are equal exactly when they have the same members. Nothing else about how you wrote them matters.
Analogy
Discussion prompt
Explain A set is a bag with no order and no duplicates by analogy to something with no Theory of Computation in it at all — a queue, a recipe, a map, a bank balance, whatever fits. Then say where your analogy breaks.
Hint: An analogy that never breaks is not an analogy, it is the same idea wearing a hat. Find the seam — that is the part that is actually new.
Answer:
Think of a set as a bag. You can ask whether something is inside, but the bag has no first item, no order, and no repeats — putting the same thing in twice changes nothing.
Concept
Roster notation lists the members explicitly between braces:
\[ A = \{2,4,6,8\} \]
Set-builder notation states a property; the set is every object that satisfies it. Read the vertical bar as such that:
\[ A = \{\, x \mid x \text{ is even and } 0 < x < 10 \,\} \]
Set-builder is essential once a set is infinite or too big to list — you cannot roster all the primes, but you can describe them.
Explain it
Discussion prompt
Explain Two ways to name a set to a student a year behind you. No notation, no jargon they have not met — and it still has to be true.
Hint: If your explanation needs a symbol they have never seen, you are describing the notation rather than the idea.
Answer:
Set-builder is essential once a set is infinite or too big to list — you cannot roster all the primes, but you can describe them.
Ranking
Put in order
Put the moves of Describe one set two ways into the order they have to happen.
Why: These are the moves of the worked example in the order it makes them, and each one is set up by the one before it. Name the universe the variable ranges over, then the condition that selects members.
Worked example
Write the set of positive even integers below ten in both notations, and confirm the two descriptions agree.
Write the defining property in set-builder form
Why: Name the universe the variable ranges over, then the condition that selects members.
\[ A = \{\, x \in \mathbb{Z} \mid x \text{ even},\ 0 < x < 10 \,\} \]
List every integer that satisfies the property
Why: Walk the integers from 1 to 9 and keep the even ones: 2, 4, 6, 8.
\[ A = \{2,4,6,8\} \]
Verify the two descriptions name the same set
Why: Each listed number is even and strictly between 0 and 10, and no even number in that range was left out. Same members, so the same set.
\[ \{2,4,6,8\} = \{\, x \in \mathbb{Z} \mid x \text{ even},\ 0 < x < 10 \,\} \]
Picture it
Animation
Shows: Each line of the worked example "Describe one set two ways", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Each listed number is even and strictly between 0 and 10, and no even number in that range was left out. Same members, so the same set.
Concept
The empty set has no members at all. It is written two equivalent ways, and there is only one of it:
\[ \varnothing = \{\,\} \]
A singleton is a set with exactly one member. Crucially, the box is not the thing inside it:
\[ \varnothing \neq \{\varnothing\} \]
The left side is empty; the right side is a set containing one thing — that thing just happens to be the empty set. A bag holding an empty bag is not empty.
Concept
One set is a subset of another when every member of the first is also a member of the second:
\[ A \subseteq B \iff \big(\forall x)(x \in A \Rightarrow x \in B\big) \]
proper subset — A subset that is not the whole set: A is contained in B but B has at least one extra member. Written with the strict-containment symbol.
Set equality is just containment in both directions — the standard way to prove two sets are equal:
\[ A = B \iff A \subseteq B \ \text{and}\ B \subseteq A \]
Definition probe
Sort into buckets
Every line below is part of the definition of element or of proper subset — one or the other, never both. Put each where it belongs.
Intuition
"A is a subset of B" is a promise: pick any member of A you like — I guarantee it is also in B. It says nothing about B's other members.
Two edge cases fall right out of the definition. The empty set is a subset of everything (there is no member to violate the promise), and every set is a subset of itself.
\[ \varnothing \subseteq B \qquad\text{and}\qquad B \subseteq B \]
Step zero
Discussion prompt
Prove one set is a subset of another — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: State what must be checked
Answer:
Worked example
Show that the set of even numbers in the first bag sits inside the second bag.
\[ A = \{2,4\}, \quad B = \{1,2,3,4,5\} \]
State what must be checked
Why: By definition of subset, every element of A must be shown to live in B. A has two elements, so there are two checks.
Check each element of A in turn
Why: 2 appears in B, and 4 appears in B. Every member of A passed.
\[ 2 \in B \ \checkmark \qquad 4 \in B \ \checkmark \]
Verify the containment holds
Why: Both members of A were found in B and none failed, so the promise is kept for every element of A.
\[ A \subseteq B \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Prove one set is a subset of another", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: 2 appears in B, and 4 appears in B. Every member of A passed.
Anomaly
Predict first
A student writes this, and it looks reasonable:
Given the set below, a student writes that 2 is a subset of it.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: Confuses 'is in' with 'is contained in'.
Ask the right question of each object: is it an element, or is it a sub-collection?
Why: Confuses 'is in' with 'is contained in'. The symbol for a single element sitting inside a set is not the subset symbol.
Trap
Given the set below, a student writes that 2 is a subset of it.
\[ S = \{\, 1,\ 2,\ \{2,3\} \,\} \]
Claim 2 ⊆ S
Why: Confuses 'is in' with 'is contained in'. The symbol for a single element sitting inside a set is not the subset symbol.
\[ 2 \subseteq S \quad \text{(nonsense: 2 is not a set)} \]
Ask the right question of each object: is it an element, or is it a sub-collection?
\[ S = \{\, 1,\ 2,\ \{2,3\} \,\} \]
2 is an element; {2} is a subset
Why: 2 sits directly in S, so 2 is a member. The one-element set {2} is a subset because its only member, 2, is in S.
\[ 2 \in S \qquad \{2\} \subseteq S \]
Mind the nested set
Why: The pair {2,3} is a single element of S. So {2,3} is a member of S, but it is not a subset of S (3 is not an element of S).
\[ \{2,3\} \in S \qquad \{2,3\} \not\subseteq S \]
Notation
Annotate
From Trap: membership is not subset — read this one piece at a time. What is each part doing?
On: \( S = \{\, 1,\ 2,\ \{2,3\} \,\} \)
Pattern
1. To show A ⊆ B, take an arbitrary element of A
Why: Start every subset proof with 'let x be any element of A' — you must handle all of them, so name a generic one.
2. Reason from x ∈ A to x ∈ B
Why: Use the definitions of A and B to argue the chosen element must satisfy B's condition.
3. To show A = B, prove containment both ways
Why: Prove A ⊆ B and then B ⊆ A. Two one-directional proofs together give equality.
4. Keep ∈ and ⊆ straight
Why: Use ∈ between an element and a set; use ⊆ between two sets. A quick type-check catches most errors.
Check
Look carefully at what is an element and what is a set.
\[ S = \{\, a,\ \{a\},\ \{a,b\} \,\} \]
Check your understanding
Which statement about S is TRUE?
Answer: A
Why: The object {a} is listed directly in S, so {a} ∈ S. It is also a subset, because its only element a is itself listed in S, so {a} ⊆ S. Both hold at once, which is exactly why the two symbols must be kept separate.
Section
Section 2
Concept
The union collects everything in either set; the intersection keeps only what is in both. They are the set versions of or and and.
\[ A \cup B = \{\, x \mid x \in A \ \text{or}\ x \in B \,\} \]
\[ A \cap B = \{\, x \mid x \in A \ \text{and}\ x \in B \,\} \]
disjoint — Two sets are disjoint when they share no members, that is, when their intersection is the empty set.
Intuition
Union is the generous door: to get in, you only need to belong to one of the two sets. That is why a union is never smaller than either set it came from.
Intersection is the strict door: you must belong to both sets at once. That is why an intersection is never larger than either set.
\[ A \cap B \subseteq A \subseteq A \cup B \]
Hypothesis
Predict first
Compute a union and an intersection is about to be worked. State your hypothesis first: which rule or definition decides this one, and what is the first move it forces? Then watch whether the example agrees with you.
Correct: Union: sweep up everything from both, listing each once
Why: Take all of A, then add any member of B not already present. 5 and 6 are new; duplicates 3 and 4 are written only once.
A hypothesis you wrote down is falsifiable; a vague sense of how it will go is not. If the example opens somewhere else, that gap is the thing worth chasing.
Worked example
With the two sets below, find their union and their intersection.
\[ A = \{1,2,3,4\}, \quad B = \{3,4,5,6\} \]
Union: sweep up everything from both, listing each once
Why: Take all of A, then add any member of B not already present. 5 and 6 are new; duplicates 3 and 4 are written only once.
\[ A \cup B = \{1,2,3,4,5,6\} \]
Intersection: keep only the shared members
Why: Scan for numbers appearing in both lists. 3 and 4 are in each; 1, 2, 5, 6 are not.
\[ A \cap B = \{3,4\} \]
Verify the sizes are consistent
Why: Inclusion-exclusion predicts the union size: 4 + 4 − 2 = 6, matching the six elements listed. The count checks out.
\[ |A \cup B| = |A| + |B| - |A \cap B| = 4 + 4 - 2 = 6 \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Compute a union and an intersection", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Inclusion-exclusion predicts the union size: 4 + 4 − 2 = 6, matching the six elements listed. The count checks out.
Concept
The difference keeps what is in the first set but not the second — a set-level subtraction:
\[ A \setminus B = \{\, x \mid x \in A \ \text{and}\ x \notin B \,\} \]
The complement is difference from a fixed universe U of everything under discussion — the members of U outside of A:
\[ \overline{A} = U \setminus A = \{\, x \in U \mid x \notin A \,\} \]
Anomaly
Predict first
A student writes this, and it looks reasonable:
A student is asked for the complement of the even numbers and answers as if it were absolute.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: Assumes a universe silently. Without declaring U, 'everything not in A' is ambiguous — odd integers?
Fix the universe first, then the complement is well-defined.
Why: Assumes a universe silently. Without declaring U, 'everything not in A' is ambiguous — odd integers? Odd reals? Non-numbers?
Trap
A student is asked for the complement of the even numbers and answers as if it were absolute.
\[ A = \{\, x \mid x \text{ is even} \,\} \]
Write 'the complement is all odd numbers' with no universe stated
Why: Assumes a universe silently. Without declaring U, 'everything not in A' is ambiguous — odd integers? Odd reals? Non-numbers?
\[ \overline{A} = \{\text{odd numbers}\}\ ? \]
Fix the universe first, then the complement is well-defined.
\[ U = \mathbb{Z}, \quad A = \{\, x \in \mathbb{Z} \mid x \text{ is even} \,\} \]
Complement relative to that universe
Why: Now 'everything in U not in A' has one meaning: the odd integers. Change U to the reals and the complement changes too.
\[ \overline{A} = \mathbb{Z} \setminus A = \{\, x \in \mathbb{Z} \mid x \text{ is odd} \,\} \]
Break the constraint
Discussion prompt
The rule this trap just fixed:
Fix the universe first, then the complement is well-defined.
Now break it on purpose. Build a case that violates it and follow the consequences until something visibly fails. Where does the failure first show up — and would you have noticed it if you had not been looking?
Hint: The dangerous rules are the ones whose violation still produces an answer. If yours fails loudly, try to find one that fails quietly.
Answer:
Assumes a universe silently. Without declaring U, 'everything not in A' is ambiguous — odd integers? Odd reals? Non-numbers?
Concept
Union and intersection behave like a well-mannered algebra. They commute and associate, and each distributes over the other:
\[ A \cap (B \cup C) = (A \cap B) \cup (A \cap C) \]
The two laws you will lean on most in this course are De Morgan's laws — a complement turns union into intersection and vice versa:
\[ \overline{A \cup B} = \overline{A} \cap \overline{B} \qquad \overline{A \cap B} = \overline{A} \cup \overline{B} \]
Step zero
Discussion prompt
Verify a De Morgan law on real sets — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Left side: complement of the union
Answer:
Worked example
Confirm the first De Morgan law with concrete sets inside a universe.
\[ U = \{1,2,3,4,5,6\}, \ A = \{1,2,3\}, \ B = \{3,4,5\} \]
Left side: complement of the union
Why: The union A ∪ B = {1,2,3,4,5}; the only member of U left out is 6.
\[ \overline{A \cup B} = U \setminus \{1,2,3,4,5\} = \{6\} \]
Right side: intersect the two complements
Why: The complement of A is {4,5,6} and the complement of B is {1,2,6}; their shared member is 6.
\[ \overline{A} \cap \overline{B} = \{4,5,6\} \cap \{1,2,6\} = \{6\} \]
Verify both sides match
Why: Left side and right side both equal the singleton {6}, so the law holds for this instance.
\[ \overline{A \cup B} = \{6\} = \overline{A} \cap \overline{B} \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Verify a De Morgan law on real sets", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Left side and right side both equal the singleton {6}, so the law holds for this instance.
Pattern
1. Fix the universe
Why: Any complement is meaningless until you know the universe U it is taken against.
2. Evaluate inside-out
Why: Resolve the innermost parentheses first, exactly like arithmetic, building up the outer operations from the inner results.
3. To prove two expressions equal, argue membership both ways
Why: Show any x in the left side is in the right side, and vice versa — an element chase — or use the named laws to rewrite one into the other.
4. Sanity-check with sizes
Why: Inclusion-exclusion and the containment A ∩ B ⊆ A ⊆ A ∪ B catch many arithmetic slips.
Check
Work inside-out on paper before choosing.
\[ A = \{1,2,3,4\}, \ B = \{2,4,6\}, \ C = \{1,4\} \]
Check your understanding
Compute (A ∩ B) \ C.
Answer: A
Why: First A ∩ B = {2,4}, the numbers in both. Then remove the members of C = {1,4}: drop 4, keep 2. So (A ∩ B) \ C = {2}.
Section
Section 3
Concept
The power set of a set A is the set whose members are every subset of A — including the empty set and A itself.
\[ \mathcal{P}(A) = \{\, S \mid S \subseteq A \,\} \]
It is a set of sets. Notice the level shift: the members of A are objects, but the members of the power set are themselves sets.
Intuition
To build a subset of A, walk down A's elements and make one yes/no choice per element: include it, or not? A subset is exactly one such sequence of choices.
With n elements and 2 choices each, the multiplication principle gives the number of subsets — and hence the size of the power set:
\[ |\mathcal{P}(A)| = 2^{|A|} \]
Estimation
Predict first
List every subset of the three-element set below.
Commit before you compute: what does Build a power set and count it come out to? A rough magnitude and the right form is enough — the point is to have something concrete to be wrong about.
Correct: Verify the count against the formula
Why: A prediction you can defend turns the computation into a check rather than a leap of faith — and an answer that contradicts it is caught on the spot. The set has 3 elements, so the formula predicts 2 to the third power = 8 subsets, exactly the number listed.
Worked example
List every subset of the three-element set below.
\[ A = \{a,b,c\} \]
Organize subsets by size
Why: Grouping by how many elements each subset has guarantees you miss none: one empty, three singletons, three pairs, one full set.
\[ \varnothing;\ \{a\},\{b\},\{c\};\ \{a,b\},\{a,c\},\{b,c\};\ \{a,b,c\} \]
Assemble the power set
Why: Collect all eight subsets into one set of sets.
\[ \mathcal{P}(A) = \{\varnothing,\{a\},\{b\},\{c\},\{a,b\},\{a,c\},\{b,c\},\{a,b,c\}\} \]
Verify the count against the formula
Why: The set has 3 elements, so the formula predicts 2 to the third power = 8 subsets, exactly the number listed.
\[ |\mathcal{P}(A)| = 2^{3} = 8 \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Build a power set and count it", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: The set has 3 elements, so the formula predicts 2 to the third power = 8 subsets, exactly the number listed.
Concept
An ordered pair records two things in a fixed order. Unlike a set, order matters and repeats are allowed:
\[ (a,b) = (c,d) \iff a = c \ \text{and}\ b = d \]
The Cartesian product of A and B is the set of all ordered pairs with first component from A and second from B:
\[ A \times B = \{\, (a,b) \mid a \in A,\ b \in B \,\} \]
Intuition
Lay A down one axis and B across the other. Every cell of the grid is one ordered pair, so the product is the whole grid of combinations.
Counting the cells is just rows times columns — which is why the size of a product multiplies:
\[ |A \times B| = |A| \cdot |B| \]
Ranking
Put in order
Put the moves of Compute a Cartesian product into the order they have to happen.
Why: These are the moves of the worked example in the order it makes them, and each one is set up by the one before it. Hold 1 and run through B, then hold 2 and run through B.
Worked example
Form the product of the two sets below.
\[ A = \{1,2\}, \quad B = \{x,y\} \]
Pair each element of A with each element of B
Why: Hold 1 and run through B, then hold 2 and run through B. First component from A, second from B, every time.
\[ A \times B = \{(1,x),(1,y),(2,x),(2,y)\} \]
Note that order matters
Why: The reverse product B × A contains (x,1), which is a different pair from (1,x); the two products are not equal.
\[ B \times A = \{(x,1),(y,1),(x,2),(y,2)\} \]
Verify the size
Why: Both sets have 2 elements, so the formula predicts 2 times 2 = 4 pairs, matching the four listed.
\[ |A \times B| = |A|\cdot|B| = 2 \cdot 2 = 4 \ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Compute a Cartesian product", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Both sets have 2 elements, so the formula predicts 2 times 2 = 4 pairs, matching the four listed.
Anomaly
Predict first
A student writes this, and it looks reasonable:
A student treats the ordered pair like a set, so order and repetition seem not to matter.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: Applies set rules to a pair. But a pair remembers which slot is which and allows a repeat, so both conclusions are false.
Pairs carry position; sets do not. Keep them apart.
Why: Applies set rules to a pair. But a pair remembers which slot is which and allows a repeat, so both conclusions are false.
Trap
A student treats the ordered pair like a set, so order and repetition seem not to matter.
\[ (a,b) \overset{?}{=} \{a,b\} \]
Conclude (1,2) equals (2,1) and (a,a) is just {a}
Why: Applies set rules to a pair. But a pair remembers which slot is which and allows a repeat, so both conclusions are false.
\[ (1,2) = (2,1)\ ? \qquad (a,a) = \{a\}\ ? \]
Pairs carry position; sets do not. Keep them apart.
\[ (a,b) \neq \{a,b\}\ \text{in general} \]
Order distinguishes pairs
Why: (1,2) and (2,1) differ because their first components differ. As sets, {1,2} and {2,1} are identical.
\[ (1,2) \neq (2,1) \qquad \{1,2\} = \{2,1\} \]
Repeats survive in a pair
Why: (a,a) is a legitimate pair with equal components, whereas the set {a,a} collapses to the singleton {a}.
\[ (a,a)\ \text{is valid} \qquad \{a,a\} = \{a\} \]
Translation
\( (a,b) \overset{?}{=} \{a,b\} \)
Draw it
Translate both ways. First write the expression above as a sentence with no symbols in it at all. Then cover it, and write your sentence back as notation. If the two versions disagree, the disagreement is the thing to fix.
Pattern
1. Power set doubles per element
Why: Each element is an independent in/out choice, so n elements give 2-to-the-n subsets.
2. Product multiplies the factor sizes
Why: Each ordered pair is an independent choice of first then second component, so |A| times |B| pairs.
3. Watch the level shift
Why: Members of a power set are sets; members of a product are ordered tuples. Neither is a plain element of the original set.
Elimination
Eliminate the wrong options
How many elements does the power set 𝒫(A) have?
3 of these 4 are wrong. Strike them one at a time, and say what rules each one out before you strike the next. The survivor is the answer.
Survives elimination: A
Why: A has 4 elements, and the power set has 2 raised to the number of elements: 2 to the 4th is 16. That counts every subset, from the empty set up to A itself.
Check
No need to list them all — count.
\[ A = \{1,2,3,4\} \]
Check your understanding
How many elements does the power set 𝒫(A) have?
Answer: A
Why: A has 4 elements, and the power set has 2 raised to the number of elements: 2 to the 4th is 16. That counts every subset, from the empty set up to A itself.
Section
Section 4
Concept
A binary relation on a set A is simply any subset of the product A cross A. Each pair in it records that two elements are related.
\[ R \subseteq A \times A \]
When the pair (a,b) is in R we say a is related to b, often written in the shorthand:
\[ (a,b) \in R \iff a\,R\,b \]
Intuition
Draw a dot for each element of A. For every pair (a,b) in R, draw an arrow from a to b. The relation is that picture of arrows — nothing more.
Each property we are about to define is just a visible shape in that picture: a loop at every dot, arrows that always come in both directions, or shortcuts you can always follow.
Concept
A relation is reflexive when every element is related to itself — a loop at every dot in the graph.
\[ \forall a \in A:\ (a,a) \in R \]
Familiar example: 'is less than or equal to' on numbers is reflexive, because every number is at most itself. 'Is strictly less than' is not.
Concept
Symmetric: whenever a is related to b, b is related back to a. Every arrow has a partner going the other way.
\[ \forall a,b:\ (a,b)\in R \Rightarrow (b,a)\in R \]
Antisymmetric: the only way to have arrows both directions between two elements is if they are the same element. It is the near-opposite of symmetric.
\[ \forall a,b:\ (a,b)\in R \ \text{and}\ (b,a)\in R \Rightarrow a = b \]
Concept
Transitive: whenever you can hop from a to b and from b to c, there is a direct arrow from a to c — every two-step path has a one-step shortcut.
\[ \forall a,b,c:\ (a,b)\in R \ \text{and}\ (b,c)\in R \Rightarrow (a,c)\in R \]
Example: 'is an ancestor of' is transitive — an ancestor of your ancestor is your ancestor. 'Is a parent of' is not.
Step zero
Discussion prompt
Test a relation for all four properties — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Reflexive? No
Answer:
Worked example
Classify this relation on the set below.
\[ A = \{1,2,3\}, \quad R = \{(1,2),(2,3),(1,3)\} \]
Reflexive? No
Why: Reflexive needs (1,1), (2,2), and (3,3). None of these self-loops is present, so the relation fails reflexivity.
\[ (1,1) \notin R \]
Symmetric? No. Antisymmetric? Yes
Why: (1,2) is present but (2,1) is not, so not symmetric. No pair appears in both directions, so antisymmetry holds vacuously.
\[ (1,2)\in R,\ (2,1)\notin R \]
Transitive? Yes
Why: The only two-step path is 1 to 2 to 3, and the shortcut (1,3) is present. No other chain exists to check.
\[ (1,2),(2,3)\in R \Rightarrow (1,3)\in R\ \checkmark \]
Verify the verdict
Why: The relation is antisymmetric and transitive but not reflexive, so it is a strict order, not an equivalence relation. Each property was checked against its definition.
\[ \text{antisymmetric},\ \text{transitive},\ \text{not reflexive}\ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Test a relation for all four properties", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: The relation is antisymmetric and transitive but not reflexive, so it is a strict order, not an equivalence relation. Each property was checked against its definition.
Anomaly
Predict first
A student writes this, and it looks reasonable:
A student finds a relation is not symmetric and concludes it must be antisymmetric.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: Treats the two as exact opposites.
Check each property against its own definition, separately.
Why: Treats the two as exact opposites. They are independent properties — a relation can fail both, or (for the identity relation) satisfy both.
Trap
A student finds a relation is not symmetric and concludes it must be antisymmetric.
\[ R = \{(1,2),(2,1),(2,3)\}\ \text{on}\ \{1,2,3\} \]
Reason 'symmetric fails, so antisymmetric holds'
Why: Treats the two as exact opposites. They are independent properties — a relation can fail both, or (for the identity relation) satisfy both.
\[ \text{not symmetric} \Rightarrow \text{antisymmetric}\ ? \]
Check each property against its own definition, separately.
\[ R = \{(1,2),(2,1),(2,3)\} \]
Not symmetric
Why: (2,3) is present but (3,2) is not, so symmetry fails.
\[ (2,3)\in R,\ (3,2)\notin R \]
Also not antisymmetric
Why: Both (1,2) and (2,1) are present, yet 1 and 2 are different elements — the antisymmetry condition is violated. So this relation is neither.
\[ (1,2),(2,1)\in R \ \text{but}\ 1 \neq 2 \]
Notation
Annotate
From Trap: not symmetric does not mean antisymmetric — read this one piece at a time. What is each part doing?
On: \( (1,2),(2,1)\in R \ \text{but}\ 1 \neq 2 \)
Concept
A relation that is reflexive, symmetric, and transitive all at once is an equivalence relation. It is the abstract notion of 'behaves the same as'.
\[ \text{reflexive} + \text{symmetric} + \text{transitive} \]
equivalence class — For an element a, the set of everything related to a. Written [a]. It gathers all the elements that count as the same as a.
Intuition
An equivalence relation quietly sorts the set into non-overlapping bins: everything in a bin is related to everything else in that bin, and to nothing outside it.
These bins are the equivalence classes, and together they form a partition — the whole set carved into disjoint, non-empty pieces that cover everything.
partition — A split of a set into non-empty, pairwise-disjoint subsets whose union is the whole set. Every element lands in exactly one piece.
Matching
Match the pairs
Match each term to the definition this lesson gave it — not the one you would guess from the word.
Why: These are the working definitions of element, proper subset, disjoint, equivalence class, partition as Sets, Relations & Functions uses them. Pairing them correctly is the test of whether you could state each one with the slide switched off.
Estimation
Predict first
On the set below, relate two numbers when they leave the same remainder upon division by 3. Find the equivalence classes.
Commit before you compute: what does Find the classes of 'same remainder mod 3' come out to? A rough magnitude and the right form is enough — the point is to have something concrete to be wrong about.
Correct: Verify the classes form a partition
Why: A prediction you can defend turns the computation into a check rather than a leap of faith — and an answer that contradicts it is caught on the spot. The three classes are disjoint and their union is all nine elements of A, so every number lies in exactly one class — a genuine partition.
Worked example
On the set below, relate two numbers when they leave the same remainder upon division by 3. Find the equivalence classes.
\[ A = \{0,1,2,3,4,5,6,7,8\} \]
Group by remainder mod 3
Why: Remainder 0, remainder 1, and remainder 2 are the only possibilities, so there are exactly three classes.
\[ [0]=\{0,3,6\},\ [1]=\{1,4,7\},\ [2]=\{2,5,8\} \]
Confirm it is an equivalence relation
Why: 'Same remainder' is reflexive (a number shares its own remainder), symmetric (sameness is mutual), and transitive (equal to equal stays equal).
Verify the classes form a partition
Why: The three classes are disjoint and their union is all nine elements of A, so every number lies in exactly one class — a genuine partition.
\[ [0]\cup[1]\cup[2] = A,\quad \text{pairwise disjoint}\ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Find the classes of 'same remainder mod 3'", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: The three classes are disjoint and their union is all nine elements of A, so every number lies in exactly one class — a genuine partition.
Concept
Swap symmetry for antisymmetry and you get the other great family. A partial order is reflexive, antisymmetric, and transitive — the abstract notion of 'at least as big as'.
\[ \text{reflexive} + \text{antisymmetric} + \text{transitive} \]
Subset containment and 'less than or equal to' are the standard examples. It is partial because two elements can be incomparable — neither contains the other.
Pattern
1. Reflexive: check every self-loop is present
Why: Confirm (a,a) is in R for each element a of the set.
2. Symmetric / antisymmetric: scan every present pair
Why: For symmetry, each (a,b) needs its reverse. For antisymmetry, any two-way pair must have equal components.
3. Transitive: check every two-step chain
Why: For each (a,b) and (b,c), confirm the shortcut (a,c) is present. One missing shortcut breaks it.
4. Name the family
Why: Reflexive + symmetric + transitive is an equivalence relation; reflexive + antisymmetric + transitive is a partial order.
Check
Test each property against its definition first.
\[ A=\{1,2,3\},\ R=\{(1,1),(2,2),(3,3),(1,2),(2,1)\} \]
Check your understanding
Which best describes R?
Answer: A
Why: All three self-loops are present, so it is reflexive. The only off-diagonal pairs (1,2) and (2,1) come as a matched pair, so it is symmetric. Transitivity holds: (1,2) with (2,1) gives (1,1), which is present. Reflexive + symmetric + transitive means an equivalence relation.
Section
Section 5
Concept
A function from A to B is a relation that pairs each element of A with exactly one element of B — no misses, no ambiguity.
\[ f : A \to B \]
Formally, for every input there is one and only one output:
\[ \forall a \in A\ \exists!\, b \in B:\ f(a) = b \]
Intuition
Picture a vending machine. Press a button (an input) and you get exactly one item (the output). The same button always yields the same item, and every button does something.
That is the whole rule: total (every input handled) and deterministic (one output each). A relation that skips an input, or gives two outputs for one input, is not a function.
Concept
The domain is the input set A. The codomain is the declared output set B. The range is the part of B actually hit by some input.
\[ \operatorname{range}(f) = \{\, f(a) \mid a \in A \,\} \subseteq B \]
The range can be smaller than the codomain: the machine is allowed to output any item in B, but it might never actually dispense some of them.
Concept
A function is injective when different inputs always give different outputs — no two inputs collide on the same output.
\[ f(a_1) = f(a_2) \Rightarrow a_1 = a_2 \]
In arrow-diagram terms: no element of B has two arrows pointing at it. Injective functions can be undone on their range.
Concept
A function is surjective when it hits everything in the codomain — the range equals all of B, leaving no output unused.
\[ \forall b \in B\ \exists a \in A:\ f(a) = b \]
In arrow-diagram terms: every element of B has at least one arrow pointing at it. Surjectivity is a claim about the codomain, so it depends on how B was declared.
Concept
A function that is both injective and surjective is bijective — every element of B has exactly one arrow into it. It is a perfect one-to-one pairing between A and B.
\[ \text{bijective} = \text{injective} + \text{surjective} \]
Bijections are exactly the functions with a true inverse, and they are the tool we will use to say two sets have the same size — even infinite ones.
Explain it
Discussion prompt
Explain Bijective (a perfect pairing) to a student a year behind you. No notation, no jargon they have not met — and it still has to be true.
Hint: If your explanation needs a symbol they have never seen, you are describing the notation rather than the idea.
Answer:
A function that is both injective and surjective is bijective — every element of B has exactly one arrow into it. It is a perfect one-to-one pairing between A and B.
Step zero
Discussion prompt
Classify a function — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Injective? No
Answer:
Worked example
Classify the function defined by this table.
\[ g:\{1,2,3\}\to\{a,b\},\ g(1)=a,\ g(2)=b,\ g(3)=a \]
Injective? No
Why: Inputs 1 and 3 both map to a, so two different inputs collide on one output — injectivity fails.
\[ g(1)=g(3)=a,\ \text{but}\ 1 \neq 3 \]
Surjective? Yes
Why: Output a is produced (by 1) and output b is produced (by 2); the range is all of the codomain {a,b}.
\[ \operatorname{range}(g)=\{a,b\}=B \]
Verify the classification
Why: It hits every output but repeats one, so it is surjective and not injective — therefore not a bijection. Both tests were applied to their definitions.
\[ \text{surjective, not injective}\ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Classify a function", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: It hits every output but repeats one, so it is surjective and not injective — therefore not a bijection. Both tests were applied to their definitions.
Anomaly
Predict first
A student writes this, and it looks reasonable:
A student is told the codomain is the integers and calls the doubling map onto because 'it produces plenty of outputs'.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: Judges surjectivity from the range alone, ignoring the declared codomain.
Compare the range to the whole codomain the function was declared into.
Why: Judges surjectivity from the range alone, ignoring the declared codomain. Surjectivity is a comparison of range against codomain.
Trap
A student is told the codomain is the integers and calls the doubling map onto because 'it produces plenty of outputs'.
\[ f:\mathbb{Z}\to\mathbb{Z},\ f(n)=2n \]
Claim f is surjective
Why: Judges surjectivity from the range alone, ignoring the declared codomain. Surjectivity is a comparison of range against codomain.
\[ \text{'lots of outputs'} \Rightarrow \text{onto}\ ? \]
Compare the range to the whole codomain the function was declared into.
\[ f:\mathbb{Z}\to\mathbb{Z},\ f(n)=2n \]
Find the actual range
Why: Doubling any integer gives an even integer, so the range is exactly the even integers — a proper subset of the codomain.
\[ \operatorname{range}(f) = \{\text{even integers}\} \subsetneq \mathbb{Z} \]
Odd targets are missed, so not surjective
Why: No integer doubles to 3, so 3 in the codomain is never hit. Onto fails. (It is, however, injective.)
\[ \nexists\, n \in \mathbb{Z}:\ 2n = 3 \]
Two truths and a lie
Sort into buckets
Some of these hold up and some are the exact mistakes this lesson is built to prevent. Sort them.
Concept
If f goes from A to B and g goes from B to C, their composition feeds f's output into g. Read it right-to-left: f runs first.
\[ (g \circ f)(x) = g\big(f(x)\big) \]
The output type of f must match the input type of g, or the machines cannot be chained.
Analogy
Discussion prompt
Explain Composition of functions by analogy to something with no Theory of Computation in it at all — a queue, a recipe, a map, a bank balance, whatever fits. Then say where your analogy breaks.
Hint: An analogy that never breaks is not an analogy, it is the same idea wearing a hat. Find the seam — that is the part that is actually new.
Answer:
If f goes from A to B and g goes from B to C, their composition feeds f's output into g. Read it right-to-left: f runs first.
Ranking
Put in order
Put the moves of Compose two functions into the order they have to happen.
Why: These are the moves of the worked example in the order it makes them, and each one is set up by the one before it. g subtracts 3 from whatever it receives; it receives 2x+1, so replace g's input with that expression.
Worked example
Compose the two real functions below, then evaluate the composition at a point.
\[ f(x)=2x+1, \qquad g(x)=x-3 \]
Substitute f(x) into g
Why: g subtracts 3 from whatever it receives; it receives 2x+1, so replace g's input with that expression.
\[ (g\circ f)(x) = (2x+1) - 3 = 2x - 2 \]
Evaluate the formula at x = 5
Why: Plug 5 into the simplified composition 2x − 2.
\[ (g\circ f)(5) = 2(5) - 2 = 8 \]
Verify by running the two machines in order
Why: First f(5) = 2·5+1 = 11, then g(11) = 11 − 3 = 8. The step-by-step chain matches the formula's answer of 8.
\[ f(5)=11,\ g(11)=8 = (g\circ f)(5)\ \checkmark \]
Picture it
Animation
Shows: Each line of the worked example "Compose two functions", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: First f(5) = 2·5+1 = 11, then g(11) = 11 − 3 = 8. The step-by-step chain matches the formula's answer of 8.
Concept
How many functions are there from A to B? Each of the |A| inputs independently chooses one of |B| outputs, so the multiplication principle gives:
\[ \#\{\,f : A \to B\,\} = |B|^{|A|} \]
This is why the set of functions from A to B is sometimes written B-to-the-A. It also foreshadows why there are far more languages than programs — a counting argument at the heart of this course.
Counterexample
Discussion prompt
How many functions are there from A to B? Each of the |A| inputs independently chooses one of |B| outputs, so the multiplication principle gives:
That is stated as though it always holds. Do one of two things: produce a case where it fails, or say precisely what rules such a case out. "It just does" is not on the menu.
Hint: Hunt at the extremes first — zero, one, negative, empty, equal. If every extreme survives, the reason they survive is the proof.
Pattern
1. Confirm it is a function first
Why: Every input in A must map somewhere, and to only one output. No misses, no forks.
2. Injective? Assume two inputs share an output
Why: If f(a₁) = f(a₂) forces a₁ = a₂, it is one-to-one; if you can find a genuine collision, it is not.
3. Surjective? Pick an arbitrary target in B
Why: If every b in the codomain has some preimage a with f(a) = b, it is onto; a single missed target kills it.
4. Both ⇒ bijective ⇒ invertible
Why: Injective and surjective together give a bijection, the exact condition for an inverse function to exist.
Real world
Discussion prompt
Outside this lesson: where does Sets, Relations & Functions actually turn up? Name one concrete situation — a job, a piece of software someone ships, a decision somebody has to make — and say which part of Classifying any function f : A → B is doing the work in it.
Hint: Vague is the failure mode here. "Engineering" is not a situation; "deciding whether this build is fast enough to ship" is.
Answer:
Lesson 1 of the mathematical toolkit for automata theory: sets and set-builder notation, the algebra of union/intersection/complement, power sets and Cartesian products, binary relations and their properties, equivalence relations and partitions, partial orders, and functions classified as injective, surjective, and bijective. Targets the classic membership-vs-subset, codomain-vs-range, and (a,b)-vs-{a,b} confusions.
Elimination
Eliminate the wrong options
Which describes f(n) = n + 5 on the integers?
3 of these 4 are wrong. Strike them one at a time, and say what rules each one out before you strike the next. The survivor is the answer.
Survives elimination: A
Why: Injective: if n₁ + 5 = n₂ + 5 then n₁ = n₂, so no collisions. Surjective: any integer m is hit by n = m − 5, which is an integer. Both hold, so shifting by 5 is a bijection of the integers, with inverse n − 5.
Check
Test one-to-one and onto separately, using the definitions.
\[ f:\mathbb{Z}\to\mathbb{Z},\quad f(n) = n + 5 \]
Check your understanding
Which describes f(n) = n + 5 on the integers?
Answer: A
Why: Injective: if n₁ + 5 = n₂ + 5 then n₁ = n₂, so no collisions. Surjective: any integer m is hit by n = m − 5, which is an integer. Both hold, so shifting by 5 is a bijection of the integers, with inverse n − 5.
Connect it up
Draw it
One page, no notation unless you need it: draw how these connect — Sets & Membership · The Algebra of Sets · Power Sets & Products · Relations & Their Properties · Functions. Put an arrow wherever one of them is what makes another possible, and label the arrow with why.
Recap
You now have the full vocabulary of sets, relations, and functions — the language every later definition in this course is written in.
| Object | Key question |
|---|---|
| Subset A ⊆ B | Is every element of A in B? |
| Equivalence relation | Reflexive AND symmetric AND transitive? |
| Injective function | Do distinct inputs give distinct outputs? |
| Surjective function | Is every codomain element hit? |
Want this taught 1-on-1? Alexander tutors Theory of Computation — $55/session, free consultation.