\chapter{Functions and graphs}
\section{Function notation and graphs}
We write
\[y=f(x)\]
to mean that \(y\) is a function of \(x\). As we know,
this means that for every value of the independent variable \(x\) (in the domain),
there is a value of the dependent variable \(y\) (in the range) assigned to \(x\).
Recall from Unit 1.1 that a value of \(x\) is also called an input value, and a
\(y\) value is also called
an output value.
One reason for this terminology is that we can think of \(f\) as a machine that processes
the input (what we put \textbf{in }) and gives us the corresponding output (what we get \textbf{ out}).
For example, the function \(y=x+1\) gives output \(y=3\) when we put in the input \(x=2\),
and we can picture that as in the following figure:
\[ \img{Function_machine.png}{}{}{8em}\]
The letter \(f\) is the name of the function, and \(f(x)\) is the output given by \(f\)
when the input is \(x\).
Be careful not to confuse \(f\) (that is the name of the function, and so it is not a
number or a value) with \(f(x)\), that is the output value given by \(f\) when the
input is \(x\). Other commonly used letters are \(g\) and \(h\). So for example
\(f(x)\), \(g(x)\) and \(h(x)\) are the outputs given by the three different
functions \(f\), \(g\), \(h\) when the input is \(x\).
The most commonly used way to describe a function is by giving a formula.
The formula will contain a letter that represents the independent
variable.
\begin{example}
We define a function \(f\) by the formula
\[f(x)= 2x+1.\]
This means that given an input value \(x\), we need to multiply it by \(2\), and then add
\(1\) to find
the corresponding output value. So
\begin{eqnarray*}
f({\color{red}{3}}) &=& 2({\color{red}{3}}) +1=7,\\
f({\color{red}{-2}})&=& 2({\color{red}{-2}}) +1=-3.\\
\end{eqnarray*}
\end{example}
Think of the \(x\) inside the parentheses in \(f(x)\) as a ``placeholder'': to find the function value for a given input, every time we see the variable \(x\)
in the formula for \(f(x)\) we need to substitute the input value in its place.
\begin{example}
Define a function \(g\) by
\[g(x) = 3x^2 -x +1.\]
Suppose we want to find \(g(4)\). We then substitute \(4\) in place of \(x\) and compute the answer:
\begin{eqnarray*}
g({\color{red}{4}})&=& 3({\color{red}{4}})^2 - {\color{red}{4}} +1\\
&=& 3(16)-4+1\\
&=& 48-3\\
&=& 45
\end{eqnarray*}
\end{example}
The given input value may not be a number. It could be an expression containing variables. To find the corresponding output, we proceed just in the same way:
every time we see the ``placeholder'' in the formula, we substitute the input expression in its place.
\begin{example}
Let \(g\) be defined by
\[g(t)=t+\sqrt{4-t^2}.\]
Suppose we want to find \(g(2-x)\). We need to replace every \(t\) in the formula with \(2-x\). A way to picture the substitution is to rewrite the formula with an empty box in place of the
input variable (\(t\) in this problem):
\[g \left( \img{U2F1.jpg}{-0.3em}{2em}{} \right) =\img{U2F1.jpg}{-0.3em}{2em}{}
+\sqrt{4- \img{U2F1.jpg}{-0.3em}{2em}{}^2} \]
and then we fill the box with the given input \(2-x\) (including parentheses \((2-x)\) if necessary!), and simplify:
\begin{eqnarray*}
g\left({\color{red}{2-x}}\right) &=& {\color{red}{(2-x)}}+\sqrt{4-{\color{red}{(2-x)}}^2}\\
\ & \\
&=&2-x+\sqrt{4-(4-4x+x^2)}\\
\ & \\
&=&2-x+\sqrt{4-4+4x-x^2}\\
\ & \\
&=&2-x+\sqrt{4x-x^2}
\end{eqnarray*}
Note how we had to use the parentheses when substituting in the box that gets squared.
\end{example}
\subsection{Piecewise defined functions}
We have seen that functions are often defined by a formula. Sometimes more than one formula
is needed to define a function. Such functions are called \textit{piecewise defined}.
\begin{example} The function \(f\) is defined by
\[f(x)=
\begin{cases}
x+2 & \mbox{if } x<1 \mbox{ (first piece)}\\
2x-3 & \mbox{if }x\geq 1 \mbox{ (second piece)}
\end{cases}
\]
This means that \(f(x)=x+2\) when \(x< 1\) and
the \(f(x)=2x-3\) when \(x\geq 1\).
Suppose for example that we want to find \(f(0)\). Then we need to use the first piece of the definition
\(f(x)=x+2\) (because \(0<1\)),
and we find \(f(0)=0+2=2\).
But if instead we want to find \(f(2)\), we need to use the second piece
\(f(x)=2x-3\) (because \(2\geq 1\)), and we find
\(f(2)=2(2)-3=1\).
\end{example}
Of course we can use function notation also for functions defined by lists or tables.
\begin{example}
Suppose that the function \(f(x)\) is defined by the table shown below:
\[\begin{array}{r|c}
x & f(x)\\
\hline
-1 & 0\\
0 & 1\\
1 & 2\\
3 & 3
\end{array}
\]
To find \( f(0)\), find the \(x\)-value \(0\) on the left side of the table. The corresponding
entry on the right is \(f(0)\). So \(f(0)=1\). Suppose instead we want to find the input \(x\) that gives \(0\) as output.
So we want to fill the blank: \(f(\img{U2F1.jpg}{-0.3em}{2em}{})=0\). Look for \(0\) on the right
side of the table (among the output values), and find \(-1\) next to it on the left. This means
that \(f(-1)=0\).
\end{example}
\subsection{Functions from graphs}
A graph in the usual \(xy\) plane can be used to define a relation. The pairs in the relation are just the points \((x,y)\)
on the graph.
\begin{example}
The graph in the following figure defines a relation. Some of the pairs in the relation are
\((1,4)\), \( (3,2)\), \((3,-4)\).
\begin{center} \(\img{U1_1F7.png}{}{12em}{}\)\end{center}
\end{example}
But not all graphs will describe a function. This is because the graph may have two points that have the same \(x\)
coordinate, but different \(y\) coordinates. For example the graph in the previous example contains the pairs
\((3,2)\) and \((3.-4)\), so this relation cannot be a function.
To decide if a graph describes a function, use the \textit{vertical line test}:
Vertical Line Test |
A graph describes a function only when every vertical straight line
intersects the graph no more than once. |
If a graph describes a function, then the independent variable (often the letter \(x\))
is the variable used for the horizontal axis, and the dependent variable
(often the letter \(y\)) is the variable used for the vertical axis.
\begin{example}
The graph shown in the following figure satisfies the vertical line test, so it defines \(y\) as a function of \(x\).
This function sends \(x=4\) to \(y=2\) and \( x=-8\) to \(y=-4\). Using
the function notation \(y=f(x)\), this means that \(f(4)=2\) and \(f(-8)=-4\).
\begin{center} \(\img{U1_1F6.jpg}{}{18em}{}\)\end{center}
\end{example}
Pay attention to how a point on a graph is drawn. So for example if you see a solid dot at \((2,3)\) on the graph
of \(f(x)\), it means that \(2\) is in the domain of \(f\) and \(f(2)=3\). But if you see an open circle at \((2,3)\),
it means that \((2,3)\) is \textbf{not} a point on the graph, and there is a hole there.
Also look at the two ends of the graph. If there is an arrow, it is understood that the graph continues indefinitely.
The next example illustrates all this.
\begin{example}
The function \(f(x)\) is defined by the graph below:
\[\img{U3F1.jpg}{}{15em}{}\]
Suppose we want to find the following values:
\(f(-2)\) | \(f(-1)\) |
\(f(0)\) | \(f(3)\) |
\(f(6)\) | \(f(7)\) |
To find \( \color{red}{ f(-2)}\), find the point on the graph with
\(x\)-coordinate \(-2\).
That is the point shown in
red in the picture below, that
has \(y\)-coordinate \(-1\). So we conclude that
\[\fbox{\(f(-2)=-1\)}.\]
In the same way, \(\color{blue}{f(-1)}\) is given by the point shown in
blue , with \(y\)-coordinate 2. So
\[\fbox{\(f(-1)=2\)}.\]
\[\img{U3F2.jpg}{}{15em}{}\]
Continuing like this, we find:
\[\begin{array}{cccc}
\fbox{\(f(0)=3\)} & \fbox{\(f(3)=4\)} & \fbox{\(f(6)=0\)} & \fbox{\(f(7)\) DNE (Does Not Exist)}.
\end{array}\]
Note the solid circle at the point \( (3,4)\), meaning that the point is on the
graph, while the open circle at \((3,6)\) means that the point is not on the graph. Also, the arrow
on the left side of the graph means that it continues indefinitely, while on the right the open circle at \((7,-2)\) means that
it stops there (and \(7\) is not in the domain).
\end{example}
Problems
\problem
The function \(g\) is defined by the formula \(\displaystyle{g(t)=\frac{t}{t^2+1}}\).
Find the following:
(a) \(g(-2)\) | (b) \(g(0)\) |
(c) \(g(3-t)\) |
\begin{sol}
\begin{enumerate}
\item Find \(g(-2)\):
\begin{eqnarray*}
g({\color{red}{-2}})& =& \frac{{\color{red}{-2}}}{({\color{red}{-2}})^2+1}\\
\ \\
&=& \fbox{\(\displaystyle{-\frac{2}{5}}\)}
\end{eqnarray*}
\item Find \(g(0)\):
\begin{eqnarray*}
g({\color{red}{0}})&=& \frac{{\color{red}{0}}}{({\color{red}{0}})^2+1}\\
\ \\
&=& \fbox{\(0\)}\\
\end{eqnarray*}
\item Find \(g(3-t)\):
\begin{eqnarray*}
g({\color{red}{3-t}})&=& \frac{{\color{red}{3-t}}}{({\color{red}{3-t}})^2+1}\\
\ \\
&=& \frac{3-t}{9-6t+t^2+1}\\
\ \\
&=& \fbox{\( \displaystyle{\frac{3-t}{10-6t+t^2}}\)}\\
\end{eqnarray*}
\end{enumerate}
\end{sol}
\mproblem
The function \(g\) is defined by the formula \(\displaystyle{g(u)=\frac{2u}{4-u^2}}\).
Find the following:
(a) \(g(-3)\) | (b) \(g(0)\) |
(c) \(g(2x-1)\) |
\problem
Let \(f(x)\) be defined by
\[f(x)=\left\{
\begin{array}{lr}
\displaystyle{\frac{1}{x}} & \mbox{if \(x\leq -1\)}\\
\ & \ \\
x^2+x & \mbox{if \(x> -1\)}
\end{array}\right.
\]
Find the following:
(a) \(f(-2)\) | (b) \(f(-1)\) |
(c) \(f(1)\) |
\begin{sol}
\begin{enumerate}
\item
Since \(-2 \leq -1\), to find \(f(-2)\) we need to use the first piece. So
\(\displaystyle{f(-2)=\frac{1}{-2}=
-\frac{1}{2}}\).
\item
To find \(f(-1)\), we still use the first piece, because \(-1\leq -1\). So
\(\displaystyle{f(-1)=\frac{1}{-1}=-1}\).
\item
To find \(f(1)\), we use the second piece, because \(1 > -1\). So
\(f(1)=1^2+1=2\).
\end{enumerate}
\end{sol}
\mproblem
The function \(f(x)\) is defined by the formula:
\[f(x)=\left\{
\begin{array}{lr}
2x+1 & \mbox{if \(x\leq 3\)}\\
\ & \ \\
8-x & \mbox{if \(x>3\)}
\end{array}\right.
\]
Find the following:
(a) \(f(0)\) | (b) \(f(3)\) |
(c) \(f(4)\) |
\problem
The function \(f(x)\) is defined by the table shown below:
\[\begin{array}{r|c}
x & f(x)\\
\hline
-4 & -2\\
-2 & -1\\
0 & 2\\
2 & 4\\
4 & 6\\
6 & 8
\end{array}
\]
Fill in the blanks:
\begin{enumerate}
\item
\(f(2) = \img{U2F1.jpg}{-0.1em}{1.5em}{}\)
\item
\(f(\img{U2F1.jpg}{-0.1em}{1.5em}{})=2\)
\item
\(f(4)=\img{U2F1.jpg}{-0.1em}{1.5em}{}\)
\item
\(f(\img{U2F1.jpg}{-0.1em}{1.5em}{})=-2\)
\end{enumerate}
\begin{sol}
\begin{enumerate}
\item
To find \( f(2)\), find the \(x\)-value \(2\) on the left side of the table. The corresponding
entry on the right is \(f(2)\). So \(f(2)=4\).
\item
This time we need to find the input value that gives 2 as output. So we look for 2 on the right
side of the table (among the output values), and we find 0 next to it on the left. This means
that \(f(0)=2\).
\item
\(f(4)=6\)
\item
\(f(-4)=-2\).
\end{enumerate}
\end{sol}
\mproblem
The function \(h(t)\) is defined by the table shown below:
\[
\begin{array}{r|c}
t & h(t)\\
\hline
-3 & 0\\
-1 & 5\\
1 & -3\\
3 & -1\\
5 & 2\\
7 & 1\\
\end{array}
\]
Fill in the blanks:
\begin{enumerate}
\item
\(h(\img{U2F1.jpg}{-0.1em}{1.5em}{})=5\)
\item
\(h(1) = \img{U2F1.jpg}{-0.1em}{1.5em}{}\)
\item
\(h(-3)=\img{U2F1.jpg}{-0.1em}{1.5em}{}\)
\item
\(h(\img{U2F1.jpg}{-0.1em}{1.5em}{})=2\)
\end{enumerate}
\problem
Look at the following graphs. Decide if each graph defines a function. If it does, identify the independent and dependent
variables.
\[
\begin{array}{|c|c|c|}
\hline
& \ & \\
\img{U1F8.jpg}{-2em}{}{10em} \hspace{0.2in} & \img{U1F9.jpg}{-2em}{}{10em}
\hspace{0.2in} & \img{U1F10.jpg}{-2em}{}{10em}\\
\mbox{(a)} \hspace{0.2in} & \mbox{(b)} \hspace{0.2in} & \mbox{(c)}\\
\hline
& \ & \\
\img{U1F11.jpg}{-2em}{}{10em} \hspace{0.2in} & \img{U1F12.jpg}{-2em}{}{10em}
\hspace{0.2in} & \img{U1F13.jpg}{-2em}{}{10em}\\
\mbox{(d)} \hspace{0.2in} & \mbox{(e)} \hspace{0.2in} & \mbox{(f)}\\
\hline
& \ & \\
\img{U1_2F3a.png}{-2em}{}{10em} \hspace{0.2in} & \img{U1_2F3b.png}{-2em}{}{10em}
\hspace{0.2in} & \img{U1_2F3c.png}{-2em}{}{10em}\\
\mbox{(g)} \hspace{0.2in} & \mbox{(h)} \hspace{0.2in} & \mbox{(i)}\\
\hline
\end{array}
\]
\begin{sol}
\begin{enumerate}
\item This graph does not define a function, because we can draw a vertical line that intersects two points:
\[
\img{U1F8Sol.jpg}{}{10em}{} \hspace{0.2in}
\]
\item This graph defines a function. Any vertical line will intersect the graph no more than once. The
independent variable is \(u\), and the dependent variable is \(v\).
\item This graph defines a function. The
independent variable is \(y\), and the dependent variable is \(z\).
\item This graph defines a function. The
independent variable is \(t\), and the dependent variable is \(w\).
\item This graph does not define a function, because we can draw a vertical line that intersects two points:
\[
\img{U1F12Sol.jpg}{}{10em}{} \hspace{0.2in}
\]
\item This graph does not define a function, because we can draw a vertical line that intersects two points:
\[
\img{U1F13Sol.jpg}{}{10em}{} \hspace{0.2in}
\]
\item This graph has a \textit{jump} at the \(x\)-value where there is a vertical line in the picture below:
\[\img{U1_2F3d.png}{}{10em}{} \]
Only the bottom point at the jump intersects
the vertical line, because the point at the top corresponds to a hole in the graph. So this graph defines a
function.
\item This graph does not define a function. A vertical line at the jump will intersect two points on the graph.
\item This graph defines a function. A vertical line at the jump will intersect the single point that is in between the
two branches of the graph, and the top and bottom points correspond to holes in the graph.
\end{enumerate}
\end{sol}
\mproblem
Look at the following graphs. Decide if each graph defines a function. If it does, identify the independent and dependent
variables.
\[
\begin{array}{|c|c|c|}
\hline
& \ & \\
\img{U1F14.jpg}{}{10em}{} \hspace{0.2in} & \img{U1F15.jpg}{}{10em}{}
\hspace{0.2in} & \img{U1F16.jpg}{}{10em}{}\\
\mbox{(a)} \hspace{0.2in} & \mbox{(b)} \hspace{0.2in} & \mbox{(c)}\\
\hline
& \ & \\
\img{U1F17.jpg}{}{10em}{} \hspace{0.2in} & \img{U1F18.jpg}{}{10em}{}
\hspace{0.2in} & \img{U1F19.jpg}{}{10em}{}\\
\mbox{(d)} \hspace{0.2in} & \mbox{(e)} \hspace{0.2in} & \mbox{(f)}\\
\hline
& \ & \\
\img{U1_2F3e.png}{}{10em}{} \hspace{0.2in} & \img{U1_2F3f.png}{}{10em}{}
\hspace{0.2in} & \img{U1_2F3g.png}{}{10em}{}\\
\mbox{(g)} \hspace{0.2in} & \mbox{(h)} \hspace{0.2in} & \mbox{(i)}\\
\hline
\end{array}
\]
\problem
The function \(f(x)\) is defined by the graph below:
\[\img{U1_2F3.png}{}{12em}{}\]
Find the following:
(a) \(f(-3)\) | (b) \(f(0)\) |
(c) \(f(1)\) | (d) \(f(3)\) |
(e) \(f(4)\) | (f) \(f(5)\) |
\begin{sol}
\begin{enumerate}
\item
To find \( f(-3)\), find the point on the graph with
\(x\)-coordinate \(-3\). But there is no such point, because there is hole at \((-3,1)\).
So \(f(-3)\) Does Not Exist (DNE).
\item
To find \(f(0)\) find the point on the graph with \(x\)-coordinate \(0\). That is the point \((0,-2)\), on the
\(y\)-axis. So \(f(0)=-2\). Continuing like this, we find:
\end{enumerate}
(c) \(f(1)=1\) | (d) \(f(3)=-2\) |
(e) \(f(4)=0\) | (f)\(f(5)=2\) |
Note the open circle at the point \( (1,2)\), meaning that the point is \textbf{not} on the
graph, so that the graph satisfies the vertical line test.
\end{sol}
\mproblem
The function \(g(x)\) is defined by the graph below:
\[\img{U3F3.jpg}{}{12em}{}\]
Find the following:
(a) \(g(-2)\) | (b) \(g(-1)\) |
(c) \(g(0)\) | (d) \(g(1)\) |
(e) \(g(2)\) | (f) \(g(7)\) |