Composition of Functions Examples

The definition and the properties of the composition of functions are discussed through examples with detailed step-by-step solutions and explanations hidden in collapsible dropdowns.

Definition of Composition of Functions

Let \( f \) and \( g \) be two functions. If we let function \( f \) take as input function \( g \), see diagram below, the resulting function is called the composite function or composition of \( f \) and \( g \), denoted by \( f \circ g \) and defined by:

\[ (f \circ g)(x) = f(g(x)) \]

This composite function is defined if \( x \) is in the domain of \( g \) and \( g(x) \) is in the domain of \( f \).

diagram of the composition of functions
Figure 1. Diagram of function composition

Examples with Solutions

Example 1: Composition of Functions Given Tables of Values

Functions \( f \) and \( g \) are defined by their tables as follows:

\( x \)\( f(x) \)\( x \)\( g(x) \)
3426
5763
6879
81185

1) Find the values of:
a) \( (f \circ g)(2) \),     b) \( (f \circ g)(6) \),     c) \( (f \circ g)(7) \),     d) \( (f \circ g)(8) \)
e) \( (g \circ f)(3) \),     f) \( (g \circ f)(5) \),     g) \( (g \circ f)(6) \),     h) \( (g \circ f)(8) \)
i) \( (g \circ g)(2) \)
2) Find the domain of \( f \circ g \) and \( g \circ f \).

View Solution

1)
a) \( (f \circ g)(2) = f(g(2)) = f(6) = 8 \)
b) \( (f \circ g)(6) = f(g(6)) = f(3) = 4 \)
c) \( (f \circ g)(7) = f(g(7)) = f(9) = \text{undefined} \)
d) \( (f \circ g)(8) = f(g(8)) = f(5) = 7 \)
e) \( (g \circ f)(3) = g(f(3)) = g(4) = \text{undefined} \)
f) \( (g \circ f)(5) = g(f(5)) = g(7) = 9 \)
g) \( (g \circ f)(6) = g(f(6)) = g(8) = 5 \)
h) \( (g \circ f)(8) = g(f(8)) = g(11) = \text{undefined} \)
i) \( (g \circ g)(2) = g(g(2)) = g(6) = 3 \)

2)
Using the results in part 1 to write the ordered pairs defining each composition:
\( f \circ g : \{(2,8), (6,4), (8,7)\} \), hence the domain of \( f \circ g \) is: \(\{2, 6, 8\}\)
\( g \circ f : \{(5,9), (6,5)\} \), hence the domain of \( g \circ f \) is: \(\{5, 6\}\)

Example 2: Composition of Functions Given by their Graphs

Functions \( f \) and \( g \) are given by their graphs shown below:

graphs of functions f and g in example 2
Figure 2. Graphs of functions \( f \) and \( g \)

Find the values of:
a) \( (f \circ g)(-2) \)     b) \( (f \circ g)(0) \)     c) \( (f \circ g)(4) \)     d) \( (f \circ g)(8) \)     e) \( (g \circ f)(2) \)     f) \( (g \circ f)(0) \)

View Solution

a) \( (f \circ g)(-2) = f(g(-2)) = f(-3) = 9 \)
b) \( (f \circ g)(0) = f(g(0)) = f(-2) = 4 \)
c) \( (f \circ g)(4) = f(g(4)) = f(0) = 0 \)
d) \( (f \circ g)(8) = f(g(8)) = f(2) = 4 \)
e) \( (g \circ f)(2) = g(f(2)) = g(4) = 0 \)
f) \( (g \circ f)(0) = g(f(0)) = g(0) = -2 \)

Example 3: Composition of Functions Given by their Formulas

Functions \( f \) and \( g \) are defined by the formulas: \( f(x) = 2x + 1 \) and \( g(x) = -x + 1 \).
a) Find the composite function \( (g \circ f)(x) \).
b) Find the composite function \( (f \circ g)(x) \).

View Solution

a)
\( (g \circ f)(x) = g(f(x)) = -(2x + 1) + 1 = -2x \)

b)
\( (f \circ g)(x) = f(g(x)) = 2(-x + 1) + 1 = -2x + 3 \)

Note that \( (g \circ f)(x) \neq (f \circ g)(x) \), demonstrating that function composition is not commutative.

Example 4: Composition of Functions and their Domains

