Recall warm-up
- If |A| = 5, what is |P(A)|?
Stuck? Peek at 0.2.1 Sets
- x ∈ A (element) vs X ⊆ A (subset). ∅ ⊆ every set. A = B ⇔ A ⊆ B and B ⊆ A.
- A ∪ B, A ∩ B, A − B = A ∩ B̅, A̅ = U − A. De Morgan: (A∪B)̅ = A̅∩B̅, (A∩B)̅ = A̅∪B̅.
- |A ∪ B| = |A| + |B| − |A ∩ B|. |A × B| = |A|·|B|. |P(A)| = 2^|A|.
- |∅| = 0, |{∅}| = 1, P(∅) = {∅}.
- Is {a} an element of {a, b}? Is it a subset?
Stuck? Peek at 0.2.1 Sets
- x ∈ A (element) vs X ⊆ A (subset). ∅ ⊆ every set. A = B ⇔ A ⊆ B and B ⊆ A.
- A ∪ B, A ∩ B, A − B = A ∩ B̅, A̅ = U − A. De Morgan: (A∪B)̅ = A̅∩B̅, (A∩B)̅ = A̅∪B̅.
- |A ∪ B| = |A| + |B| − |A ∩ B|. |A × B| = |A|·|B|. |P(A)| = 2^|A|.
- |∅| = 0, |{∅}| = 1, P(∅) = {∅}.
- How many modes does a machine need to check “length is even”?
Stuck? Peek at 0.1.1 What “computation” means
- Machine: reads a finite input symbol by symbol, changes mode, ends with yes (accept) / no (reject) — or may never end.
- Decision problem: a question whose answer is yes or no for every input.
- Machines differ by memory: finite modes → pile of plates → endless notebook → beyond all machines.
- Finite memory works iff the fact you must carry stays bounded (even/odd, remainder, “seen x?”). Unbounded counts/comparisons break it.
The Hook
A vending machine has a rule book: “If you are waiting for money and someone inserts ₹10, move to ‘ready to dispense’.” Every rule takes a (situation, action) pair and gives exactly one next situation. That is a function.
Later, we’ll want to shrink machines by merging modes that “behave the same”. Deciding which things “behave the same” — and grouping them — is exactly what an equivalence relation does. GATE asks about both, and minimizing machines (a top-scoring topic) is built entirely on equivalence classes.
Predict First
Consider all whole numbers 0, 1, 2, 3, … and call two numbers “alike” if they leave the same remainder when divided by 3. Into how many groups do all the infinitely many numbers fall?
Core Concept
Prediction check
Answer: 3 groups — remainder 0 {0,3,6,…}, remainder 1 {1,4,7,…}, remainder 2 {2,5,8,…}. Infinitely many things, but only finitely many groups. This is exactly how a finite-memory machine can handle infinitely many inputs: it groups them into finitely many classes.
Relations
Example: A = {1,2,3}, “less than” on A is {(1,2), (1,3), (2,3)}. A relation on A means a subset of A × A. Since |A × A| = n², the number of relations on an n-element set is 2^(n²).
States: 1, 2, 3
Transitions: 1>2: <; 1>3: <; 2>3: <
Functions
- “Every” — no element of A is left without an output.
- “Exactly one” — no element of A has two outputs.
The number of functions from A to B is |B|^|A| (each of the |A| inputs independently picks one of |B| outputs).
A partial function may leave some inputs without an output. Remember this: a machine whose rule book has a missing entry is like a partial function, and we will learn how to “complete” it.
Functions of two inputs
A function can take a pair as input: f : A × B → C. Example: δ(mode, symbol) = next mode, where δ (Greek “delta”) is just a name. With 3 modes and 2 symbols the domain has 3 × 2 = 6 pairs, so the rule book has 6 entries.
| δ | a | b |
|---|---|---|
| q0 | q1 | q0 |
| q1 | q2 | q0 |
| q2 | q2 | q2 |
One-to-one, onto, bijection
- One-to-one (injective): different inputs give different outputs.
- Onto (surjective): every element of B is hit by some input.
- Bijection: both. A bijection pairs A and B perfectly, so finite A and B have equal size.
Properties of a relation on A
- Reflexive: a R a for every a.
- Symmetric: a R b ⇒ b R a.
- Transitive: a R b and b R c ⇒ a R c.
“Less than” is transitive but not reflexive or symmetric. “Has the same birthday as” is all three.
| Relation | Reflexive | Symmetric | Transitive |
|---|---|---|---|
| x < y | ✗ | ✗ | ✓ |
| x ≤ y | ✓ | ✗ | ✓ |
| same remainder mod 3 | ✓ | ✓ | ✓ |
| x is parent of y | ✗ | ✗ | ✗ |
Equivalence relations and classes
The equivalence class of a, written [a], is the set of everything equivalent to a. Key facts:
- Every element is in exactly one class. Classes never partly overlap: two classes are either identical or disjoint.
- So the classes partition the set: they cut it into non-overlapping pieces that cover everything.
- The number of classes is called the index of the relation. “Same remainder mod 3” has index 3.
Conversely, any partition defines an equivalence relation (“in the same piece”).
Refinement
Relation R₁ refines R₂ if every class of R₁ sits inside a class of R₂ — R₁ cuts more finely. “Same remainder mod 6” refines “same remainder mod 3”: class {0,6,12,…} ⊆ {0,3,6,9,…}. A finer relation has at least as many classes. Machine minimization is exactly “find the coarsest grouping that still works”.
Putting it together
- A function gives every input exactly one output; there are |B|^|A| of them. A missing output makes it partial.
- An equivalence relation (reflexive + symmetric + transitive) cuts a set into non-overlapping classes; their number is the index.
- Finer relation = more, smaller classes. Shrinking machines (Chapter 1.3) is finding the coarsest grouping that still works.
Visual
"same remainder mod 3" on {0,1,2,...,11}
class [0] class [1] class [2]
┌───────────┐ ┌───────────┐ ┌───────────┐
│ 0 3 6 9 │ │ 1 4 7 10 │ │ 2 5 8 11 │
└───────────┘ └───────────┘ └───────────┘
pieces don't overlap · together they cover everything · index = 3
function check: A={p,q} B={0,1}
f = {(p,0),(q,1)} ✓ function (each input one output)
g = {(p,0),(p,1),(q,1)} ✗ p has two outputs
h = {(p,0)} ✗ q has none (only a partial function)
number of functions A→B = |B|^|A| = 2² = 4Worked Examples
On A = {1,2,3}, is R = {(1,1),(2,2),(3,3),(1,2),(2,1)} an equivalence relation? List its classes.
Show the full solution
Reflexive: (1,1),(2,2),(3,3) present ✓. Symmetric: (1,2) and (2,1) both present ✓. Transitive: (1,2),(2,1) ⇒ need (1,1) ✓; (2,1),(1,2) ⇒ (2,2) ✓. So yes. Classes: {1,2} and {3}. Index 2.
How many functions are there from a 3-element set to a 4-element set? How many are one-to-one?
Show the full solution
All functions: 4³ = 64. One-to-one: the first input has 4 choices, the second 3, the third 2: 4·3·2 = 24.
On the set of all binary strings, define x ~ y if x and y have the same last symbol (treat the empty string as its own case: it is related only to itself). Is ~ an equivalence relation, and what is its index?
Show the full solution
Reflexive, symmetric and transitive all hold (“same last symbol” is “alike in one respect”). Classes: strings ending in 0, strings ending in 1, and the class containing only the empty input. Index = 3. Notice: infinitely many strings, 3 classes — a machine that only needs to know “what was the last symbol?” needs 3 modes, and this grouping is exactly why.
GATE Traps
- A function needs an output for every domain element. Missing outputs → partial function, not a (total) function.
- Counting: functions A → B = |B|^|A| (not |A|^|B|). Relations on an n-set = 2^(n²).
- Reflexive means every element relates to itself — one missing (a,a) breaks it.
- The empty relation on a non-empty set is symmetric and transitive (vacuously) but not reflexive.
Memory Hook
Equivalence classes are like sorting laundry by colour: every sock lands in exactly one pile, piles never share a sock.
Connect the Dots
We can now state rules (functions) and group things that behave alike (equivalence classes). Next we need to prove things about machines — for example, “no finite-memory machine can check balanced brackets”. That needs proof techniques.
Self-Test
- NAT
How many functions are there from {a,b,c,d} to {0,1}?
Write your answer before opening the key.
- MCQ
Which relation on the integers is an equivalence relation?
- x R y iff x ≤ y
- x R y iff x − y is divisible by 4
- x R y iff |x − y| = 1
- x R y iff x < y
- MSQ
An equivalence relation on a 10-element set has exactly 3 classes. Which must be true?
- The classes are pairwise disjoint
- Every element is in some class
- Each class has at least one element
- All classes have the same size
- NAT
How many relations are there on a 3-element set?
Write your answer before opening the key.
- MCQ
Relation R₁ = “same remainder mod 8” and R₂ = “same remainder mod 4” on integers. Which is true?
- R₂ refines R₁
- R₁ refines R₂
- Neither refines the other
- They are the same relation
Rule Card
- Relation ⊆ A × B. Function: every input exactly one output. Partial function: some inputs have none.
- #functions A→B = |B|^|A|. #one-to-one (|A| ≤ |B|) = |B|·(|B|−1)···. #relations on n-set = 2^(n²).
- Equivalence = reflexive + symmetric + transitive. Classes partition the set; number of classes = index.
- Finer relation (refinement) ⇒ more classes; every fine class sits inside a coarse class.
Concept Ledger
- relation
- function f : A → B, domain, codomain
- partial function
- function of two inputs (e.g. δ(mode, symbol))
- one-to-one, onto, bijection
- reflexive, symmetric, transitive
- equivalence relation
- equivalence class [a]
- partition
- index (number of classes)
- refinement
Answer Vault
Reveal answers when you’re ready
Warm-up answers
- 2⁵ = 32.
- Not an element; it is a subset.
- 2 (even so far / odd so far).
Self-test answers
- 16 — |B|^|A| = 2⁴ = 16.
- B — Divisibility of the difference by 4 is reflexive (0 divisible), symmetric, transitive. Index 4.
- A: ≤ is not symmetric.
- C: Not reflexive (|x−x| = 0) and not transitive.
- D: < is not reflexive.
- ABC — Classes partition the set: disjoint, covering, non-empty.
- D: Sizes can differ, e.g. 1, 4, 5.
- 512 — |A × A| = 9 pairs; any subset is a relation: 2⁹ = 512.
- B — If x ≡ y mod 8 then x ≡ y mod 4, so every mod-8 class sits inside a mod-4 class. R₁ is finer (8 classes vs 4).
- A: Backwards: mod 4 classes are bigger.
- C: One does refine the other.
- D: They have different numbers of classes.
Flashcards
- Number of functions from A to B?
Reveal answer
|B|^|A| - Three properties of an equivalence relation?
Reveal answer
Reflexive, symmetric, transitive. - What do equivalence classes form?
Reveal answer
A partition: disjoint, non-empty pieces covering the whole set. - What is the index of an equivalence relation?
Reveal answer
The number of its equivalence classes. - Number of relations on an n-element set?
Reveal answer
2^(n²)