Skip to main content

Section 2.4 Operations with Functions

Subsection 2.4.1 Basic Operations with Functions

If \(f\) and \(g\) are functions, then we have:
New function
Domain
\((f+g)(x)=f(x)+g(x)\)
(Domain of \(f\)) \(\cap\) (Domain of \(g\))
\((f-g)(x)=f(x)-g(x)\)
(Domain of \(f\)) \(\cap\) (Domain of \(g\))
\((f \cdot g)(x) = f(x) \cdot g(x)\)
(Domain of \(f\)) \(\cap\) (Domain of \(g\))
\(\text{ }\)
\(\text{ }\)
\(\left(\dfrac{f}{g} \right)(x)=\dfrac{f(x)}{g(x)}, \text{ } g(x) \not= 0\)
(Domain of \(f\)) \(\cap\) (Domain of \(g\)) and throw out \(x\) that make \(g(x)=0\text{.}\)

Example 2.4.1.

Let \(f(x)=x-3\) Β  and Β  \(g(x)=x^2-x\text{.}\) Find and simplify:
\begin{equation*} \text{ (a) } (g-f)(-6) \quad \quad \quad \quad \quad \quad \text{ (b) } (g \cdot f)(0) \quad \quad \quad \quad \quad \quad \quad \quad \end{equation*}
Solution
(a) Use the definition of \((g-f)\text{.}\)
\begin{align*} (g-f)(-6) \amp =g(-6)-f(-6) \\ \amp =[(-6)^2 - (-6)]-[-6-3] \\ \amp = [36+6]--9 \\ \amp = 42 +9 \\ \amp =51 \end{align*}
(b) Use the definition of \((g \cdot f)\text{.}\)
\begin{align*} (g \cdot f)(0) \amp =g(0) \cdot f(0) \\ \amp =[0^2-0] \cdot [0-3] \\ \amp =0 \cdot (-3) \\ \amp =0 \end{align*}

Example 2.4.2.

Let \(f(x)=\sqrt{x}\) and \(g(x)=x-4\text{.}\) Find an equation defining each function and state the domain of the function.
\begin{equation*} \text{ (a) } f+g \quad \quad \quad \quad \quad \quad \quad \quad \quad \text{ (b) } f/g \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \end{equation*}
Solution: Β  We begin by stating and graphing the domains of \(f\) and \(g\text{.}\)
The domain of \(f\) is \([0,\infty)\) and the domain of g is \((-\infty, \infty)\text{.}\) The graphs are below:
Figure 2.4.3. Graph of \([0,\infty)\) on a number line.
Figure 2.4.4. Graph of \((-\infty, \infty)\) on a number line.
(a) Use the definition of \(f+g\text{.}\)
\begin{equation*} (f+g)(x)=f(x)+g(x)=\sqrt{x}+x-4 \end{equation*}
Now find the domain.
\begin{align*} \text{Domain of $f+g$} \amp =(\text{Domain of $f$}) \cap (\text{Domain of $g$}) \\ \amp =[0,\infty) \cap (-\infty, \infty) \\ \amp =[0,\infty), \quad \text{the values shaded in both graphs.} \end{align*}
(b) Use the definition of \(f/g\text{.}\)
\begin{equation*} \left( \frac{f}{g} \right)(x)=\frac{f(x)}{g(x)}=\frac{\sqrt{x}}{x-4} \end{equation*}
To find the domain of \(f/g\text{,}\) we start with the domain from part (a) and remove the numbers that make the denominator \(0\text{.}\)
Since \(x-4=0\) when \(x=4\text{,}\) we remove \(4\text{.}\) This gives us that the domain is
\begin{equation*} [0,4) \cup (4,\infty). \end{equation*}
The graph of the domain is below:
Figure 2.4.5. Graph of \([0,4) \cup (4,\infty)\) on a number line.

Example 2.4.6.

Let \(f=\{ (-2,1), (1,-1) \}\) and \(g=\{ (-2,-4), (2,-1), (5,6) \}\text{.}\)
Find \(f+g\) and its domain.
Solution: Β  Find the domain first.
\begin{align*} \text{Domain of }(f+g) \amp =(\text{Domain of } f) \cap(\text{Domain of } g) \\ \amp = \{-2, 1 \} \cap \{ -2, 2, 5 \} \\ \amp =\{ -2 \} \end{align*}
Since the domain contains only one value, \(f+g\) will have one ordered pair.
\begin{align*} (f+g)(-2) \amp =f(-2)+g(-2) \\ \amp =1+(-4) \\ \amp =-3 \end{align*}
Therefore, \(f+g=\{ (-2,-3) \} \text{.}\)

Example 2.4.7.

