\chapter{Functions and graphs}
\section{Algebraic operations with functions}
\subsection{Addition, subtraction, multiplication and division}
We can combine two or more functions using the four arithmetic operations to get a
new function.
\begin{example}
If \(f(x)=x^2\) and \(g(x)=2x\), then \(f+g\) is the function that sends the input \(x\) to the
output
\(x^2+2x\) and \(fg\) is the function with output \(x^2(2x)=2x^3\).
\end{example}
So the functions \(f+g\) and
\(fg\) are defined by
\[(f+g)(x)=f(x)+g(x),\]
\[ (fg)(x) = f(x)g(x).\]
\begin{example}
If \(f(x)=3x\) and \(g(x)=x+2\), then the function \(f-g\) sends the input \(x\) to the
output \(3x-(x+2)=2x-2\), and
the function \(\displaystyle{\frac{f}{g}}\) sends \(x\) to \(\displaystyle{\frac{3x}{x+2}}\).
\end{example}
So the functions \(f-g\) and
\(\displaystyle{\frac{f}{g}}\) are defined by
\[(f-g)(x)=f(x)-g(x),\]
\[\frac{f}{g}(x) = \frac{f(x)}{g(x)}.\]
In the next example we do operations with functions that are given by graphs.
\begin{example}
Suppose that the functions \(f\) and \(g\) are given by the graphs in the picture:
\[\begin{array}{cc}
\img{1.6graph1.png}{}{18em}{} & \img{1.6graph2.png}{}{18em}{}\\
f(x) & g(x)
\end{array}
\]
Suppose we want to find \((f+g)(0)\). So we want \(f(0)+g(0)\). Looking at the first graph, \(f(0)=2\) and the second graph gives us \(g(0)=3\). So \((f+g)(0)=2+3=5\).
In a similar way, \((f-g)(1)=f(1)-g(1)=0-4=-4\), and \((fg)(2)=f(2)g(2)=(1)(4)=4\). But \(g/f)(1)=g(1)/f(1)\) is undefined, because \(g(1)=4\) and \(f(1)=0\).
\end{example}
In a similar way, we can do operations with functions given by tables.
\begin{example}
The functions \(f\) and \(g\) are given by the table below:
\[\begin{array}{c|ccccc}
x & 1 & 2 & 3 & 4 & 5\\
\hline
f(x) & -2 & 0 & 3 & 1 & 2\\
\hline
g(x) & 5 & 1 & 3 & -1 & 0
\end{array}
\]
To find \((f+g)(1)\) we need to compute \(f(1)+g(1)\), and from the table we see that
\(f(1)=-2\), \(g(1)=5\). So \((f+g)(1)=-2+5=3\).
And to find \((fg)(2)\) we multiply together \(f(2)=0\) and \(g(2)=1\), to get \((0)(1)=0\). In this example \((g/f)(2)\) and \((f/g)(5)\) are undefined,
because \(f(2)=0\) and \(g(5)=0\).
\end{example}
\subsection{The difference quotient}
The ratio
\[\frac{f(x+h)-f(x)}{h}\]
is called the \textit{difference quotient} of \(f\), and it is useful in the study of how the
output \(f(x)\) changes as a result of a change
of the input \(x\). The additional variable \(h\)
represents the amount by which the input is changed.
The difference quotient is central to the study of Calculus, where it is often necessary to
simplify it until the \(h\) variable in the denominator can be canceled.
In this Pre-Calculus course, you will learn how to set up the difference quotient and cancel the \(h\)
variable in the denominator for some of the basic functions.
We first work a simple example.
\begin{example}
We want to find the difference quotient for the function
\(g(t)=3t-5\). We need to set up and simplify the ratio
\[\frac{g(t+h)-g(t)}{h}.\]
Remember that \(g(t+h)\) is obtained by substituting \(t+h\) in place of the input.
In the box notation,
\[g \left( \img{U2F1.jpg}{-0.3em}{2em}{} \right) =3\img{U2F1.jpg}{-0.3em}{2em}{}-5. \]
and so
\[g(t+h)={\color{red}{3(t+h)-5}}.\]
So the difference quotient is
\[
\begin{array}{rcl}
\displaystyle \frac{{\color{red}{g(t+h)}}-g(t)}{h} & = & \displaystyle \frac{{\color{red}{3(t+h)-5}}-(3t-5)}{h}\\
\ \\
\ & = & \displaystyle \frac{3t+3h-5-3t+5}{h}\\
\ \\
\ & = & \displaystyle \frac{3h}{h}\\
\ \\
\ & = & \fbox{3}
\end{array}
\]
\end{example}
In the next example, the formula for the function contains both \(x\) and \(x^2\). So we expect the
computation to be longer than in the previous
example (where we only had \(t\)).
\begin{example}
Let \(f(x)=x^2+3x-2\).
In the box notation, \(f(x)\) is
\[f \left( \img{U2F1.jpg}{-0.3em}{2em}{} \right) =\img{U2F1.jpg}{-0.3em}{2em}{}^2+3
\img{U2F1.jpg}{-0.3em}{2em}{}-2, \]
so
\[f(x+h)={\color{red}{(x+h)^2+3(x+h)-2}}\]
and the difference quotient is
\[
\begin{array}{rcl}
\displaystyle \frac{{\color{red}{f(x+h)}}-f(x)}{h} & = & \displaystyle \frac{{\color{red}{(x+h)^2+3(x+h)-2}}-(x^2+3x-2)}{h}\\
\ \\
\ & = & \displaystyle \frac{x^2+2xh+h^2+3x+3h-2-x^2-3x+2}{h}\\
\ \\
\ & = & \displaystyle \frac{2xh+h^2+3h}{h}\\
\ \\
\ & = & \displaystyle \frac{h(2x+h+3)}{h}\\
\ \\
\ & = & \fbox{\(2x+h+3\)}
\end{array}
\]
\end{example}
Note that in both problems the \(h\) in the denominator was canceled by another \(h\)
in the numerator at the final simplification
step. This is typical of difference quotient problems.
Remember that if you cannot simplify the \(h\) in the denominator at
the end of a difference quotient problem,
it is likely that there is a computational mistake somewhere.
If the function contains fractions or square roots, more complex algebra steps
are usually required to simplify a difference quotient. We now look at some of these examples.
\begin{example}
Let \( f(x)=\dfrac{3}{x-2}\).
This time the function has the input variable in the denominator,
and the necessary computations are longer. In the box notation,
\[f \left( \img{U2F1.jpg}{-0.3em}{2em}{} \right) =\frac{3}{\img{U2F1.jpg}{-0.3em}{2em}{}-2}, \]
so
\[f(x+h)=\frac{3}{x+h-2}\]
and the difference quotient is
\[
\frac{f(x+h)-f(x)}{h}=\displaystyle{ \frac{\frac{3}{x+h-2}-\frac{3}{x-2}}{h}.}
\]
To simplify the expression, first we rewrite the \(h\) in the denominator as
multiplication by \(\frac{1}{h}\):
\[
\displaystyle{ \frac{\frac{3}{x+h-2}-\frac{3}{x-2}}{h}}=\frac{1}{h}\cdot \left(\frac{3}{x+h-2}-\frac{3}{x-2}\right).
\]
Then we combine the two fractions using the LCD, and simplify:
\begin{eqnarray*}
\frac{1}{h}\cdot \left(\frac{3}{x+h-2}-\frac{3}{x-2}\right)&=&
\displaystyle \frac{1}{h}\left[\frac{3(x-2)}{(x+h-2)(x-2)}-\frac{3(x+h-2)}{(x-2)(x+h-2)}\right]\\
\ \\
& = & \displaystyle \frac{1}{h}\cdot\frac{3x-6-3x-3h+6}{(x+h-2)(x-2)}\\
\ \\
&=&\frac{-3\cancel{h}}{\cancel{h}(x+h-2)(x-2)}\\
\ \\
&=&\frac{-3}{(x+h-2)(x-2)}
\end{eqnarray*}
The last line gives us the simplified difference quotient:
\[
\fbox{\(\displaystyle \frac{f(x+h)-f(x)}{h}=\frac{-3}{(x+h-2)(x-2)}\)}
\]
\end{example}
\begin{example}
\(g(t)= \sqrt{t}\). The function in box notation is
\[g \left( \img{U2F1.jpg}{-0.3em}{2em}{} \right) =\sqrt{\img{U2F1.jpg}{-0.3em}{2em}{}}, \]
so
\[g(t+h)= \sqrt{t+h}\]
and the difference quotient is
\[\frac{g(t+h)-g(t)}{h}=\frac{\sqrt{t+h}-\sqrt{t}}{h}.\]
This time we need to use the algebraic identity
\[a-b=(\sqrt{a}-\sqrt{b})(\sqrt{a}+\sqrt{b}).\]
This identity can be verified directly (FOIL the right side and check),
or derived from the familiar sum/difference identity
\(x^2-y^2=(x-y)(x+y)\) by replacing \(x\) with \(\sqrt{a}\) and \(y\) with
\(\sqrt{b}\). We need to use this identity to simplify the difference quotient when
the function has the input variable inside a square root.
To use the identity on the difference quotient
\[\frac{\sqrt{t+h}-\sqrt{t}}{h},\]
multiply the top and bottom of the fraction by the sum of the two square roots, use the identity, and simplify:
\begin{eqnarray*}
\displaystyle \frac{\sqrt{t+h}-\sqrt{t}}{h} & = & \displaystyle \frac{(\sqrt{t+h}-\sqrt{t})(\sqrt{t+h}+\sqrt{t})}{h(\sqrt{t+h}+\sqrt{t})}\\
\ \\
\ & = & \displaystyle \frac{t+h-t}{h(\sqrt{t+h}+\sqrt{t})} \\
\ \\
\ & = & \displaystyle \frac{\cancel{h}}{\cancel{h}(\sqrt{t+h}+\sqrt{t})} \\
\ \\
\ & = & \displaystyle \frac{1}{\sqrt{t+h}+\sqrt{t}}.
\end{eqnarray*}
So the simplified difference quotient is
\[
\fbox{\(\displaystyle \frac{f(t+h)-f(t)}{h}=\displaystyle \frac{1}{\sqrt{t+h}+\sqrt{t}}\)}.
\]
\end{example}
Problems
\problem
Let \(f\) and \(g\) be functions given by the formulas
\[
\begin{array}{cc}
f(x)=3x^3-5x^2+7,\ & \ g(x)=2x^2-x-1
\end{array}
\]
Find formulas for the following functions:
\[
\begin{array}{cccc}
\mbox{(a) } (f + g)(x) & \mbox{(b) } (f - g)(x) & \mbox{(c) } (fg)(x) &
\mbox{(d) } \dfrac{f}{g}(x)
\end{array}
\]
\begin{sol}
\begin{enumerate}
\item
\(f+g\) is the function that gives output \(f(x)+g(x)\). So the formula for \(f+g\) is
\[
\begin{array}{rcll}
(f+g)(x)& = & (3x^3-5x^2+7)+(2x^2-x-1)\\[2ex]
& = & 3x^3-5x^2+7+2x^2-x-1\\[2ex]
& = & 3x^3-3x^2-x+6
\end{array}\]
So we find
\[\fbox{\((f+g)(x)=3x^3-3x^2-x+6\)}\]
\item
\(f-g\) gives output \(f(x)-g(x)\):
\[
\begin{array}{rcll}
(f-g)(x)& = & (3x^3-5x^2+7)-(2x^2-x-1)\\[2ex]
& = & 3x^3-5x^2+7-2x^2+x+1\\[2ex]
& = & 3x^3-7x^2+x+8
\end{array}
\]
So
\[\fbox{\((f-g)(x)=3x^3-7x^2+x+8\)}.\]
\item
\(fg\) gives output \(f(x)g(x)\):
\[
\begin{array}{rcll}
(fg)(x)& = & (3x^3-5x^2+7)(2x^2-x-1)\\[2ex]
& = & 6x^5-3x^4-3x^3-10x^4+5x^3+5x^2+14x^2-7x-7\\[2ex]
& = & 6x^5-13x^4+2x^3+19x^2-7x-7
\end{array}
\]
So
\[\fbox{\((fg)(x)=6x^5-13x^4+2x^3+19x^2-7x-7\)}.\]
\item
\(\displaystyle \frac{f}{g}\) gives output \(\displaystyle \frac{f(x)}{g(x)}\).
So
\[
\fbox{\(\displaystyle \frac{f}{g}(x)=\frac{3x^3-5x^2+7}{2x^2-x-1}\)}
\]
\end{enumerate}
\end{sol}
\mproblem
Let \(f\) and \(g\) be functions given by the formulas
\[
\begin{array}{cc}
f(x)=2x^2-3x+5, \ & \ g(x)=x^2+2x-7
\end{array}
\]
Find formulas for the following functions:
\[
\begin{array}{cccc}
\mbox{(a) } (f + g)(x) & \mbox{(b) } (f - g)(x) & \mbox{(c) } (fg)(x) &
\mbox{(d) } \dfrac{f}{g}(x)
\end{array}
\]
\problem
The functions \(f\) and \(g\) are given by the graphs below.
\[\begin{array}{cc}
\img{1.6graph3.png}{}{18em}{} & \img{1.6graph4.png}{}{18em}{}\\
f(x) & g(x)
\end{array}
\]
Find the following:
\[ \begin{array}{cccc}
\mbox{(a) } (f+g)(1) & \hspace{3ex} \mbox{(b) } (f-g)(2) &
\hspace{3ex} \mbox{(c) } (fg)(3)
& \displaystyle \hspace{3ex} \mbox{(d) } \left(\frac{f}{g}\right)(4)
\end{array}\]
\begin{sol}
\[ \begin{array}{cccc}
\mbox{(a) } (f+g)(1)=1+3=4 & \hspace{3ex} \mbox{(b) } (f-g)(2)=3-0=3 &
\hspace{3ex} \mbox{(c) } (fg)(3)=(0)(4)=0
& \displaystyle \hspace{3ex} \mbox{(d) } \left(\frac{f}{g}\right)(4)=\frac{3}{4}
\end{array}\]
\end{sol}
\mproblem
The functions \(f\) and \(g\) are given by the graphs below.
\[\begin{array}{cc}
\img{1.6graph5.png}{}{18em}{} & \img{1.6graph6.png}{}{18em}{}\\
f(x) & g(x)
\end{array}
\]
Find the following:
\[ \begin{array}{cccc}
\mbox{(a) } (f+g)(0) & \hspace{3ex} \mbox{(b) } (f-g)(1) &
\hspace{3ex} \mbox{(c) } (fg)(2)
& \displaystyle \hspace{3ex} \mbox{(d) } \left(\frac{f}{g}\right)(3)
\end{array}\]
\problem
Find the difference quotient for the function \(f(x)=5x+1\)
\begin{sol}
In the box notation,
\[f \left( \img{U2F1.jpg}{-0.3em}{2em}{} \right) =5\img{U2F1.jpg}{-0.3em}{2em}{}+1. \]
and so
\[f(x+h)=5(x+h)+1.\]
So the difference quotient is
\[
\begin{array}{rcl}
\displaystyle \frac{f(x+h)-f(x)}{h} & = & \displaystyle \frac{5(x+h)+1-(5x+1)}{h}\\
\ \\
\ & = & \displaystyle \frac{5x+5h+1-5x-1}{h}\\
\ \\
\ & = & \displaystyle \frac{5h}{h}\\
\ \\
\ & = & \fbox{5}
\end{array}
\]
\end{sol} \mproblem
Find the difference quotient for the function
\(f(x)=4x-3\)
\problem
Find the difference quotient for \(g(t)=3t^2-t\)
\begin{sol}
In the box notation, \(g(t)\) is
\[g \left( \img{U2F1.jpg}{-0.3em}{2em}{} \right) =3\img{U2F1.jpg}{-0.3em}{2em}{}^2-
\img{U2F1.jpg}{-0.3em}{2em}{}, \]
so
\[g(t+h)=3(t+h)^2-(t+h)\]
and the difference quotient is
\[
\begin{array}{rcl}
\displaystyle \frac{g(t+h)-g(t)}{h} & = & \displaystyle \frac{3(t+h)^2-(t+h)-(3t^2-t)}{h}\\
\ \\
\ & = & \displaystyle \frac{3(t^2+2th+h^2)-t-h-3t^2+t}{h}\\
\ \\
\ & = & \displaystyle \frac{3t^2+6th+3h^2-h-3t^2}{h}\\
\ \\
\ & = & \displaystyle \frac{h(6t+3h-1)}{h}\\
\ \\
\ & = & \fbox{\(6t+3h-1\)}
\end{array}
\]
\end{sol}
\mproblem
Find the difference quotient for \(g(x)=3x^2-2x+4\)
\problem
Find the difference quotient for the function
\(\displaystyle f(x)=\frac{5}{x+7}\)
\begin{sol}
In the box notation,
\[f \left( \img{U2F1.jpg}{-0.3em}{2em}{} \right) =\frac{5}{\img{U2F1.jpg}{-0.3em}{2em}{}+7}, \]
so
\[f(x+h)=\frac{5}{x+h+7}\]
and the difference quotient is
\[
\frac{f(x+h)-f(x)}{h}=\displaystyle{ \frac{\frac{5}{x+h+7}-\frac{5}{x+7}}{h}.}
\]
Re-write the division by \(h\) as multiplication by \(1/h\):
\[
\displaystyle{ \frac{\frac{5}{x+h+7}-\frac{5}{x+7}}{h}}=\frac{1}{h}\cdot \left(\frac{5}{x+h+7}-\frac{5}{x+7}\right).
\]
Then combine the two fractions using the LCD, and simplify:
\begin{eqnarray*}
\frac{1}{h}\cdot \left(\frac{5}{x+h+7}-\frac{5}{x+7}\right)&=&
\displaystyle \frac{1}{h}\left[\frac{5(x+7)}{(x+h+7)(x+7)}-\frac{5(x+h+7)}{(x+7)(x+h+7)}\right]\\
\ \\
& = & \displaystyle \frac{1}{h}\cdot\frac{5x+35-5x-5h-35}{(x+h+7)(x+7)}\\
\ \\
&=&\frac{-5h}{h(x+h+7)(x+7)}\\
\ \\
&=&\frac{-5}{(x+h+7)(x+7)}
\end{eqnarray*}
So the simplified difference quotient is:
\[
\fbox{\(\displaystyle \frac{f(x+h)-f(x)}{h}=\frac{-5}{(x+h+7)(x+7)}\)}
\]
\end{sol}
\mproblem
Find the difference quotient for the function \(\displaystyle g(t)=\frac{2}{t+1}\)
\problem
Find the difference quotient for
\(f(t)= \sqrt{1-t}\)
\begin{sol}
The function in box notation is
\[f \left( \img{U2F1.jpg}{-0.3em}{2em}{} \right) =\sqrt{1-\img{U2F1.jpg}{-0.3em}{2em}{}}, \]
so
\[f(t+h)= \sqrt{1-(t+h)}=\sqrt{1-t-h}\]
and the difference quotient is
\[\frac{f(t+h)-f(t)}{h}=\frac{\sqrt{1-t-h}-\sqrt{1-t}}{h}.\]
Multiply the top and bottom of the fraction by \(\sqrt{1-t-h}+\sqrt{1-t}\) and simplify:
\begin{eqnarray*}
\displaystyle \frac{\sqrt{1-t-h}-\sqrt{1-t}}{h} & = & \displaystyle
\frac{(\sqrt{1-t-h}-\sqrt{1-t})(\sqrt{1-t-h}+\sqrt{1-t})}{h(\sqrt{1-t-h}+\sqrt{1-t})}\\
\ \\
\ & = & \displaystyle \frac{1-t-h-(1-t)}{h(\sqrt{1-t-h}+\sqrt{1-t})} \\
\ \\
\ & = & \displaystyle \frac{-\cancel{h}}{\cancel{h}(\sqrt{1-t-h}+\sqrt{1-t})} \\
\ \\
\ & = & \displaystyle \frac{-1}{\sqrt{1-t-h}+\sqrt{1-t}}.
\end{eqnarray*}
So the simplified difference quotient is
\[
\fbox{\(\displaystyle \frac{f(t+h)-f(t)}{h}=\displaystyle -\frac{1}{\sqrt{1-t-h}+\sqrt{1-t}}\)}.
\]
\end{sol}
\mproblem
Find the difference quotient for \(f(x)= \sqrt{x+2}\)