A relation connects elements of sets. Databases, graphs and ordering all rest on this idea.
Relation on a set
A relation R from A to B is a subset of A × B. A relation on a set A is a subset of A × A. If (a, b) ∈ R we write a R b. Example: on A = {1, 2, 3}, let R = {(1, 1), (1, 2), (2, 2), (3, 3)}.
Properties
| Property | Condition | Example |
|---|---|---|
| Reflexive | (a, a) ∈ R for every a | "is equal to" |
| Symmetric | (a, b) ∈ R implies (b, a) ∈ R | "is a sibling of" |
| Antisymmetric | (a, b) and (b, a) in R imply a = b | "is less than or equal to" |
| Transitive | (a, b) and (b, c) in R imply (a, c) ∈ R | "is divisible by" |
The relation R above is reflexive (all three self-pairs are present), antisymmetric and transitive, but not symmetric, since (1, 2) ∈ R but (2, 1) ∉ R.
Representing relations
Matrix: rows and columns are elements; the entry is 1 if (a, b) ∈ R, else 0. For R above:
1 2 3
1 [ 1 1 0 ]
2 [ 0 1 0 ]
3 [ 0 0 1 ]
Digraph: draw a dot for each element and an arrow a → b for each pair. A self-pair is a loop.
Types of relations
- Equivalence relation: reflexive, symmetric and transitive.
- Partial order: reflexive, antisymmetric and transitive, for example ≤ or "divides".
- Identity, universal and empty relations.
- Inverse relation R⁻¹: swap every pair.
Equivalence relations and partitions
An equivalence relation splits a set into equivalence classes: [a] is the set of all elements related to a. The classes are disjoint, and together they cover the set. This is a partition. Example: on integers, "a ≡ b (mod 3)" is an equivalence relation with three classes: numbers leaving remainder 0, 1 or 2.
Conversely, every partition of a set gives an equivalence relation: a R b when a and b lie in the same block.
Worked example
On A = {1, 2, 3}, R = {(1,1), (2,2), (3,3), (1,2), (2,1)}.
- Reflexive: yes. Symmetric: yes. Transitive: (1,2) and (2,1) give (1,1) ✓, and (2,1) and (1,2) give (2,2) ✓. So R is an equivalence relation.
- Classes: [1] = [2] = {1, 2} and [3] = {3}. Partition: {{1, 2}, {3}}.
Common mistakes
- Thinking "not symmetric" means "antisymmetric". A relation can be both, or neither.
- Missing the self-pairs when checking reflexivity.
Practice questions
- Define reflexive, symmetric and transitive relations.
- Is "is a divisor of" on positive integers an equivalence relation?
- Write the matrix of R = {(1,2), (2,3), (1,3)} on {1, 2, 3}.
- Find the equivalence classes of "a ≡ b (mod 2)" on {1, 2, 3, 4, 5, 6}.
- What is a partition of a set?
Answers to the practice questions
- See the table above.
- No. It is reflexive and transitive but not symmetric (2 divides 4, not the reverse).
- Rows 1, 2, 3 are [0 1 1], [0 0 1], [0 0 0].
- {1, 3, 5} and {2, 4, 6}.
- A division of the set into non-empty disjoint blocks that cover it.
Sources
- Official BCA syllabus Mathematics Foundations to Computer Science I, course code CC101, Unit I
- Kolman, Busby and Ross, Discrete Mathematical Structures, 6th edition, Pearson