Let \(f=\{ (-3,1), (0,4), (2,0) \}\) and let \(g= \{ (-3,2), (1,2), (2,6), (4,0) \}\text{.}\)
Find \(g/f\) and its domain.
Solution: Β  Find the domain of \(g/f\) first.
Start with the intersection of the functions’ domains.
\begin{align*} (\text{Domain of }f) \cap (\text{Domain of }g) \amp =\{ -3, 0,2 \} \cap \{ -3, 1, 2, 4 \} \\ \amp =\{-3, 2 \} \end{align*}
Since \(f(2)=0\text{,}\) we throw out \(2\text{.}\) So, the domain of \(g/f \text{ }\) is \(\text{ }\{-3 \}\text{.}\)
Now find the function value at \(x=-3\text{:}\)
\begin{equation*} \left( \frac{g}{f} \right)(-3)=\frac{g(-3)}{f(-3)}=\frac{2}{1}=2 \end{equation*}
Therefore, \(g/f=\{ (-3,2) \}\text{.}\)

Subsection 2.4.2 Composition of Functions

The composition of \(f\) and \(g\text{,}\) written \(f \circ g\text{,}\) is defined by the equation
\begin{equation*} (f \circ g)(x)=f(g(x)) \end{equation*}
provided that \(g(x)\) is in the domain of \(f\text{.}\)
Let \(a\) be a real number.
  • Typical Function \(f(x)\text{:}\)
    Figure 2.4.8. Function evaluation: input \(a\) mapped to \(f(a).\)
  • Composition of Functions \((f \circ g)(x)\text{:}\)
    Figure 2.4.9. Composition: input \(a\) mapped to \(f(g(a))\text{.}\)

Example 2.4.10.

Suppose \(f(x)=\sqrt{x+1}\) and \(g(x)=3x\text{.}\)
Find: Β  (a) \((f \circ g)(4) \quad \quad \quad \quad \quad \quad \) (b) \((g \circ f)(2). \quad \quad \quad \quad \quad \)
Solution
\begin{align*} \text{(a) } \text{ } (f \circ g)(4) \amp =f(g(4)) \quad \quad \quad \quad \quad \quad \quad \quad \quad \text{$g(4)=3 \cdot 4=\underline{12}$} \\ \amp =f(12) \\ \amp =\sqrt{12 +1 } \\ \amp =\sqrt{13} \end{align*}
\begin{align*} \text{(b) } \text{ }(g \circ f)(2) \amp =g(f(2)) \quad \quad \quad \quad \quad \quad \quad \quad \text{$f(2)=\sqrt{2+1}=\sqrt{3}$ } \\ \amp =g(\sqrt{3}) \\ \amp =3\sqrt{3} \end{align*}

Example 2.4.11.

Let \(f=\{ (-5,-2), (-3,7), (7,-4) \}\text{,}\) \(g=\{ (-2,7), (-3,-4) \}\text{.}\)
Find \(f \circ g\text{.}\)
Solution: Β  We only need to consider numbers in the domain of \(g\text{,}\) which is
\begin{equation*} \{ -2, -3 \}\text{.} \end{equation*}
First, find the function value at \(x=-2\text{.}\)
\begin{align*} (f \circ g)(-2) \amp =f(g(-2)) \\ \amp =f(7) \quad \quad \quad \quad \quad \text{ since $(-2,7)$ is in $g$} \\ \amp = -4 \quad \quad \quad \quad \quad \text{ since $(7,-4)$ is in $f$} \end{align*}
So, \((-2,-4)\) is in \(f \circ g\text{.}\)
Now evaluate at \(x=-3\text{.}\)
\begin{align*} (f \circ g)(-3) \amp = f(g(-3)) \\ \amp =f(-4) \quad \quad \quad \quad \quad \text{ since $(-3,-4)$ is in $g$} \end{align*}
However, \(f(-4)\) is undefined since \(-4\) is not in the domain of \(f\text{.}\) Therefore,
\begin{equation*} f \circ g=\{ (-2,-4) \} \end{equation*}

Example 2.4.12.

Let \(f(x)=7x+1\text{,}\) \(g(x)=\sqrt{x}\text{.}\) Β  Find \((f \circ g)(x) \text{ }\) and \(\text{ }(g \circ f)(x)\text{.}\)
Solution:
\begin{align*} (f \circ g)(x) \amp =f(g(x)) \\ \amp =f( \sqrt{x}) \\ \amp =7\sqrt{x} +1 \end{align*}
\begin{align*} (g \circ f)(x) \amp =g(f(x)) \\ \amp =g(7x+1) \\ \amp =\sqrt{7x+1} \end{align*}

