Composite functions
If we have two functions of $x$, $f$ and $g$, then their sum, difference, product, and quotient are also functions of $x$.
The sum and the difference of the two functions are
$(f+g)(x)=f(x)+g(x)$
and
$(f-g)(x)=f(x)-g(x)$
The product and the quotient of the two functions are
$(f\cdot g)(x)=f(x)\cdot g(x)$
and
$\left(\dfrac{f}{g}\right)(x)=\dfrac{f(x)}{g(x)}$, where $g(x)\ne 0$.
Example: Given, $f(x)=7x-2$ and $g(x)=11x+3$, find $(f+g)(x)$, $(f-g)(x)$, $(f\cdot g)(x)$ and $\left(\dfrac{f}{g}\right)(x)$.
Solution:
$(f+g)(x)=(7x-2)+(11x+3)$
Combining like terms,
$(f+g)(x)=18x+1$
$(f-g)(x)=(7x-2)-(11x+3)$
Combining like terms,
$(f-g)(x)=-4x-5$
$(f\cdot g)(x)=(7x-2)\cdot(11x+3)$
Multiplying and combining similar terms,
$(f\cdot g)(x)=77x^2-x-6$
$\left(\dfrac{f}{g}\right)(x)=\dfrac{7x-2}{11x+3}$
Composition of functions:
In general, a function is written in terms of a variable. That is, $f(x)$ is a function of the variable $x$, where $x$ is called the argument of the function. Sometimes the argument is itself another function, as in $f(g(x))$, where $g(x)$ is another function. We call $f(g(x))$ the composition of $f$ and $g$. To denote a composition of functions, we use a small circle between the functions.
That is, the composition of $f$ and $g$ is denoted $f\circ g$ and is defined as
$f\circ g=f(g(x))$
Example 1: Given $f(x)=x^2-7$ and $g(x)=\sqrt{x+10}$. Find $f\circ g$ and $g\circ f$.
Solution:
$(f\circ g)(x) =f(g(x))$
Take the function $f$ and replace $x$ with $g(x)$, that is, $\sqrt{x+10}$:
$(f\circ g)(x) =(\sqrt{x+10})^2-7$
$\hphantom{(f\circ g)(x)}=x+10-7$
$\hphantom{(f\circ g)(x)}=x+3$
$(g\circ f)(x) =g(f(x))$
Take the function $g$ and replace $x$ with $f(x)$, that is, $x^2-7$:
$(g\circ f)(x) =\sqrt{x^2-7+10}$
$\hphantom{(g\circ f)(x)}=\sqrt{x^2+3}$
Note that $f\circ g$ and $g\circ f$ are not equal.
Example 2: Given $f(x)=x^2+5$ and $g(x)=\sqrt{2x-8}$. Find $(f\circ g) (6)$ and $(g\circ f)(6)$.
Solution:
$(f\circ g)(6)=f(g(6))$
First find $g(6)$,
$g(6)=\sqrt{2\cdot 6 -8}$
$\hphantom{g(6)}=\sqrt{12-8}$
$\hphantom{g(6)}=\sqrt{4}$
$\hphantom{g(6)}=2$
Now, replace $x$ in $f$ with this value,
$(f\circ g)(6)=f(2)$
$\hphantom{(f\circ g)(6)}=2^2+5$
$\hphantom{(f\circ g)(6)}=9$
$(g\circ f)(6)=g(f(6))$
First find $f(6)$,
$f(6)=6^2+5$
$\hphantom{f(6)}=36+5$
$\hphantom{f(6)}=41$
Now, replace $x$ in $g$ with this value,
$(g\circ f)(6)=g(41)$
$\hphantom{(g\circ f)(6)}=\sqrt{2\cdot 41-8}$
$\hphantom{(g\circ f)(6)}=\sqrt{82-8}$
$\hphantom{(g\circ f)(6)}=\sqrt{74}$