Relations and functions
A binary relation is a rule that connects pairs of elements of two sets. A function is a special kind of relation in which each element of the domain corresponds to exactly one element of the codomain. Relations are classified by their properties (reflexivity, symmetry, transitivity), and functions by bijectivity (injection, surjection, bijection).
In plain words:
A binary relation is a "list of pairs": we take elements of two sets and link them. Each pair (a, b) means "a is related to b". If both sets are the same, we say "a relation on the set A".
Example:
- A = {Ira, Pete} — students, B = {English, Python} — clubs
- R = {(Ira, Eng.), (Pete, Eng.), (Pete, Py)} — who attends which club
- The same idea on A: R = {(Ira, Pete), (Pete, Ira)} — "sit at the same desk"
Main rule:
A relation is just a subset of a Cartesian product: R⊆A×B, i.e. a set of allowed ordered pairs.
In plain words:
A relation is reflexive if every element is "related to itself": for any a the pair (a, a) must be in the list. Example — "having the same clothing size": a person always has the size of themself.
Example:
- A = {1, 2}
- R = {(1, 1), (2, 2), (1, 2)} — reflexive
- R = {(1, 1), (1, 2)} — NOT reflexive: there is no pair (2, 2)
Main rule:
A single missing diagonal pair is enough to break reflexivity: all pairs of the form (a, a) are required.
In plain words:
A relation is symmetric if it is "two-way": if a is related to b, then b is necessarily related to a. Example — "sitting at the same desk": if Ann sits with Boris, then Boris sits with Ann.
Example:
- R = {(1, 2), (2, 1), (3, 3)} — symmetric
- R = {(1, 2), (1, 3)} — NOT symmetric: there is (1, 2) but no (2, 1)
Main rule:
Every pair must have its "reverse": together with (a, b) the relation must contain (b, a).
In plain words:
Transitivity is a "chain": if a is related to b and b to c, then a must be related to c. Example — comparing heights: if Olya is taller than Kolya and Kolya taller than Misha, then Olya is taller than Misha.
Example:
- R = {(1, 2), (2, 3), (1, 3)} — transitive
- R = {(1, 2), (2, 3)} — NOT transitive: the direct pair (1, 3) is missing
Main rule:
Join the links of the chain: from two steps a→b and b→c the direct step a→c necessarily follows.
In plain words:
Equivalence is "equality, but broader": a relation that is at the same time reflexive, symmetric and transitive. It splits the whole set into classes of "equal" elements. The simplest example is ordinary equality.
Example:
- "Having the same remainder when divided by 2" — equivalence
- Classes: even {…, −2, 0, 2, 4, …} and odd {…, −1, 1, 3, …}
- Within one class the elements are equivalent; from different classes they are not
Main rule:
Three conditions — reflexivity, symmetry and transitivity — together give a partition of the set into disjoint equivalence classes.
In plain words:
The equivalence class of an element a is the "club of the same": all elements of the set that are related to a. Classes do not overlap and together cover the whole set.
Example:
- Modulo 2: class [0] — all even numbers, class [1] — all odd numbers
- Modulo 3: three classes — numbers with remainders 0, 1 and 2
- Any two classes either coincide or do not overlap
Main rule:
Any element of a class can be chosen as its representative — the class does not change: [a]R=[b]R if aRb.
In plain words:
A function is a strict dispatcher: to every element of the domain A it gives exactly one element of the codomain B. Different a may go to the same b — that is allowed.
Example:
- A = {1, 2}, B = {1, 2, 3}
- f = {(1, 2), (2, 3)} — a function: each element of A has exactly one pair
- f = {(1, 2), (1, 3)} — NOT a function: element 1 has two images
Main rule:
Check the definition: each element a of the domain A occurs in exactly one pair of the mapping.
In plain words:
An injection has unique images: different arguments cannot give the same result. If f(x₁) = f(x₂), then it is the same element. Example: f(x) = 2x — different x give different numbers.
Example:
- f: Z → Z, f(x) = 2x — injection: from 2x₁ = 2x₂ it follows that x₁ = x₂
- f: Z → Z, f(x) = x² — NOT an injection: (−2)² = 2²
Main rule:
Equality of values must force equality of arguments: there are no different x with the same f(x).
In plain words:
A surjection "misses nothing": every b of the codomain must be somebody's image. A bijection is an injection and a surjection at once: "each element gets its own, and nothing is lost" — a perfect one-to-one correspondence.
Example:
- f: Z → Z, f(x) = x + 1 — surjection and bijection
- f: Z → Z, f(x) = 2x — injection, but NOT a surjection: odd numbers have no preimage
- For finite sets with |A| = |B|: any injection f: A → B is automatically a bijection
Main rule:
Injection — no more than one preimage, surjection — no less than one, bijection — exactly one each.