Functions \( f \) and \( g \) are defined by the formulas: \( f(x) = 2x + 1 \) and \( g(x) = \sqrt{x - 1} \).
Find the composite function \( (g \circ f)(x) \) and its domain.

View Solution
\[ (g \circ f)(x) = g(f(x)) = \sqrt{f(x) - 1} = \sqrt{2x + 1 - 1} = \sqrt{2x} \]

Two conditions for the domain of \( (g \circ f) \):

  1. \( x \) must be in the domain of \( f \), which is \( (-\infty, +\infty) \).
  2. \( f(x) \) must be in the domain of \( g \), meaning \( 2x \geq 0 \implies x \geq [0, +\infty) \).

The domain of \( (g \circ f) \) is the intersection of these sets: \( [0, +\infty) \).

domain composition of functions g of f example 4
Figure 3. Domain intersection for Example 4

Example 5: Composition of Functions and their Domains

Functions \( f \) and \( g \) are defined by the formulas: \( f(x) = x^2 + 1 \) and \( g(x) = \sqrt{4 - x^2} \).
1) Find the composite function \( (f \circ g)(x) \) and its domain.
2) Graph functions \( f \), \( g \), and \( f \circ g \) in the same system of coordinates.

View Solution

1)

\[ (f \circ g)(x) = f(g(x)) = (g(x))^2 + 1 = (\sqrt{4 - x^2})^2 + 1 = 5 - x^2 \]

Conditions for the domain:

  1. \( x \) must be in the domain of \( g \), so \( 4 - x^2 \geq 0 \implies [-2, 2] \).
  2. \( g(x) \) must be in the domain of \( f \), which is \( (-\infty, +\infty) \).

The domain of \( (f \circ g) \) is: \( [-2, 2] \).

domain composition of functions f of g example 5
Figure 4. Domain intersection for Example 5

2)

graphs of functions f, g and fog, example 5
Figure 5. Graphs of \( f \), \( g \), and \( f \circ g \)

Properties of Composite Functions

Property 1

In general, \( (f \circ g)(x) \neq (g \circ f)(x) \), meaning function composition is not commutative.

Example 6: The composition is not commutative

Let \( f(x) = x^2 - 1 \) and \( g(x) = 2x \). Show that \( (f \circ g)(x) \neq (g \circ f)(x) \).

View Solution
\[ (f \circ g)(x) = f(g(x)) = (2x)^2 - 1 = 4x^2 - 1 \] \[ (g \circ f)(x) = g(f(x)) = 2(x^2 - 1) = 2x^2 - 2 \]

Therefore, \( (f \circ g)(x) \neq (g \circ f)(x) \).

Property 2

Let \( f, g, \) and \( h \) be three functions. Then \( f \circ (g \circ h) = (f \circ g) \circ h \), meaning function composition is associative.

Example 7: The composition of functions is associative

Show that \( (f \circ (g \circ h))(x) = ((f \circ g) \circ h)(x) \).

View Solution

Left side:
\( (f \circ (g \circ h))(x) = f((g \circ h)(x)) = f(g(h(x))) \)

Right side:
\( ((f \circ g) \circ h)(x) = (f \circ g)(h(x)) = f(g(h(x))) \)

Both sides yield identical expressions, proving associativity.

Property 3

If \( f \) and \( g \) are invertible, then \( (f \circ g)^{-1} = g^{-1} \circ f^{-1} \).

Example 8: The inverse of the composition of functions

Let \( f(x) = \dfrac{1}{x - 1} \) and \( g(x) = -x + 5 \). Show that \( (f \circ g)^{-1} = g^{-1} \circ f^{-1} \).

View Solution

First, calculate \( (f \circ g)(x) \) and its inverse:

\[ (f \circ g)(x) = f(g(x)) = \dfrac{1}{(-x + 5) - 1} = \dfrac{1}{-x + 4} \]

Finding the inverse \( (f \circ g)^{-1}(x) = -\dfrac{1}{x} + 4 \).

Next, calculate the individual inverses and their composition:

\( f^{-1}(x) = \dfrac{1}{x} + 1 \)

\( g^{-1}(x) = -x + 5 \)

\[ (g^{-1} \circ f^{-1})(x) = g^{-1}(f^{-1}(x)) = -\left(\dfrac{1}{x} + 1\right) + 5 = -\dfrac{1}{x} + 4 \]

We conclude that \( (g^{-1} \circ f^{-1})(x) = (f \circ g)^{-1}(x) \).

More References and Links