Composition of functions

Suppose that \(f:A\to B\) and \(g:B\to C\) are functions. The composition of \(f\) and \(g\) is a new function \(g\circ f:A\to C\) defined by \((g\circ f)(x)=g(f(x))\).

Composition cont’d

In terms of ordered pairs, if \(f\subseteq A\times B\) and \(g\subseteq B\times C\) are functions, then \(g\circ f\) is the set of ordered pairs \((a,c)\in A\times C\) such that there exists \(b\in B\) with \((a,b)\in f\) and \((b,c)\in g\).

Variations

  • Suppose \(f:A\to B\) and \(g:C\to D\) are functions and \(B\subseteq C\). Then we can still define \(g\circ f\) by the same formula \((g\circ f)(x) = g(f(x))\).

  • Suppose \(f:A\to B\) and \(g:C\to D\) are functions and the range of \(f\) is a subset of \(C\). Then we can still define \((g\circ f)\) by the same formula.

A warning

Warning: \(g\circ f\) means first \(f\), then \(g\), NOT first \(g\), then \(f\), which is what our normal left-to-right instincts (at least in English) might suggest.

Examples

Problem 12.4.1: Suppose \(A=\{5,6,8\}\), \(B=\{0,1\}\), and \(C=\{1,2,3\}\). Let \(f=\{(5,1),(6,0),(8,1)\}\subseteq A\times B\) and let \(g=\{(0,1),(1,1)\}\subseteq B\times C\). Find \(g\circ f\).

Examples continued

Problem 12.4.3: Let \(A=\{1,2,3\}\), let \(f\subseteq A\times A\) be the function \(f=\{(1,2),(2,2),(3,1)\}\) and let \(g:A\to A\) be the function \(g=\{(1,3),(2,1),(3,2)\}\). Find \(g\circ f\) and \(f\circ g\).

Examples continued

Problem 12.4.9: Let \(f:\mathbb{Z}\to\mathbb{Z}\to\mathbb{Z}\) be the function defined by \(f(m,n)=m+n\) and \(g:\mathbb{Z}\to\mathbb{Z}\times\mathbb{Z}\) be the function \(g(m)=(m,m)\). Find the formulae for \(g\circ f\) and \(f\circ g\).

Proposition: Suppose that \(f:A\to B\), \(g:B\to C\) and \(h:C\to D\) are functions. Then \((h\circ g)\circ f = h\circ(g\circ f)\). In other words, composition of functions is associative.

Theorem: Suppose \(f:A\to B\) and \(g:B\to C\) are functions.

  • If \(f\) and \(g\) are injective, then \(g\circ f\) is injective.
  • If \(f\) and \(g\) are surjective, then \(g\circ f\) is surjective.