If \(f : A \to B\) and \(g : B \to C\) exist,
then there is a function mapping \(h : A \to C\).
Function \(h\) is the composition of functions \(f\) and \(g\), and:
\[
h(x) = f(g(x))
\]
Example
\[
\text{Given}
\]
\[
f(x) = 2x - 1
\qquad\qquad
g(x) = 3x^2 + 2x - 1
\]
\[
\text{Find}
\]
\[
\text{a) } f(g(x))
\]
\[
\text{b) } g(f(x))
\]
\[
\text{a) } f(g(x))
\]
\[
f(g(x)) = f(3x^2 + 2x - 1)
\]
\[
= 2(3x^2 + 2x - 1) - 1
\]
\[
= 6x^2 + 4x - 2 - 1
\]
\[
= 6x^2 + 4x - 3
\]
\[
\text{b) } g(f(x))
\]
\[
g(f(x)) = g(2x - 1)
\]
\[
= 3(2x - 1)^2 + 2(2x - 1) - 1
\]
\[
= 3(4x^2 - 4x + 1) + (4x - 2) - 1
\]
\[
= 12x^2 - 12x + 3 + 4x - 2 - 1
\]
\[
= 12x^2 - 8x
\]
Example
\[
\text{Given}
\]
\[
f(x) = \frac{x + 2}{3}
\qquad\qquad
g(x) = \frac{1}{3x - 1}
\]
\[
\text{Find}
\]
\[
\text{a) } f(g(x))
\]
\[
\text{b) } g(f(x))
\]
\[
\text{a) } f(g(x)) = f\!\left(\frac{1}{3x - 1}\right)
\]
\[
= \frac{\left(\frac{1}{3x - 1}\right) + 2}{3}
\]
\[
= \frac{\left(\frac{1 + 2(3x - 1)}{3x - 1}\right)}{3}
\]
\[
= \frac{\left(\frac{1 + 6x - 2}{3x - 1}\right)}{3}
\]
\[
= \frac{\left(\frac{6x - 1}{3x - 1}\right)}{3}
\]
\[
= \frac{6x - 1}{3(3x - 1)}
\]
\[
= \frac{6x - 1}{9x - 3}
\]
\[
\text{b) } g(f(x)) = g\!\left(\frac{x+2}{3}\right)
\]
\[
= \frac{1}{\,3\left(\frac{x+2}{3}\right) - 1}
\]
\[
= \frac{1}{\,x + 2 - 1}
\]
\[
= \frac{1}{x + 1}
\]