On A = {1, 2, 3, 4}, let R = {(1,1), (1,3), (2,2), (3,1), (3,3), (4,4)}. Is R reflexive, symmetric, antisymmetric, transitive? If it is an equivalence relation, give its classes.
A binary relation is a set of ordered pairs. Its properties — reflexive, symmetric, antisymmetric, transitive — decide whether it is an equivalence relation or a partial order; matrices and digraphs represent it, and closures and composition build new relations from old.
A binary relation R from a set A to a set B is any subset of A × B. When (a, b) ∈ R we write a R b and say “a is related to b”. A relation from A to itself is a relation on A. The domain of R is the set of first components that occur, and its range the set of second components that occur.
Familiar examples: “less than” on ℤ is {(a, b) | a < b}; “divides” on ℤ⁺ is {(a, b) | a | b}; “has the same remainder on division by 3” is a relation on ℤ; “is enrolled in” relates students to courses. A function f: A → B is the special relation in which every a ∈ A appears in exactly one pair.
Because a relation is just a subset of A × B, the number of relations from an m-element set to an n-element set is 2^(mn), and the number of relations on an n-element set is 2^(n²) — already 512 for n = 3. New relations come from set operations (R ∪ S, R ∩ S, R − S), from the inverse R⁻¹ = {(b, a) | (a, b) ∈ R}, and from the complement (A × B) − R.
The idea generalises: an n-ary relation is a subset of A₁ × A₂ × … × Aₙ, a set of n-tuples. A table in a relational database is exactly such a relation — each row is a tuple and each column draws its values from a domain — which is why E. F. Codd (1970) called his model the relational model (Module 5). Binary relations are the case n = 2.
For A = {a₁, …, aₘ} and B = {b₁, …, bₙ}, the zero–one matrix M_R = [mᵢⱼ] has mᵢⱼ = 1 when (aᵢ, bⱼ) ∈ R and 0 otherwise. A relation on a single set can also be drawn as a directed graph (digraph): one vertex per element and an arrow a → b for each pair; a pair (a, a) becomes a loop.
Example: on A = {1, 2, 3, 4}, “a divides b” is R = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,4), (3,3), (4,4)} — eight pairs.
| Property | Test on the matrix | Test on the digraph |
|---|---|---|
| Reflexive | every diagonal entry is 1 | a loop at every vertex |
| Irreflexive | every diagonal entry is 0 | no loops at all |
| Symmetric | mᵢⱼ = mⱼᵢ for all i, j (M equals its transpose) | every arrow has a reverse arrow |
| Antisymmetric | for i ≠ j, mᵢⱼ and mⱼᵢ are never both 1 | no pair of opposite arrows between distinct vertices |
| Transitive | the Boolean product M ⊙ M has no 1 where M has a 0 | every two-step path a → b → c has a direct arrow a → c |
| Property | Definition | Examples | Non-example |
|---|---|---|---|
| Reflexive | (a, a) ∈ R for every a ∈ A | ≤, =, “divides” on ℤ⁺ | < (no a < a) |
| Irreflexive | (a, a) ∉ R for every a ∈ A | <, “is a parent of” | ≤ |
| Symmetric | (a, b) ∈ R ⇒ (b, a) ∈ R | =, a ≡ b (mod n), “is a sibling of” | ≤ |
| Antisymmetric | (a, b) ∈ R and (b, a) ∈ R ⇒ a = b | ≤, ⊆, “divides” on ℤ⁺ | “divides” on ℤ (2 | −2 and −2 | 2) |
| Asymmetric | (a, b) ∈ R ⇒ (b, a) ∉ R | <, “is a parent of” | ≤ (fails when a = b) |
| Transitive | (a, b), (b, c) ∈ R ⇒ (a, c) ∈ R | ≤, <, =, ⊆, “divides” | “is a friend of”, ≠ |
Symmetric and antisymmetric are not opposites. The equality (identity) relation Δ = {(a, a) | a ∈ A} is both, while {(1, 2), (2, 1), (1, 3)} on {1, 2, 3} is neither. Antisymmetry allows loops; asymmetry forbids them, so a relation is asymmetric exactly when it is antisymmetric and irreflexive.
Vacuous truth strikes again. The empty relation on a non-empty set is irreflexive, symmetric, antisymmetric, asymmetric and transitive — no pair exists to violate those conditions — but it is not reflexive. The universal relation A × A is reflexive, symmetric and transitive (an equivalence relation), but not antisymmetric once |A| ≥ 2.
To check transitivity by hand, take each pair (a, b) and look at every pair (b, c) that starts where it ends; each must be matched by (a, c). For R = {(1, 2), (2, 3), (1, 3), (3, 3)}: (1,2)(2,3) needs (1,3) ✓; (1,3)(3,3) needs (1,3) ✓; (2,3)(3,3) needs (2,3) ✓; (3,3)(3,3) needs (3,3) ✓ — so R is transitive.
Think of the n × n matrix: there are n diagonal cells and n² − n off-diagonal cells, which form n(n − 1)/2 mirror pairs {(i, j), (j, i)}. Each property constrains some cells and leaves the rest free, so the counts follow from the product rule.
| Relations on an n-element set | Count | Reason | n = 3 |
|---|---|---|---|
| All relations | 2^(n²) | all n² cells free | 512 |
| Reflexive | 2^(n² − n) | diagonal forced to 1, the rest free | 64 |
| Irreflexive | 2^(n² − n) | diagonal forced to 0, the rest free | 64 |
| Symmetric | 2^(n(n+1)/2) | n diagonal cells + one choice per mirror pair | 64 |
| Reflexive and symmetric | 2^(n(n−1)/2) | only the mirror pairs are free | 8 |
| Antisymmetric | 2ⁿ · 3^(n(n−1)/2) | diagonal free; each mirror pair: neither, one way, or the other way | 216 |
| Asymmetric | 3^(n(n−1)/2) | diagonal 0; three options per mirror pair | 27 |
| Symmetric and antisymmetric | 2ⁿ | only diagonal cells may be 1 | 8 |
| Equivalence relations | Bell number Bₙ | one per partition of the set | 5 |
| Partial orders | no closed form | 1, 3, 19, 219 for n = 1, 2, 3, 4 | 19 |
| Transitive | no closed form | 2, 13, 171, 3994 for n = 1, 2, 3, 4 | 171 |
An equivalence relation is reflexive, symmetric and transitive. It captures “is the same as, in some respect”: equality; congruence modulo n (a ≡ b (mod n) iff n | a − b); “has the same birth month as”; “has the same length as” on strings; “is parallel or equal to” on lines.
The equivalence class of a is [a] = {x ∈ A | x R a}. Three facts follow from the definition: a ∈ [a]; [a] = [b] exactly when a R b; and otherwise [a] ∩ [b] = ∅. So the classes are non-empty, pairwise disjoint and cover A — they form a partition of A. Conversely every partition defines an equivalence relation (“lies in the same block”). The set of classes is the quotient set A/R.
Going back from a partition to the relation: the partition {{1, 2}, {3}, {4, 5}} of {1, …, 5} gives every pair inside a block — (1,1), (1,2), (2,1), (2,2), (3,3), (4,4), (4,5), (5,4), (5,5) — that is 2² + 1² + 2² = 9 ordered pairs. In general |R| = Σ (block size)².
Counting: equivalence relations on an n-set correspond one-to-one with partitions, so their number is the Bell number Bₙ — 1, 1, 2, 5, 15, 52, 203 for n = 0 to 6. Those with exactly k classes are counted by the Stirling number of the second kind S(n, k); for example S(4, 2) = 7.
The closure of R with respect to a property is the smallest relation that contains R and has the property. The reflexive closure is R ∪ Δ (add every missing loop) and the symmetric closure is R ∪ R⁻¹ (add every missing reverse pair). Antisymmetry has no closure in general: it can be destroyed by adding pairs, never repaired.
The transitive closure R⁺ = R ∪ R² ∪ R³ ∪ … contains (a, b) exactly when the digraph has a path from a to b. On an n-element set no path needs more than n steps, so R⁺ = R ∪ R² ∪ … ∪ Rⁿ, computable as the Boolean matrix sum M ∨ M^[2] ∨ … ∨ M^[n] — about n⁴ bit operations. Adding the loops as well gives the reflexive–transitive closure, written R*.
Notice that (1, 1) and (2, 2) appear although R had no loops: 1 → 2 → 1 is a path from 1 back to itself. A transitive closure can therefore add loops.
If R is a relation from A to B and S a relation from B to C, the composite S ∘ R = {(a, c) | (a, b) ∈ R and (b, c) ∈ S for some b ∈ B} — first R, then S. Its matrix is the Boolean product M_R ⊙ M_S, computed like an ordinary matrix product with ∧ for × and ∨ for +. Powers are defined by R¹ = R and Rⁿ⁺¹ = Rⁿ ∘ R, and R is transitive exactly when Rⁿ ⊆ R for all n ≥ 1 — equivalently, R² ⊆ R.
Composition is associative, (T ∘ S) ∘ R = T ∘ (S ∘ R), but not commutative, as the example shows. Inverses reverse the order: (S ∘ R)⁻¹ = R⁻¹ ∘ S⁻¹ — just like taking off socks and shoes.
Composition is also a database operation. If Teaches(teacher, course) and Enrolled(course, student) are binary relations, then joining them on the course column and keeping only the teacher and student columns gives exactly the composite relation “teacher teaches some course taken by student”. In digraph terms, R² records the walks of length two, R³ those of length three, and so on.
Functions, viewed as relations, give some standard counts: from an m-set to an n-set there are nᵐ functions and n!/(n − m)! one-to-one functions (when m ≤ n). Onto functions need inclusion–exclusion and are counted in that topic.
Try the problem first, then reveal the working one step at a time.
On A = {1, 2, 3, 4}, let R = {(1,1), (1,3), (2,2), (3,1), (3,3), (4,4)}. Is R reflexive, symmetric, antisymmetric, transitive? If it is an equivalence relation, give its classes.
For A with |A| = 4, count the relations that are (a) arbitrary, (b) reflexive, (c) symmetric, (d) reflexive and symmetric, (e) antisymmetric, (f) equivalence relations.
Find the transitive closure of R = {(a,b), (b,c), (c,a), (c,d)} on {a, b, c, d}.
On A = {1, 2, …, 10} define a R b iff a ≡ b (mod 4). List the equivalence classes and count the ordered pairs in R.
On ℤ define a R b iff a − b is even. Prove that R is an equivalence relation and describe its equivalence classes.
On the positive integers define a R b iff a + b is divisible by 4. Which of reflexive, symmetric and transitive does R satisfy?
Find the reflexive, symmetric and transitive closures of R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.
On {1, 2, 3} let R = {(1, 1), (1, 2), (2, 3)} and S = {(1, 3), (2, 1), (3, 2)}. Compute S ∘ R and R ∘ S, where S ∘ R means “R first, then S”.
How many relations on a 5-element set are (a) reflexive, (b) symmetric, (c) both reflexive and symmetric, (d) antisymmetric?
12 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.
Modelled on real KPSC questions (reworded) with the same concept and answer; each links to its original paper.