Composition of Functions

Trigonometry

Trigonometry Logo

Composition of Functions

Definition and Properties

Similarly to relations, we can compose two or more functions to create a new function. This operation is called the composition of functions.

Let \(g: A \to B\) and \(f: B \to C\) be two functions such that the range of \(g\) equals the domain of \(f.\) The composition of the functions \(f\) and \(g,\) denoted by \(f \circ g,\) is another function defined as

\[y = \left( {f \circ g} \right)\left( x \right) = f\left( {g\left( x \right)} \right).\]
Figure 1.

Since functions are a special case of relations, they inherit all properties of composition of relations and have some additional properties. We list here some of them:

  1. The composition of functions is associative. If \(h: A \to B,\) \(g: B \to C\) and \(f: C \to D,\) then \(\left( {f \circ g} \right) \circ h = f \circ \left( {g \circ h} \right).\)
  2. The composition of functions is not commutative. If \(g: A \to B\) and \(f: B \to C,\) then, as a rule, \(f \circ g \ne g \circ f.\)
  3. Let \(g: A \to B\) and \(f: B \to C\) be injective functions. Then the composition of the functions \(f \circ g\) is also injective.
  4. Let \(g: A \to B\) and \(f: B \to C\) be surjective functions. Then the composition of the functions \(f \circ g\) is also surjective.
  5. It follows from the last two properties that if two functions \(g\) and \(f\) are bijective, then their composition \(f \circ g\) is also bijective.

Examples

Example 1. Composition of Functions Defined on Finite Sets

Consider the sets \(A = \left\{ {1,2,3,4} \right\},\) \(B = \left\{ {a,b,c,d} \right\}\) and \(C = \left\{ \alpha, \beta, \gamma, \delta \right\}.\) The functions \(g: A \to B\) and \(f:B \to C\) are defined as

\[g = \left\{ {\left( {1,b} \right),\left( {2,b} \right),\left( {3,a} \right),\left( {4,d} \right)} \right\},\;\;f = \left\{ {\left( {a,\gamma } \right),\left( {b,\alpha } \right),\left( {c,\delta } \right),\left( {d,\alpha } \right)} \right\}.\]

It is convenient to illustrate the mapping between the sets in an arrow diagram:

Figure 2.

Given the mapping, we see that

\[\left( {f \circ g} \right)\left( 1 \right) = f\left( {g\left( 1 \right)} \right) = f\left( b \right) = \alpha ;\]
\[\left( {f \circ g} \right)\left( 2 \right) = f\left( {g\left( 2 \right)} \right) = f\left( b \right) = \alpha ;\]
\[\left( {f \circ g} \right)\left( 3 \right) = f\left( {g\left( 3 \right)} \right) = f\left( a \right) = \gamma ;\]
\[\left( {f \circ g} \right)\left( 4 \right) = f\left( {g\left( 4 \right)} \right) = f\left( d \right) = \alpha.\]

Hence, the composition of functions \(f \circ g\) is given by

\[f \circ g = \left\{ {\left( {1,\alpha } \right),\left( {2,\alpha } \right),\left( {3,\gamma } \right),\left( {4,\alpha } \right)} \right\}.\]

This is represented in the following diagram:

Figure 3.

Example 2. Composition of Functions Defined on Infinite Sets

Let \(g: \mathbb{R} \to \mathbb{R}\) and \(f: \mathbb{R} \to \mathbb{R}\) be two functions defined as

\[g\left( x \right) = {x^2} + 3x + 1,\;\;f\left( x \right) = \cos x.\]

Determine the composite functions \(f \circ g,\) \(g \circ f,\) \(f \circ f,\) \(g \circ g.\)

The first composite function \(\left(f \circ g\right)\left(x\right) = f\left( {g\left( x \right)} \right)\) is formed when the inner function \({g\left( x \right)}\) is substituted for \(x\) in the outer function \({f\left( x \right)}.\) This yields:

\[\left(f \circ g\right)\left(x\right) = f\left( {g\left( x \right)} \right) = \cos \left( {g\left( x \right)} \right) = \cos \left( {{x^2} + 3x + 1} \right).\]

Similarly we find the other composite functions:

\[\left(g \circ f\right)\left(x\right) = g\left( {f\left( x \right)} \right) = {f^2}\left( x \right) + 3f\left( x \right) + 1 = {\cos ^2}x + 3\cos x + 1.\]
\[\left(f \circ f\right)\left(x\right) = f\left( {f\left( x \right)} \right) = \cos \left( {f\left( x \right)} \right) = \cos \left( {\cos x} \right).\]
\[\left(g \circ g\right)\left(x\right) = g\left( {g\left( x \right)} \right) = {g^2}\left( x \right) + 3g\left( x \right) + 1 = {\left( {{x^2} + 3x + 1} \right)^2} + 3\left( {{x^2} + 3x + 1} \right) + 1 = \left( {\color{magenta}{x^4} + \color{red}{9{x^2}} + \color{black}{1} + \color{green}{6{x^3}} + \color{red}{2{x^2}} + \color{blue}{6x}} \right) + \left( {\color{red}{3{x^2}} + \color{blue}{9x} + \color{black}{3}} \right) + \color{black}{1} = \color{magenta}{x^4} + \color{red}{9{x^2}} + \color{black}{1} + \color{green}{6{x^3}} + \color{red}{2{x^2}} + \color{blue}{6x} + \color{red}{3{x^2}} + \color{blue}{9x} + \color{black}{3} + \color{black}{1} = \color{magenta}{x^4} + \color{green}{6{x^3}} + \color{red}{14{x^2}} + \color{blue}{15x} + \color{black}{5}.\]

Compositions Involving Inverse Functions

Let \(f: A \to B\) be a bijective function from domain \(A\) to codomain \(B.\) Then it has an inverse function \({f^{-1}}\) that maps \(B\) back to \(A.\) Then

\[{f^{ - 1}} \circ f = {I_A}\;\text{ or }\;{f^{ - 1}}\left( {f\left( x \right)} \right) = x,\]

where \({I_A}\) is the identity function in the domain \(A\) and \(x\) is any element of \(A.\)

Similarly,

\[f \circ {f^{ - 1}} = {I_B}\;\text{ or }\;f\left( {{f^{ - 1}}\left( y \right)} \right) = y,\]

where \({I_B}\) is the identity function in the codomain \(B\) and \(y\) is any element of \(B.\)