There are various ways in which two or more functions can be combined in order to form a new function. We can add two functions or subtract one from another; we can form a new function as the product of two simpler functions or as the quotient of two functions; or we can apply a second function to the output of an initial function.
Each of these procedures gives a new function that is, in some sense, a composite function.
Two functions $f$f and $g$g can be added provided their domains are the same. By addition, we create a new function $h=f+g$h=f+g with the meaning $h(x)=(f+g)(x)=f(x)+g(x)$h(x)=(f+g)(x)=f(x)+g(x). That is, each value of $h$h is obtained by adding the corresponding values of $f$f and $g$g. Similarly, three or more functions could be combined by addition to form a single new function.
We might consider the quadratic polynomial given by $P(x)=x^2+2x-1$P(x)=x2+2x−1 as a combination of three functions: $Q(x)=x^2$Q(x)=x2, $L(x)=2x$L(x)=2x and $C(x)=-1$C(x)=−1. Thus, $P(x)=(Q+L+C)(x)$P(x)=(Q+L+C)(x).
If we graph the three functions that form this sum separately, we can see how each value of $P$P is the sum of the corresponding values of $Q$Q, $L$L and $C$C. You should check that, for example, $Q(2)=4$Q(2)=4, $L(2)=4$L(2)=4 and $C(2)=-1$C(2)=−1. As expected, the sum $(Q+L+C)(2)=7$(Q+L+C)(2)=7 is the same as $P(2)$P(2).
In the same way, we may be interested in the difference between two functions. In a practical situation, we might be interested in the performance over time of two competing systems. If the real interest is in the difference between the two. graphs representing the separate performance functions could be drawn together with the difference function on the same axes.
Functions can be combined by multiplication or division.
If $f(x)=\sin x$f(x)=sinx and $g(x)=\cos x$g(x)=cosx, then the product is $(fg)(x)=\sin x.\cos x$(fg)(x)=sinx.cosx. The three graphs are shown below.
You could check, for example, that $\sin\frac{\pi}{4}=\cos\frac{\pi}{4}=\frac{1}{\sqrt{2}}$sinπ4=cosπ4=1√2 and the product, $\cos\frac{\pi}{4}.\sin\frac{\pi}{4}=\frac{1}{2}$cosπ4.sinπ4=12, as expected.
Quotients of functions are formed in a similar way. When the numerator and denominator are polynomials, such quotient functions are called rational functions.
The usual definition of a composite function is along the lines of the third possibility mentioned in the opening paragraph of this chapter.
Given two functions $f$f and $g$g, where the domain of $g$g is the range of $f$f, we form a composite function $f\circ g$f∘g by applying the function $f$f to the output of the function $g$g.
Thus, for $x$x in the domain of $g$g, we have $(f\circ g)(x)=f\left(g(x)\right)$(f∘g)(x)=f(g(x)).
Let $f(x)=e^x$f(x)=ex and $g(x)=x+1$g(x)=x+1.
The composite function $f\circ g$f∘g is $e^{x+1}$ex+1.
The composite function $g\circ f$g∘f is $e^x+1$ex+1.
In general, $f\circ g$f∘g is not the same as $g\circ f$g∘f.
These functions are illustrated graphically below.