Think about how "equals" behaves. Everything equals itself, it works in both directions, and you can chain it along. Some relations behave in exactly the same way, and when they do, they sort a set neatly into groups that never overlap. In this chapter we name these properties (reflexive, symmetric, transitive), meet equivalence relations and their classes, and then sort functions into one-one, onto, or both.
A relation R on a set A is simply a subset of A×A. We call it
empty if R=∅, universal if R=A×A;
reflexive if (a,a)∈R for every a∈A;
symmetric if (a,b)∈R⇒(b,a)∈R;
transitive if (a,b),(b,c)∈R⇒(a,c)∈R.
When a relation has all three of the last properties, we call it an equivalence relation.
Example 1. On Z, R={(a,b):a−b is divisible by 4}. Check each property in turn. It is reflexive, because a−a=0. It is symmetric, because if 4∣a−b then 4∣b−a. It is transitive, because a−c=(a−b)+(b−c). So R is an equivalence relation.
Example 2. On {1,2,3}, R={(1,1),(2,2),(3,3),(1,2)} is reflexive and transitive, but it is not symmetric, since (2,1)∈/R.
Example 3. Take all the lines in a plane. "Is perpendicular to" is symmetric, but it is neither reflexive nor transitive. "Is parallel to", if we agree that a line is parallel to itself, turns out to be an equivalence relation.
Example 4. On R, aRb⟺a≤b2. This one fails all three tests: it is not reflexive (21>41), not symmetric ((1,3)∈R, (3,1)∈/R), not transitive (3≤(−2)2, −2≤12, but 3>12).
Given an equivalence relation, the class of a is [a]={x:(x,a)∈R}, the set of everything related to it. Here is the lovely part: any two classes are either exactly the same or completely separate, and together they fill the whole set. Example 1 has four classes: [0] (multiples of 4), [1], [2], [3].
Example 5. On A={1,2,…,10}, R={(a,b):∣a−b∣ is even}. The classes are {1,3,5,7,9} and {2,4,6,8,10}, and nothing in one is related to anything in the other.
The relation sorts the set into two disjoint classes that together cover it.
one-one (injective) if f(x1)=f(x2)⇒x1=x2, so different inputs always give different outputs;
onto (surjective) if every b∈B is f(a) for some a, so the range is the whole of B;
bijective if it is both.
A handy shortcut: for finite sets with n(A)=n(B), one-one and onto mean the same thing, so checking one is enough.
Example 6.f:R→R, f(x)=3x−5. It is one-one (3x1−5=3x2−5⇒x1=x2) and onto (y=f(3y+5)), so it is bijective.
Example 7.f:R→R, f(x)=x2+1. It is not one-one, since f(2)=f(−2), and it is not onto, since 0 has no preimage.
A horizontal line meets the graph twice, and values below 1 are never reached.
Example 8.f:N→N, f(n)=2n is one-one but not onto, because it misses every odd number. g:N→N, g(n)=⌈2n⌉ is the other way round: onto, but not one-one.