Composition of Functions

Nesting functions within other functions

1-minute read
Made by ChickenFryBytes Studios
Table of Contents

The composition of a function is essentially the idea of having a function within a function. That is, we chain the functions together such that the output of one function becomes the input of the other.

The notation $f\circ g$ is used to represent of a function $f$ with another function $g$. It is effectively the same as substituting $g$ into $f$:

$$ \begin{equation}\begin{aligned} f\circ g(x)=f[g(x)]\\ \end{aligned}\end{equation} $$

Commutativity

Composition is not commutative expect for identical functions. Thus: $$ \begin{equation}\begin{aligned} f\circ g\neq g\circ f\\ \end{aligned}\end{equation} $$

Consider two functions $f(x)=2x-3$ and $g(x)=\sqrt{x}$: $$ \begin{equation}\begin{aligned} f\circ g(x)&=2g(x)-3\\ &=2\sqrt{x}-3\\ g\circ f(x)&=\sqrt{f(x)}\\ &=\sqrt{2x-3}\\ \end{aligned}\end{equation} $$

Comparing the results: $$ \begin{equation}\begin{aligned} 2\sqrt{x}-3&\neq\sqrt{2x-3}\\ \end{aligned}\end{equation} $$

Therefore, we see that composition is not commutative.

Associativity of composition

Composition is however associative: $$ \begin{equation}\begin{aligned} (f\circ g)\circ h=f\circ (g\circ h)\\ \end{aligned}\end{equation} $$

Consider three functions $f(x)=x+1$, $g(x)=x^2$ and $h(x)=\sin{x}$: $$ \begin{equation}\begin{aligned} f\circ g(x)&=g(x)+1\\ &=x^2+1\\ \therefore (f\circ g)\circ h(x)&=[h(x)]^2+1\\ &=[\sin{x}]^2+1\\ &=\sin^2{x}+1\\ \end{aligned}\end{equation} $$

For the right side composition: $$ \begin{equation}\begin{aligned} g\circ h(x)&=[h(x)]^2\\ &=[\sin{x}]^2\\ &=\sin^2{x}\\ \therefore f\circ (g\circ h)(x)&=(g\circ h)(x)+1\\ &=\sin^2{x}+1\\ \end{aligned}\end{equation} $$

Comparing the two results: $$ \begin{equation}\begin{aligned} \sin^2{x}+1&=\sin^2{x}+1\\ \therefore (f\circ g)\circ h&=f\circ (g\circ h)\\ \end{aligned}\end{equation} $$

Thus showing associativity in the composition of three non-identical functions.

Created using natural intelligence

Like our content? Support us via Donations