Compositions of Functions

by Justin Skycak on

Compositions of functions consist of multiple functions linked together, where the output of one function becomes the input of another function.

This post is a chapter in the book Justin Math: Algebra. Suggested citation: Skycak, J. (2018). Compositions of Functions. Justin Math: Algebra. https://justinmath.com/compositions-of-functions/


Compositions of functions consist of multiple functions linked together, where the output of one function becomes the input of another function.

Demonstration

For example, the function $2x^2$ can be thought of as the composition of two functions: the first function squares the input, and then the second function doubles the input.

Using formal notation, we can define the first function that squares the input as $f(x)=x^2$, and the second function that doubles the input as $g(x)=2x$.

Then the composition can be computed by using the output of $f$ as the input to $g$. Starting at the end, we can compute the composition by evaluating in $g$ terms of $f$, and then evaluating $f$ in terms of $x$.

$(g \circ f)(x) = g(f(x)) = 2f(x) = 2x^2$


Or, we can start at the beginning, computing $f$ in terms of $x$ and then evaluating $g$ in terms of the result. Either way, we end up with the same formula for the composition.

$(g \circ f)(x) = g(f(x)) = g(x^2) = 2x^2$


Order of Composition

The order of composition is very important and is not interchangeable.

  • • The function computed above is $g \circ f$, which applies $f$ first and then $g$.
  • • On the other hand, the function $f \circ g$ applies $g$ first and then $f$, and consequently evaluates to something different:$(f \circ g)(x) = 4x^2$.

Compositions of Many Functions

For compositions of more than two functions, we can compute one step at a time.

$\begin{align*} \text{Given functions} \hspace{.5cm} &\Bigg| \hspace{.5cm} f(x) = \sin x \\ \text{ } \hspace{.5cm} &\Bigg| \hspace{.5cm} g(x)=x^2 \\ \text{ } \hspace{.5cm} &\Bigg| \hspace{.5cm} h(x)=5x+1\\ \text{ } \hspace{.5cm} &\Bigg| \hspace{.5cm} p(x)= \sqrt{x} \\ \text{Input } f \text{ into } g \hspace{.5cm} &\Bigg| \hspace{.5cm} (g \circ f)(x) = \sin^2 x \\ \text{Input } g \circ f \text{ into } h \hspace{.5cm} &\Bigg| \hspace{.5cm} (h \circ g \circ f)(x) = 5\sin^2 x + 1 \\ \text{Input } h \circ g \circ f \text{ into } p \hspace{.5cm} &\Bigg| \hspace{.5cm} (p \circ h \circ g \circ f)(x) = \sqrt{ 5\sin^2 x + 1 } \end{align*}$


Exercises

Find the expression for the indicated composition. (You can view the solution by clicking on the problem.)

$\begin{align*} 1) \hspace{.5cm} &(g \circ f)(x) = \text{___} \\ &f(x)=x+5 \\ &g(x)=2x^2 \end{align*}$
Solution:
$2(x+5)^2$


$\begin{align*} 2) \hspace{.5cm} &(g \circ f)(x) = \text{___} \\ &f(x)=5^x \\ &g(x)= |4-x| \end{align*}$
Solution:
$|4-x^5|$


$\begin{align*} 3) \hspace{.5cm} &(h \circ g \circ f)(x) = \text{___} \\ &f(x)=-2^x \\ &g(x)=|x+4| \\ &h(x) = \sqrt{x} \end{align*}$
Solution:
$\sqrt{ |-2^x+4| }$


$\begin{align*} 4) \hspace{.5cm} &(h \circ g \circ f)(x) = \text{___} \\ &f(x)=2x \\ &g(x)=\frac{x}{x-1} \\ &h(x)=\sin x \end{align*}$
Solution:
$\sin \left( \frac{2x}{2x-1} \right)$


$\begin{align*} 5) \hspace{.5cm} &(p \circ h \circ g \circ f)(x) = \text{___} \\ &f(x)=\sin x \\ &g(x)=x^2 \\ &h(x) = 1+\sqrt[3]{x} \\ &p(x) = \sqrt{x} \end{align*}$
Solution:
$\sqrt{ 1+\sqrt[3]{ \sin^2 x } }$


$\begin{align*} 6) \hspace{.5cm} &(p \circ h \circ g \circ f)(x) = \text{___} \\ &f(x)=\sqrt{x} \\ &g(x)=\tan x \\ &h(x) = \log_3 x \\ &p(x) = |x|^3 \end{align*}$
Solution:
$\left| \log ( \tan ( \sqrt{x} )) \right|^3$



This post is a chapter in the book Justin Math: Algebra. Suggested citation: Skycak, J. (2018). Compositions of Functions. Justin Math: Algebra. https://justinmath.com/compositions-of-functions/