\chapter{Functions and graphs}
\section{Equations from graphs}
\subsection{Shifts}
We now discuss how to obtain the equation of a function when we are given its graph and
we know that it is obtained from
a transformation of some of the basic parent functions.
If the graph is a horizontal line (so that the slope is zero), then it is just the zero function shifted up or down.
If it is a straight line with a non-zero slope, we can choose any two points, find the slope, and then
write the point-slope formula, as is done in elementary algebra.
The reciprocal function is the simplest case of a \textit{rational function}, that will be discussed
in Chapter 2, and we will not include it here.
This leaves us with the other five basic parent functions: the square, cube, square root,
cube root, and absolute value.
First we need to determine if there is a shift. To do this, we need to identify a special,
key point of the graph, that we will call the \textit{base point \(P\)}.
For the square function \(x^2\) and the absolute value function \(|x|\),
the base point \(P\) is the \textit{vertex}, that is the lowest point on the graph.
\[
\begin{array}{cc}
\img{U1_11F35.jpg}{}{6em}{} &\hspace{3ex} \img{U1_11F39.jpg}{}{12em}{}
\end{array}
\]
For the square root function, use the beginning of the graph as base point \(P\), and for the cube and
cube root functions use the point where the graph ``flips'', meaning that the curve
changes from bending down to bending up, or from up to down.
\[
\begin{array}{ccc}
\img{U1_11F36.jpg}{}{8em}{} & \hspace{3ex} \img{U1_11F37.jpg}{}{5em}{}
& \hspace{3ex} \img{U1_11F38.jpg}{}{14em}{}
\end{array}
\]
\subsection{Stretching and compressing}
If the graph is only shifted (and possibly reflected, which is easily spotted from the shape), without any
stretching or compressing, the base point \(P\) is all we
need to find the formula for the graph.
To determine if there is a stretching or a compression, look at the grid points
immediately top right, top left, bottom right or bottom left of the base point \(P\). We call these points the \textit{neighboring} points of \(P\). If there is no stretching or compression,
the graph must go through at least one of the neighboring points. If it doesn't, there is some stretching
or compression.
\begin{example}
The following graphs are all obtained by some simple transformations of some basic function.
\[
\begin{array}{cccc}
\img{U1_11F48.png}{}{12em}{} &
\img{U1_11F49.png}{}{12em}{} &
\img{U1_11F50.png}{}{12em}{} &
\img{U1_11F51.png}{}{12em}{} \\
\mbox{a. } & \mbox{b. } & \mbox{c. } & \mbox{d. }
\end{array}
\]
The graphs in a. and c. do not go through any of the neighboring points of \(P\), so there must be some
stretching or compression. The graphs in b. and d. go through a neighboring point, so there is no stretching or
compression.
\end{example}
\begin{example}
Use the graph of \(f(x) = \sqrt{x}\) to write an equation for the function whose graph is shown below:
\[\img{U1_11F52.png}{}{14em}{}\]
This graph is a transformation of the parent function \(f(x) = \sqrt{x}\). The base point is \(P=(-3,2)\).
Because the graph goes through a neighboring point of \(P\), there is no stretching or compression.
The transformations are:
reflecting across the \(x\)-axis, shifting left \(3\) units, and shifting up \(2\) units. Therefore, the equation for the function is \(\fbox{\(f(x) = -\sqrt{x + 3} + 2\)}\).
\end{example}
If the graph is stretched or compressed, we need a second point. To see how this is done, we first need to note some properties of our basic parent functions.
The absolute value function is an easy case: because \(|ax|=a|x|\) for any positive
number \(a\), any vertical stretching by \(a\) is also a horizontal compression by the same number. See the figure:
\[\img{U1_11F47.jpg}{}{14em}{} \]
The original graph is \(y=|x|\), dashed and in black. The stretched/compressed graph is in red.
We can think of the red graph either as a vertical stretch by 2: \(y=2|x|\) (the black dot \((2,2)\)
becomes \((2,4)\)), or a horizontal compression by 2: \(y=|2x|\) (the black dot \((4,4)\) becomes
\((2,4)\)).
Stretching/compression for \(y=|x|\) |
A vertical stretching of \(y=|x|\) by a positive number \(a\)
is also a horizontal compression by the same number, and a vertical compression is also a horizontal stretching. |
This leaves us with the four basic parent functions: square, cube, square root, cube root. Now we
note that each of these is a power function: \(y=x^n\), where \(n=2\) for the square function,
\(n=3\) for the cube function, \(n=1/2\) for the square root, and \(n=1/3\) for the cube root.
So we can use a single formula, \(f(x)=x^n\), for all four of them. Then a horizontal stretching or compression
by \(a\) is \(f(ax)=(ax)^n=a^n x^n\). But this is also a vertical stretching or compression by \(a^n\).
Stretching or compression for \(y=x^n\) |
A horizontal stretching (or compression) of
\(f(x)=x^n\) by a positive number \(a\)
is also a vertical compression (or stretching) by \(a^n\) |
This means that for a graph obtained by stretching or compressing one of our basic parent functions,
if we know one type of stretching or compression (horizontal or vertical) we can easily find the other type.
\begin{example} \
\begin{enumerate}
\item
Consider \(f(x)=4x^2\). Then we know that \(f(x)\) is the square function stretched vertically
by 4. But \(4x^2=(2x)^2\), so we
can also say that \(f(x)\) is the square function compressed horizontally by 2.
\item
Consider \(\displaystyle f(x)=\sqrt{\frac{x}{3}}\). Then we know that
\(f(x)\) is the square root function stretched horizontally by 3.
But
\[{f(x)=\sqrt{\frac{x}{3}}=\frac{\sqrt{x}}{\sqrt{3}}}=\frac{1}{\sqrt{3}} \sqrt{x},\]
so \(f(x)\) is also the square root function compressed vertically by \(\sqrt{3}\).
\end{enumerate}
\end{example}
So for each stretching or compression of a basic parent function we have a choice: we can either
use a vertical compression (stretching), or a horizontal stretching (compression). But as we see from
the last example, sometimes one is easier to understand than the other: for
\(\displaystyle{f(x)=\sqrt{\frac{x}{3}}}=\frac{1}{\sqrt{3}}\sqrt{x}\), it's easier to think of it as a horizontal
stretching by 3 rather than a vertical compression by \(\sqrt{3}\).
Our next goal now is a method to find the vertical stretching or compressionfrom a given graph.
Recall that to find the shift we used the base point \(P\). To find the vertical stretching or compression,
we need to use a second point, that we will call \(Q\).
While any point other than \(P\) could be used, we would like to get precise information
in an easy way.
To do this, always try to choose a point whose coordinates are whole numbers.
This means that the point should be on the grid. So look for the first grid point on
the graph as you move away from \(P\). The next example shows
how to choose the point \(Q\):
\begin{example} \label{Q}\
\[
\begin{array}{ccc}
\img{U1_11F31.jpg}{}{15em}{} &
\img{U1_11F33.jpg}{}{12em}{} & \img{U1_11F34.jpg}{}{10em}{}\\
\mbox{a. } & \mbox{b. } & \mbox{c. }
\end{array}
\]
We now use these three graphs to show how the points \(P\) and \(Q\) on a transformed graph determine
the shift and the vertical shrinking or stretching.
\begin{enumerate}
\item \
\(\img{U1_11F31.jpg}{}{15em}{}\).
The basic parent function is \(f(x)=x^2\). The base point \(P\) has
coordinates \(P=(1,-3)\). This means that there is a horizontal shift right by 1, and
a vertical shift down by 3. So the equation will look like
\[g(x)=a(x-1)^2-3.\]
where we still need to find \(a\). To do this, we use the second point \(Q=(2,-1)\). Substituting \(x=2\) and
\(g(x)=-1\), we find:
\[-1=a(2-1)^2-3\]
and solving for \(a\) we get \(a=2\). So the equation of \(g(x)\) is
\[g(x)=2(x-1)^2-3.\]
\item \
\(\img{U1_11F33.jpg}{}{12em}{}.\)
The basic parent function is \(f(x)=\sqrt{x}\). The base point \(P\) has
coordinates \(P=(0,-1)\). So there is no horizontal shift, and there is
a vertical shift down by 1. The equation will be of form
\[g(x)=a\sqrt{x}-1.\]
Using the point \(Q=(3,0)\), we find
\[0=a\sqrt{3} -1\]
and so \(a=1/\sqrt{3}\). Since \(\displaystyle \frac{1}{\sqrt{3}}\sqrt{x}=\sqrt{\frac{x}{3}}\),
the equation for the transformed function is
\[g(x)=\sqrt{\frac{x}{3}}-1.\]
\item \
\(\img{U1_11F34.jpg}{}{10em}{}\).
The basic parent function is \(f(x)=x^3\). The base point \(P\) has
coordinates \(P=(-2,-2)\). So there is a horizontal shift left by 2, and
a vertical shift down by 2. The equation will look like
\[g(x)=a(x+2)^3-2.\]
Substituting \(Q=(0,2)\), we get
\[2 = a(0+2)^3-2.\]
Solving for \(a\) we find \(a=1/2\), and the equation for \(g\) is
\[g(x)=\frac{1}{2}(x+2)^3-2.\]
\end{enumerate}
\end{example}
Problems
\problem
The figure below shows the graphs of functions that are obtained by applying simple transformations
to some of the basic parent functions. Find the equation of the function in each case.
\[
\begin{array}{ccc}
\img{U1_11F40.jpg}{}{10em}{}& \img{U1_11F32.jpg}{}{10em}{} &
\img{U1_11F41.jpg}{}{10em}{}\\
\mbox{(a) } f(x) & \mbox{(b) } g(x) & \mbox{(c) } h(x)
\end{array}
\]
\begin{sol}
\begin{enumerate}
\item
We recognize the shape of the parent square function. We locate the points \(P\) and \(Q\)
as in the picture:
\[\img{U1_11F42.jpg}{}{10em}{}\]
So \(P=(0,-3)\), \(Q=(4,-2)\). There is no horizontal shift, and a shift down by 3.
Using \(P\) and \(Q\) as before, we find
\[f(x)=\frac{1}{16}x^2 -3.\]
Using a horizontal stretch we can also write this answer as
\[f(x)=\left(\frac{x}{4}\right)^2-3.\]
\item
The shape is the absolute value function \(|x|\), but it is reflected across the \(x\)-axis. We notice
that there is no stretching or shrinking (the straight lines are at \(45^\circ\) angle,
just like in the original parent function). So we do not need the second point \(Q\).
The vertex \(P\) is at \((-2,1)\).
So the graph is shifted left by 2 and up by 1, and the equation is
\[g(x)=-|x+2|+1.\]
\item
The shape is that of the parent cube root function. We locate the points \(P\) and \(Q\):
\[\img{U1_11F43.jpg}{}{10em}{}\]
So \(P=(2,-1)\), \(Q=(3,1)\). There is a shift to the right by 2 and down by 1. Substituting \(x=3\) and \(h(x)=1\) in
\[h(x)=a\sqrt[3]{x-2}-1\]
and solving for \(a\), we find
\(a=2\)
and the solution is
\[h(x)=2\sqrt[3]{x-2}-1.\]
\end{enumerate}
\end{sol}
\mproblem
The figure below shows the graphs of functions that are obtained by applying simple transformations
to some of the basic parent functions. Find the equation of the function in each case.
\[
\begin{array}{ccc}
\img{U1_11F44.jpg}{}{10em}{} & \img{U1_11F45.jpg}{}{10em}{} &
\img{U1_11F46.jpg}{}{10em}{}\\
\mbox{a. } f(x) & \mbox{b. } g(x) & \mbox{c. } h(x)
\end{array}
\]