The Timpson Lyceum seal

The Timpson Lyceum · Discrete Math (2025)

Functions and Function Composition - Lecture 12 (Discrete Math)

Functions and Function Composition – Lecture 12

Overview

This lecture builds the formal, set-theoretic definition of a function as a special kind of relation, then develops the language we use to describe and combine functions. We define domain and image, the notation f(a)=bf(a) = b, and what it means for ff to be a function from one set to another. From there we count how many functions exist between finite sets, classify functions as one-to-one, onto, or bijections, and connect one-to-one-ness to invertibility. Finally we introduce function composition, prove it is associative (but not commutative), and examine identity functions and how an inverse undoes its function. These ideas underpin nearly all later work with mappings, so the goal is to recognize the familiar algebra-class function as nothing more than an (often infinite) set of ordered pairs with a special property.

Key Concepts

Relation vs. function. A relation is just a set of ordered pairs. A relation ff is a function provided that whenever (a,b)∈f(a,b) \in f and (a,c)∈f(a,c) \in f, we must have b=cb = c. In words: every left-hand element is paired with exactly one right-hand element. The same element may appear as a right-hand value many times, and duplicate ordered pairs collapse (sets ignore repeats), but no left-hand value may map to two different things.

Function notation. Writing f(a)=bf(a) = b is shorthand for "(a,b)∈f(a,b) \in f" — i.e., bb is the right-hand element paired with aa. This notation is only valid when ff is genuinely a function; do not use it for arbitrary relations. An infinite function such as {(x,y):x,y∈Z, y=x2}\{(x,y) : x,y \in \mathbb{Z},\ y = x^2\} is written compactly as f(x)=x2f(x) = x^2.

Domain and image.

Function from AA to BB. We say f:A→Bf : A \to B provided dom⁡f=A\operatorname{dom} f = A and im⁡f⊆B\operatorname{im} f \subseteq B. Intuitively: ff maps everything in AA to something in BB. Leftover unused elements in BB are fine; leftover unmapped elements in AA are not. (Example: f(x)=∣x∣f(x) = |x| as f:R→Rf : \mathbb{R} \to \mathbb{R} has domain all of R\mathbb{R} but image only [0,∞)[0, \infty).)

Counting functions. If ∣A∣=a|A| = a and ∣B∣=b|B| = b, then there are bab^{a} functions from AA to BB. Each of the aa inputs may be sent to any of the bb outputs independently, giving b⋅b⋯b⏟a times=ba\underbrace{b \cdot b \cdots b}_{a \text{ times}} = b^{a}.

Inverse of a relation. The inverse f−1f^{-1} swaps every ordered pair: (a,b)↦(b,a)(a,b) \mapsto (b,a). The inverse of a function is always a relation, but not always a function.

One-to-one (injective). ff is one-to-one if whenever (a,c)∈f(a,c) \in f and (b,c)∈f(b,c) \in f, then a=ba = b. Equivalently, equal outputs force equal inputs: f(x)=f(y)  ⟹  x=yf(x) = f(y) \implies x = y. (Mnemonic: a function gives equal outputs for equal inputs; a one-to-one function additionally forces equal inputs for equal outputs.) A function is one-to-one if and only if its inverse is also a function.

Onto (surjective). f:A→Bf : A \to B is onto if im⁡f=B\operatorname{im} f = B — every element of BB is hit by something in AA.

Bijection. A function that is both one-to-one and onto. A bijection's inverse is itself a function.

Function composition. If f:A→Bf : A \to B and g:B→Cg : B \to C (note: gg must start where ff ends), then g∘f:A→Cg \circ f : A \to C is defined by (g∘f)(a)=g(f(a))(g \circ f)(a) = g\big(f(a)\big). You read right to left: apply ff first, then gg. Composition is not commutative (g∘f≠f∘gg \circ f \neq f \circ g in general) but is associative: h∘(g∘f)=(h∘g)∘fh \circ (g \circ f) = (h \circ g) \circ f.

Identity function. For a set AA, the identity id⁡A:A→A\operatorname{id}_A : A \to A maps every element to itself: id⁡A={(a,a):a∈A}\operatorname{id}_A = \{(a,a) : a \in A\}. It satisfies f∘id⁡A=f=id⁡B∘ff \circ \operatorname{id}_A = f = \operatorname{id}_B \circ f for any f:A→Bf : A \to B.

Inverse composition. If f:A→Bf : A \to B is one-to-one, then f−1∘f=id⁡Af^{-1} \circ f = \operatorname{id}_A and f∘f−1=id⁡Bf \circ f^{-1} = \operatorname{id}_B — the inverse undoes the function.

Worked Example

Prove that f:R→Rf : \mathbb{R} \to \mathbb{R} given by f(x)=3x+4f(x) = 3x + 4 is a bijection.

One-to-one. Assume f(a)=f(b)f(a) = f(b) and derive a=ba = b:

f(a)=f(b)3a+4=3b+43a=3ba=b.\begin{aligned} f(a) &= f(b) \\ 3a + 4 &= 3b + 4 \\ 3a &= 3b \\ a &= b. \end{aligned}

Equal outputs force equal inputs, so ff is one-to-one.

Onto. Given any b∈Rb \in \mathbb{R}, find an input mapping to it. Take a=b−43a = \dfrac{b - 4}{3} (a real number, since R\mathbb{R} is closed under subtraction and nonzero division). Then:

f(a)=3a+4=3⋅b−43+4=(b−4)+4=b.\begin{aligned} f(a) &= 3a + 4 \\ &= 3 \cdot \frac{b - 4}{3} + 4 \\ &= (b - 4) + 4 = b. \end{aligned}

Every real output is achieved, so ff is onto. Being both one-to-one and onto, ff is a bijection. (The choice of aa comes from inverting: swap x,yx,y in y=3x+4y = 3x+4 and solve, giving f−1(x)=x−43f^{-1}(x) = \tfrac{x-4}{3}.)

Summary