Subsection 2.4.3 Finding the Domain of \(f \circ g\)

The domain of \((f \circ g)(x)\) is the set of values of \(x\) in the domain of \(g\) for which \(g(x)\) is in the domain of \(f\text{.}\)

Example 2.4.13.

Let \(f(x)=\sqrt{x}\text{,}\) \(\text{ }g(x)=2x-1\text{.}\) Β  Find \(\text{ }(f \circ g)(x)\text{ }\) and its domain.
Solution: Β  The domain of \(g(x)\) is \((-\infty, \infty)\text{,}\) so we just need to make sure that \(g(x)\) is in the domain of \(f\text{.}\)
Since the domain of \(f\) is \([0, \infty)\text{,}\) we require \(g(x) \geq 0\text{.}\)
\begin{align*} g(x) \amp \geq 0 \\ 2x-1 \amp \geq 0\\ x \amp \geq \tfrac{1}{2} \end{align*}
Thus, the domain of \(f \circ g\) is \([\tfrac{1}{2}, \infty). \)
Now, it remains to find an equation defining \(f \circ g\text{:}\)
\begin{align*} (f \circ g)(x) \amp =f(g(x)) \\ \amp =f(2x-1) \\ \amp =\sqrt{2x-1} \end{align*}

Subsection 2.4.4 Writing a Function as a Composition

Example 2.4.14.

Let \(\text{ }f(x)=\sqrt{x}\text{,}\) \(\text{ }g(x)=x-3\text{,}\) \(\text{ }h(x)=2x.\) Β  Write the given function as a composition of appropriate functions chosen from \(\text{ }f\text{,}\) \(\text{ } g \text{ }\) and \(\text{ }h\text{:}\)
\begin{equation*} H(x)=2\sqrt{x} -3. \end{equation*}
Solution: Β  We begin by noting that \(f\text{,}\) \(g\text{,}\) and \(h\) each consist of a single operation and can, thus, be associated with that operation. For example, \(f(x)\) takes the square root of whatever value is inputted, so we associate taking the square root with \(f\text{.}\)
Consider the order of operations to evaluate \(H\text{.}\)
  • First, find the square root. \(\quad \quad \quad (f(x)=\sqrt{x})\)
  • Second, multiply the result by \(2\text{.}\) \(\quad (h(x)=2x)\)
  • Third, subtract \(3\text{.}\) \(\quad \quad \quad \quad \quad \quad \quad (g(x)=x-3)\)
Writing these functions in the order they are applied (from right to left), we have
\begin{equation*} H(x)=(g \circ h \circ f)(x). \end{equation*}
\begin{align*} \textbf{Check:} \text{ }(g \circ h \circ f)(x) \amp =g(h(f(x))) \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \\ \amp = g(h(\sqrt{x})) \\ \amp =g(2\sqrt{x}) \\ \amp =2 \sqrt{x}-3 \\ \amp =H(x) \end{align*}

Example 2.4.15.

For the function \(f(x)=x^3 -7\text{,}\) find two functions \(g(x)\) and \(h(x)\) such that \(f=h \circ g\text{.}\)
Solution: Β  Consider the order of operations for evaluating \(f(x)=x^3-7.\)
The first operation is to evaluate the expression \(x^3\text{.}\) Since the compositions are written right to left, let
\begin{equation*} g(x)=x^3. \end{equation*}
The second operation is to subtract 7 from the result. The required function for this operation is
\begin{equation*} h(x)=x-7. \end{equation*}
\begin{align*} \textbf{Check:} \text{ } (h \circ g)(x) \amp =h(g(x)) \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \\ \amp =h(x^3) \\ \amp =x^3 -7 \\ \amp =f(x) \end{align*}

Example 2.4.16.

For each given function \(H\text{,}\) find functions \(f\) and \(g\) so that \(f \circ g=H\text{.}\)
(a) \(H(x)=(1+x^2)^3\)
(b) \(H(x)= \sqrt{1-x^2}\text{.}\)
Solution: Β  We want \(H(x)=f(g(x))\text{.}\)
For both parts, our approach is to look at the order of operations for evaluating \(H\text{.}\) \(f\) will be the last operation and \(g\) is what \(f\) operates on.
(a) \(H\) takes \(1 +x^2\) and cubes it. Cubing is the last operation, so
\begin{equation*} f(x)=x^3. \end{equation*}
What’s being cubed is \(1 +x^2\text{.}\) So,
\begin{equation*} g(x)=1 +x^2. \end{equation*}
(b) Similarly, \(f(x)=\sqrt{x}\text{,}\) \(g(x)=1-x^2\text{.}\)
In both parts, \(g\) is the "inside" function of \(f(g(x))\text{.}\)