03 Relations and Functions

A progressive guide to relations, their structural properties, and the ways functions can be classified and inverted.

Relations as sets of ordered pairs

A describes which elements of one set are connected to elements of another set. If AA and BB are sets, a from AA to BB is a subset of A×BA\times B, so each connection is written as an ordered pair (a,b)(a,b).

For example, let

A={1,2,3},B={a,b},A=\{1,2,3\},\qquad B=\{a,b\},

and let

R={(1,a),(2,a),(2,b)}.R=\{(1,a),(2,a),(2,b)\}.

The domain is {1,2}\{1,2\}, because these are the first coordinates that occur. The range is {a,b}\{a,b\}, because these are the second coordinates that occur. A on AA is a from AA to itself, so it is a subset of A×AA\times A.

Takeaway: Relations are sets of ordered pairs; their domain and range are determined by the coordinates that actually occur.

Testing properties

The properties of a describe how its ordered pairs behave.

  • : Every element is related to itself, so aRaaRa for every a∈Aa\in A.

  • : Reversing a related pair preserves the , so aRbaRb implies bRabRa.

  • : If both directions hold, then the elements must be equal: (aRb∧bRa)⇒a=b(aRb\land bRa)\Rightarrow a=b.

  • : Two links can be chained: (aRb∧bRc)⇒aRc(aRb\land bRc)\Rightarrow aRc.

The ≤\leq on the integers illustrates several properties at once. It is because a≤aa\leq a, because a≤ba\leq b and b≤ab\leq a imply a=ba=b, and because a≤ba\leq b and b≤cb\leq c imply a≤ca\leq c. It is not : for instance, 2≤52\leq 5 but 5≰25\not\leq 2.

Takeaway: Test each property separately. means that opposite relations force equality; it does not mean simply “not .”

Equivalence and order structures

Two important combinations of properties organize sets in different ways.

An is , , and . Congruence modulo nn is an example on Z\mathbb Z:

a≡b(modn)⟺n∣(a−b).a\equiv b\pmod n\quad\Longleftrightarrow\quad n\mid(a-b).

For example, modulo 33,

[1]={…,−5,−2,1,4,7,…}.[1]=\{\ldots,-5,-2,1,4,7,\ldots\}.

Equivalence classes group elements that are equivalent under the . These classes form a partition: they do not overlap, and every element belongs to exactly one class.

A is , , and . Subset inclusion ⊆\subseteq on P(S)\mathcal P(S) is a . Unlike a total order, a does not require every pair to be comparable. In P({1,2})\mathcal P(\{1,2\}), neither {1}⊆{2}\{1\}\subseteq\{2\} nor {2}⊆{1}\{2\}\subseteq\{1\} holds.

Takeaway: Equivalence relations produce partitions, while partial orders organize elements without necessarily comparing every pair.

Functions and their parts

A is a special kind of : each input in the domain must have exactly one output in the codomain. Multiple inputs may share an output, but a single input cannot be assigned two different outputs.

For example,

f={(1,a),(2,a),(3,b)}f=\{(1,a),(2,a),(3,b)\}

is a from {1,2,3}\{1,2,3\} to {a,b}\{a,b\}. Every input appears exactly once with one output. By contrast,

{(1,a),(1,b)}\{(1,a),(1,b)\}

is not a because the input 11 has two different outputs.

For a f:A→Bf:A\to B, distinguish the following sets:

  • The domain is AA, the set of allowed inputs.

  • The codomain is BB, the set in which outputs are required to lie.

  • The image or range is f(A)={f(a):a∈A}f(A)=\{f(a):a\in A\}, the set of outputs actually produced.

The image can be smaller than the codomain. This distinction becomes essential when deciding whether a is surjective.

Takeaway: The defining test for a is exactly one output for every input.

Injective, surjective, and bijective behavior

Injectivity and surjectivity measure different aspects of how a connects its domain and codomain.

An never sends two distinct inputs to the same output. A useful test is

f(a1)=f(a2)⇒a1=a2.f(a_1)=f(a_2)\Rightarrow a_1=a_2.

For f(n)=2n+1f(n)=2n+1 on Z\mathbb Z, if f(m)=f(n)f(m)=f(n), then

2m+1=2n+1⇒m=n,2m+1=2n+1\Rightarrow m=n,

so the is injective. The rule g(n)=n2g(n)=n^2 is not injective on Z\mathbb Z, since g(1)=g(−1)=1g(1)=g(-1)=1.

A reaches every element of its codomain. For f:A→Bf:A\to B, this means

f(A)=B.f(A)=B.

The rule x3x^3 is surjective from R\mathbb R to R\mathbb R, because every real target yy has the preimage x=y3x=\sqrt[3]{y}. The rule x2x^2 is not surjective from R\mathbb R to R\mathbb R, because no real input produces a negative output; it is surjective when the codomain is [0,∞)[0,\infty).

A is both injective and surjective. Therefore, each codomain element has exactly one preimage.

Takeaway: Injectivity prevents repeated outputs from different inputs; surjectivity ensures that no codomain elements are missed.

Inverses and reversible functions

An inverse reverses the input-output assignments of a . For an to exist on the entire codomain, the original must be bijective: injectivity ensures that each output has at most one preimage, and surjectivity ensures that each codomain element has at least one preimage.

Consider

f(x)=3x−4.f(x)=3x-4.

Solve y=3x−4y=3x-4 for xx:

y+4=3x,x=y+43.y+4=3x, \qquad x=\frac{y+4}{3}.

Therefore,

f−1(x)=x+43.f^{-1}(x)=\frac{x+4}{3}.

The two composition checks are

f−1(f(x))=(3x−4)+43=x,f^{-1}(f(x))=\frac{(3x-4)+4}{3}=x,

and

f(f−1(x))=3(x+43)−4=x.f(f^{-1}(x))=3\left(\frac{x+4}{3}\right)-4=x.

Do not confuse the with a reciprocal. If f(x)=2xf(x)=2x, then

f−1(x)=x2,f^{-1}(x)=\frac{x}{2},

whereas

1f(x)=12x\frac{1}{f(x)}=\frac{1}{2x}

is a different .

Takeaway: To find an inverse, solve the equation y=f(x)y=f(x) for xx, then verify both composition identities when appropriate.

Connecting the concepts

The main ideas form a hierarchy:

  1. A is any set of ordered pairs.

  2. properties such as reflexivity, symmetry, antisymmetry, and transitivity describe structural behavior.

  3. Equivalence relations partition sets into equivalence classes.

  4. Partial orders organize sets while allowing incomparable elements.

  5. A is a with exactly one output for every input.

  6. Injectivity concerns repeated outputs, while surjectivity concerns whether the codomain is fully reached.

  7. A has both properties and therefore has an .

When analyzing a new example, first identify the sets and ordered pairs. Then determine the domain, range, and relevant properties. If the object is a , compare its image with its codomain and check whether different inputs can share an output. These steps reveal whether the is injective, surjective, bijective, or invertible.

Final takeaway: Relations provide the general framework; functions impose a unique-output rule; bijections are exactly the functions whose assignments can be reversed.