2.2: The Algebra of Functions

$+, -, \times$ and $\div$ functions


Suppose $f$ and $g$ are functions with domains $A$ and $B$, respectively. Then the new functions $f+g, f-g, f\cdot g$ and $\frac{f}{g}$ are defined as follows: \begin{align} (f+g)(x) &= f(x) + g(x) && \text{Domain } A \cap B \\ (f-g)(x) &= f(x) - g(x) && \text{Domain } A \cap B\\ (f\cdot g)(x) &= f(x)\cdot g(x) && \text{Domain } A \cap B\\ \left(\frac{f}{g}\right)(x) &= \frac{f(x)}{g(x)} && \text{Domain } \{x \in A \cap B : g(x) \neq 0\} \end{align}

Simply put, $+, -, \times, \div$ functions together is done by performing the specified operation on the function output. Let's look at some examples.

Let $f(x) = \frac{1}{x-2}$ and $g(x) = \sqrt{x}$. Find the following:
  1. $f+g, f-g, fg, \frac{f}{g}$ and their domains
  2. $(f+g)(4), \left(\frac{f}{g}\right)(4)$, and $\left(\frac{f}{g}\right)(0)$

  1. Let's first find the domains and intersect them. $f(x)$ has domain $ A = \{x : x \neq 2\}$ and $g(x)$ has domain $B = \{x : x \geq 0\}$. Thus \[A \cap B = \{x : x \geq 0 \text{ and } x \neq 2\} = [0, 2) \cup (2, \infty)\] Following the above table, we see that \begin{align} (f+g)(x) &= f(x) + g(x) &&= \frac{1}{x-2} + \sqrt{x} \\ (f-g)(x) &= f(x) - g(x) &&= \frac{1}{x-2} - \sqrt{x} \\ (f\cdot g)(x) &= f(x)\cdot g(x) &&= \frac{\sqrt{x}}{x-2} \\ \left(\frac{f}{g}\right)(x) &= \frac{f(x)}{g(x)} &&= \frac{1}{(x-2)\sqrt{x}} \\ \end{align}
  2. The first three functions have the domain $[0, 2) \cup (2, \infty)$ while the last one has domain $(0, 2) \cup (2, \infty)$ because plugging in zero results in division by zero.
  3. From part 1, the definitions of $f+g$ and $f/g$ give \begin{align} (f+g)(4) &= f(4) + g(4) &&= \frac{1}{4-2} + \sqrt{4} & = \frac{5}{2} \\ \left(\frac{f}{g}\right)(4) &= \frac{f(4)}{g(4)} &&= \frac{1}{(4-2)\sqrt{4}} &= \frac{1}{4} \\ \end{align} Since we cannot divide by zero, $\left(\frac{f}{g}\right)(0)$ is undefined.
Adding functions together has a nice graphical interpretation. In this example, we see the graph $f(x) + g(x)$ is just the vertical heights of $f(x)$ and $g(x)$ added together.
Here are a few (probably familiar) definitions:
Suppose a manufacturer of water filters has a monthly fixed cost of $\$10,000$, a variable cost of \[-0.0001x^2 + 10x \qquad 0 \leq x \leq 40,000\] and a total revenue function \[R(x) = -0.0005x^2 + 20x \qquad 0 \leq x \leq 40,000\]
  1. Find a function $C(x)$ that gives the total monthly cost.
  2. Find the total profit function.
  3. What is the profit if 10,000 water filters are sold per month?

Function Composition


Function evaluation on a number is straightforward: the preceding example utilized this concept. What if we evaluate a function on another function? This idea is called function composition.

Given two functions $f$ and $g$, the composite function $f \circ g$ (also called the composition of $f$ and $g$) is defined by \[(f\circ g)(x) = f(g(x))\]

To evaluate a function composition, you first plug in $g(x)$ into $f(x)$, and wherever there is an $x$ in $f(x)$, substitute the definition of $g(x)$ there. Start from the innermost expression!

Suppose $f(x) = x^2$ and $g(x) = x-3$. Find $f\circ g, g \circ f, (f\circ g)(5), (g\circ f)(5)$

We see that \[(f\circ g)(x) = f(g(x)) = f(x-3) = (x-3)^2\] and \[(g\circ f)(x) = g(f(x)) = g(x^2) = x^2 - 3\] Thus $(f\circ g)(5) = (5-3)^2 = 4$ and $(g\circ f)(5) = 5^2 - 3 = 22$.
Ideas:
Find $f\circ g \circ h$ where $f(x) = \frac{x}{x+1}, g(x) = x^{10}, h(x) = x+3$.
\begin{align} (f\circ g \circ h)(x) &= f(g(h(x)))\\ &= f(g(x+3))\\ &= f((x+3)^{10})\\ &= \frac{(x+3)^{10}}{(x+3)^{10}+1} \end{align}
Given $F(x) = \sqrt[4]{x + 9}$, find functions $f$ and $g$ such that $F = f\circ g$.
We can think of this function as the $\sqrt[4]{\cdot}$ as the outside function, and $x + 9$ as the inside function.
Since $f\circ g$ is the desired composition, $g(x)$ needs to be the inside function. Let $g(x) = x+9$ and $f(x) = \sqrt[4]{x}$. Then \[(f\circ g)(x) = f(g(x)) = f(x+9) = \sqrt[4]{x+9} = F(x)\]
The level of carbon monoxide present in the air due to pollution will be $f(x) = 0.01x^{2/3}$ ppm when the number of motor vehicles is $x$ thousand.

It is estimated the number of motor vehicles $t$ years from now will be $g(x) = 0.2t^2 + 4t + 64$ thousand.

  1. Find a function for the concentration of carbon monoxide in the air due to automobile exhaust $t$ years from now.
  2. What will be the level of concentration 5 years from now?