Relations and Functions as Sets

One of the quiet triumphs of set theory is that everything else can be built from sets — including relations and functions, which at first look like different kinds of object entirely. The starting brick is the ordered pair (a, b), where order matters: (a, b) \neq (b, a). Collect every possible pair with first entry from A and second from B and you get the Cartesian product

A \times B = \{\, (a, b) : a \in A,\ b \in B \,\}.

A relation from A to B is then simply a subset of A \times B — a chosen collection of pairs saying which a relates to which b.

A function is a special relation

A function f : A \to B is a relation with one extra rule: every input has exactly one output. So a function really is its set of input–output pairs (its graph) — nothing more. That set-theoretic view makes three key properties precise. Picture each as arrows from a left set to a right set:

Why bijections are the whole game

A bijection pairs up the two sets with nothing left over on either side — so it is the exact meaning of "these two sets have the same size." For finite sets that just recovers counting. But the idea keeps working for infinite sets, where counting fails, and it becomes the tool for comparing infinities: two sets have the same cardinality precisely when a bijection between them exists. That single definition is what lets us say ℤ is "the same size" as ℕ, yet ℝ is genuinely bigger.

When you draw y = x^2, the curve you sketch is the function — it is the set of pairs \{(x, x^2)\}. Set theory takes this literally: the function and its graph are the same object. The "each input one output" rule is exactly the vertical line test in disguise: a vertical line (fixing the input) may cross the graph at most once. Relations that fail it — like a circle — are perfectly good relations, just not functions.