In the previous section, we got familiar with the graphs of many important functions. We may use these graphs and simply shift, reflect, or stretch them to sketch the graphs of many more functions. In this section, we will learn how to do that. As we discussed before graphs of functions provide much valuable information about the functions.

In this section, suppose the graph of $y=f(x)$ is known.

Graph of y = f(x) ± c: Vertical Shift

Consider some function $f$. If the point $(1,3)$ is on the graph of $f$, it means $f(1)=3$. If the function $g$ is defined such that
\[
g(x)=f(x)+2
\] then we immediately conclude that the point $(1,5)$ is on the graph of $g$ because $g(1)=f(1)+2=3+2=5.$
\[
(1,3)\text{ on the graph of }f\quad\stackrel{g(x)=f(x)+2}{\Longleftrightarrow}(1,5)\text{ on the graph of }g
\] In general, if $(a,b)$ is on the graph of $f$ (meaning $f(a)=b)$,then we know that the point $(a,b+2)$ is on the graph of $g$ because $g(a)=f(a)+2=b+2.$
\[
(a,b)\text{ on the graph of }f\quad\stackrel{g(x)=f(x)+2}{\Longleftrightarrow}(a,b+2)\text{ on the graph of }g
\] So the graph of $g$ is the graph of $f$ shifted upward 2 units.

Figure 1: Vertical shift of the graph of $y=f(x)$ . If we add a positive number $c $ to the formula of a function, the graph of the function will shift upward $c$ units and if we subtract $c>0$ from its formula, its graph will shift downward $c $ units.

 

In general, we can obtain the graph of $y=f(x)+c$ ($c>0$) by shifting the graph of $f$ upward $c$ units because for each $x$, the value of the function $y=f(x)+c$ is $c$ units larger than the value of the function $y=f(x)$. Similarly to get the graph of $y=f(x)-c$ ($c>0$), we just need to shift the graph of $f$ downward $c$ units. This is illustrated in Figure 1.

Graph of y = f(x ∓ c): Horizontal Shift

Consider some function $f$. If the point $(1.5,4)$ is on the graph of $f$, it means $f(1.5)=4$. If the function $g$ is defined such that
\[
g(x)=f(x-2)
\] then we know that the point $(3.5,4)$ is on the graph of $g$ because $g(3.5)=f(3.5-2)=f(1.5)=4$.
\[
(1.5,4)\text{ on the graph of }f\quad\stackrel{g(x)=f(x-2)}{\Longleftrightarrow}(3.5,4)\text{ on the graph of }g
\] In general, if the point $(a,b)$ is on the graph of $f$, then the point $(a+2,b)$ is on the graph of $g$:
\[
(a,b)\text{ on the graph of }f\quad\stackrel{g(x)=f(x-2)}{\Longleftrightarrow}(a+2,b)\text{ on the graph of }g
\] So the graph of $g$ is the graph of $f$ shifted 2 units to the right.

More generally if $g(x)=f(x-c)$ then

\[
\boxed{(a,b)\text{ on the graph of }f\quad\stackrel{g(x)=f(x-c)}{\Longleftrightarrow}(a+c,b)\text{ on the graph of }g}
\]

Graphically this means that:

We can obtain the graph of $y=f(x-c)$ ($c>0$) by shifting the graph of $f$ to the right $c$ units. Similarly to get the graph of $y=f(x+c)$,we just need to shift the graph of $f$ to the left $c$ units.

  Note that when we subtract a constant $c>0$ from the input of a function, the graph shifts to the right (not to the left), and when we add $c>0$ to the input of a function, its graph shifts to the left! In other words, shifts in the argument (= input) of a function are horizontal shifts to its graph opposite the sign. This is illustrated in Figure 2.

Figure 2: Horizontal shift of the graph of $y=f(x)$

 

Example 1
Use the graph of $f(x)=x^{2}$ to sketch the graph of each function:
(a) $g(x)=x^{2}-1$
(b) $h(x)=(x+2)^{2}$
(c) $F(x)=(x-2)^{2}$
(d) $G(x)=(x-2)^{2}+2$
Solution
In the previous section, we learned how the graph of $f(x)=x^{2}$ looks like. 
(a) We observe that
\[
g(x)=x^{2}-1=f(x)-1.
\] Therefore to sketch the graph of $g$, we need to shift the graph of $f$ downward 1 unit.

Figure 3

(b) We observe that
\[
h(x)=(x+2)^{2}=f(x+2).
\] Therefore to sketch the graph of $h$, we need to shift the graph of $f$ to the left 2 units. Note that $h(-2)=f(0)=0$.

Figure 4

(c) We observe that
\[
F(x)=(x-2)^{2}=f(x-2).
\] Therefore to sketch the graph of $F$, we need to shift the graph of $f$ to the right 2 units.  Note that $F(2)=f(0)=0$.

Figure 5

(d) We observe that
\[
G(x)=(x-2)^{2}+2=F(x)+2.
\] In (c), we obtained the graph of $F$. Thus to get the graph of $G$,we just need to shift the graph of $F$ upward 2 unit.

Figure 6

Graph of y = – f(x): Reflection in the x-axis

Consider some function $f$. Suppose the points $(1,2)$ and $(3,-4)$ are on the graph of $f$ meaning$f(1)=2$ and $f(3)=-4$. If the function $g$ is defined such that $g(x)=-f(x)$, we then conclude that $(1,-2)$ and $(3,4)$ are on the graph of $g$ because $g(1)=-f(1)=-2$ and $g(3)=-f(3)=-(-4)=4$.
\[
(1,2),(3,-4)\text{ on the graph of }f\quad\stackrel{g(x)=-f(x)}{\Longleftrightarrow}\quad(1,-2),(3,4)\text{ on the graph of }g.
\] or generally
\[
\boxed{(a,b)\text{ on the graph of }f\quad\stackrel{g(x)=-f(x)}{\Longleftrightarrow}\quad(a,-b)\text{ on the graph of }g.}
\] Graphically it means:

We can obtain the graph of $y=-f(x)$ by reflecting the graph of $f$ in the $x$-axis using the $x$-axis as our mirror because for each $x$, the value of $y=-f(x)$ is the negative of the value of $y=f(x)$,as illustrated in Figure 7.
Figure 7: The graph of $y=-f(x)$ is obtained by reflecting the graph of $ y=f(x) $ in the $x$ -axis.

 

 

Graph of y = f(-x): Reflection in the y-axis.

Consider some function $f$. If the points $(1.5,3.7)$ and $(-2.3,-5)$ are on the graph of $f$, it means $f(1.5)=3.7$ and $f(-2.3)=-5$.If the function $g$ is defined such that $g(x)=f(-x)$, we conclude that $(-1.5,3.7)$ and $(2.3,-5)$ are on the graph of $g$ because $g(-1.5)=f(1.5)=3.7$ and $g(2.3)=f(-2.3)=-5$.
\[
(1.5,3.7),(-2.3,-5)\text{ on the graph of }f\quad\stackrel{g(x)=f(-x)}{\Longleftrightarrow}\quad(-1.5,3.7),(2.3,-5)\text{ on the graph of }g.
\]

In general, if $g(x)=f(-x)$
\[
\boxed{(a,b)\text{ on the graph of }f\quad\stackrel{g(x)=f(-x)}{\Longleftrightarrow}\quad(-a,b)\text{ on the graph of }g.}
\] Graphically this means:

We can obtain the graph of $y=f(-x)$ by reflecting the graph of $f$ in the $y$-axis, as illustrated in Figure 8.
Figure 8: The graph of $y=f(-x) $ is obtained by reflecting the graph of $y=f(x) $ in the $y$ -axis.
Example 2
Sketch the graph of each function and determine the domain and range:
(a) $y=-x^{2}$
(b) $y=\sqrt{-x}$
(c) $y=1-\sqrt{-x-2}$
Solution

(a) We begin with the graph of $y=x^{2}$ that we know how it looks like (shown in black in Figure 9).
If the graph of $y=x^{2}$ contains the point $(a,b)$, then the graph of $y=-x^{2}$ contains the point $(a,-b)$. Therefore, the graph of $y=-x^{2}$ is obtained by reflecting the graph of $y=x^{2}$ in the $x$-axis. As we can see in Figure 9,the domain of $y=-x^{2}$ is all real numbers, $\mathbb{R}=(-\infty,\infty)$ and the range is $(-\infty,0]$.

Figure 9

 

(b) We begin with the graph of $y=\sqrt{x}$, as shown in black in Figure 10. If the graph of $y=\sqrt{x}$
contains the point $(a,b)$, then the graph of $y=\sqrt{-x}$ contains the point $(-a,b)$. Therefore, the graph of $y=-\sqrt{x}$ is obtained by reflecting the graph of $y=\sqrt{x}$ in the $y$-axis. As we can see in Figure 10, the domain of $y=\sqrt{-x}$ is $(-\infty,0]$ and its range is the set of all nonnegative numbers or $[0,\infty)$.

Figure 10

 

(c) Let $f(x)=\sqrt{-x}$. In part (b), we learned how the graph of $f$ looks like, shown as dashed curve in Figure 11(a).To get the graph of $y=f(x+2)=\sqrt{-(x+2)}$, we need to shift the graph of $f$ to the left 2 units (Figure 11(a)).
Let $g(x)=f(x+2)$, then the graph of $y=-g(x)$ is obtained by reflecting the graph of $g$ in the $x$-axis, as shown in Figure 11(b).Now, to get the graph of $y=1-\sqrt{-x-2}$, we need to shift the graph of $y=-g(x)=-\sqrt{-x-2}$ upward 1 unit (Figure 11(c)).
As we can see, the domain of $y=1-\sqrt{-x-2}$ is $(-\infty,2]$ and its range is $(-\infty,1]$.

Figure 11(a)
Figure 11(b)
Figure 11(c)

Graph of y = c f(x): Vertical Scaling

Suppose the function $g$ is defined such that
\[
g(x)=cf(x).
\] Then
\[
(a,b)\text{ on the graph of }f\Longleftrightarrow(a,cb)\text{ on the graph of }g
\] because
\[
g(a)=cf(a)=cb.
\]

So we can obtain the graph of $y=cf(x)$ by replacing every point $P(x,y)$ that is on the graph of $f$ by the point $P'(x,cy)$.That is, the $y$-coordinate of each point on the graph of $f$ has been enlarged $c$ times if $c>1$ or reduced $1/c$ times if $0<c<1$.

To obtain the graph $y=cf(x)$ from the graph of $y=f(x)$

  •  If $c>1$, vertically stretch the graph of $f$ (away from the $x$-axis) by a factor of $c$ (Figure 12(a)).
  •  If $0<c<1$,vertically compress the graph of $f$ (toward the $x$-axis) by a factor of $c$ (Figure 12(b)).
  •  If $c<0$, first by vertically stretching or compressing to obtain the graph of $y=|c|f(x)$ and then reflect the result in the $x$-axis.

Obviously $c=1$ has no effect.

(a) $c>1$ (b) $0<c<1$

Figure 12: The graph of  $y=cf(x)$ is obtained by stretching the graph of $y=f(x)$ vertically if $ c>1$ and by compressing it vertically if $0<c<1$. 

Example 3
Use the graph of $y=\dfrac{1}{x}$ to obtain the graph of $y=\dfrac{1}{2x}$.
Solution
For each $x\neq0$, the $y$-coordinate of a point on the graph of $y=\frac{1}{2x}$ is half of the $y$ coordinate of the corresponding point on the graph of $y=\frac{1}{x}$. That is, to obtain the graph of $y=\frac{1}{2x}$, we vertically compress the graph of $y=\frac{1}{x}$ (toward the $x$-axis) by a factor of $1/2$. The result is shown in the following figure.

Figure 13

Graph of y = f (cx): Horizontal Scaling

Suppose the function $g$ is defined such that
\[
g(x)=f(cx).
\] Then
\[
(a,b)\text{ on the graph of }f\Longleftrightarrow(a/c,b)\text{ on the graph of }g
\] because
\[
g\left(\frac{a}{c}\right)=f\left(c\frac{a}{c}\right)=f(a)=b.
\] In other words, we can obtain the graph of $ y=f(cx)$ by replacing every point $P(x,y)$ that is on the graph of $f$ by the point $P'(x/c,y)$. That is, the $x$-coordinate of each point on the graph of $f$ has been reduced $1/c$ times if $c>1$ or enlarged $1/c$ times if $0<c<1$.

Graphically this means:

To obtain the graph of $y=f(cx)$:

  •  If $c>1$, horizontally compress the graph of $f$ (toward the $x$-axis) by a factor of $1/c$ (Figure 14(a)).
  •  If $0<c<1$, horizontally stretch the graph of $f$ (away from the $x$-axis) by a factor of $1/c$ (Figure 14(b)).
  •  If $c<0$, first horizontally compress or stretch by a factor of $|1/c|$and reflect the result in the $y$-axis.

(a) $c>1$ (b) $0<c<1$

Figure 14: The graph of $y=f(cx)$ is obtained by horizontally compressing the graph of $ y=f(x)$ toward the $y$-axis if $ c>1$ and by stretching it if $0<c<1$.

Example 4
Use the graph of $y=\sqrt[3]{x}$ to obtain the graph of each function:
(a) $y=\sqrt[3]{4x}$
(b) $y=\sqrt{-2x}$
Solution
(a) The graph of $y=\sqrt[3]{4x}$ is obtained by horizontally compressing the graph of $y=\sqrt[3]{x}$ (toward the $y$-axis) by a factor of $1/4$. The result is shown in Figure 15(a).

Note that because $y=\sqrt[3]{4x}=\sqrt[3]{4}\sqrt[3]{x}$, we could obtain the same result by vertically stretching the graph of $y=\sqrt[3]{x}$ by a factor $\sqrt[3]{4}\approx1.5874$ as illustrated in Figure 15(b).

Figure 15 (a): Graph of $ y=\sqrt[3]{4x}$ is obtained from the graph of $y=\sqrt[3]{x}$ by horizontally compressing by a factor of $1/4$
Figure 15 (b): Graph of $y=\sqrt[3]{4x}$ is obtained from the graph of $ y=\sqrt[3]{x}$ by vertically compressing by a factor of $ \sqrt[3]{4}$

 

(b) Let $f(x)=\sqrt[3]{4x}$. In part (a), we obtained the graph of $f$, so to get the graph of $y=f(-x)=\sqrt[3]{-4x}$, we just need to reflect the graph of $f$ in the $y$-axis (see the following figure). For this specific example, because $y=\sqrt[3]{-4x}=-\sqrt[3]{4x}=-f(x)$,we can obtain the graph of $y=\sqrt[3]{-4x}$ by reflecting the graph of $f$ in the $x$-axis as well.

Figure 16 : Graph of $y=\sqrt[3]{-4x} $ can be obtained by reflecting the graph of $y=\sqrt[3]{4x} $ in the $ y $ -axis or in the $x $ -axis.

Example 5
The graph of $f(x)=\frac{1}{4}x^{3}-\frac{1}{4}x^{2}-x+1$ is shown in Figure 17. (a) Find the function whose graph is obtained by stretching the graph of $f$ horizontally by a factor of $1.5$ followed by a reflection
in the $x$-axis. 
(b) Find the function whose graph is obtained by compressing the graph of $f$ vertically by a factor of $1/2$ followed by a reflection in the $y$-axis.

Figure 17 : Graph of $f(x)=\frac{1}{4}x^{3}-\frac{1}{4}x^{2}-x+1 $
Solution
(a) Dividing $x$ by $1.5$ gives the horizontal stretch, and multiplying the value of the resulting function by $-1$ gives the reflection in the $x$-axis. Therefore, the new function is
\begin{align*}
y & =-f\left(\frac{2}{3}x\right)\\
& =-\left[\frac{1}{4}(\frac{2}{3}x)^{3}-\frac{1}{4}(\frac{2}{3}x)^{2}-(\frac{2}{3}x)+1\right]\\
& =-\frac{2}{27}x^{3}+\frac{1}{9}x^{2}+\frac{2}{3}x-1
\end{align*}
See Figure 18 (a).

Figure 18 : Graph of $y=-\frac{2}{27}x^{3}+\frac{1}{9}x^{2}+\frac{2}{3}x-1 $

(b) Multiplying $f(x)$ by $1/2$ gives the vertical compression and multiplying $x$ by $-1$ gives the reflection in the $y$-axis:
\begin{align*}
y & =\frac{1}{2}f(-x)\\
& =\frac{1}{2}\left[\frac{1}{4}(-x)^{3}-\frac{1}{4}(-x)^{2}-(-x)+1\right]\\
& =-\frac{1}{8}x^{3}-\frac{1}{8}x^{2}+\frac{1}{2}x+\frac{1}{2}.
\end{align*}
See Figure 19 .

 
Figure 19 : Graph of $y=-\frac{1}{8}x^{3}-\frac{1}{8}x^{2}+\frac{1}{2}x+\frac{1}{2} $

Combining Transformations

Now we consider the general case:

Suppose we have the graph of $y=f(x)$ and we wish to obtain the graph of

\[
y=kf(ax-b)+h,\tag{i}
\] It is important to apply these transformations to the graph of $y=f(x)$ in the following order:
1. Horizontal scaling by a factor of $1/|a|$ (If $a<0$, it will be followed by a reflection in the $y$-axis)
2.Horizontal shift by $b/a$ units
3. Vertical scaling by a factor of $|k|$ (followed by a reflection in the $x$-axis if $k<0$)
4. Vertical shift by $h$ units

Why such a sequence of transformations?

We first rewrite it as
\[
y=kf\big(a(x-b/a)\big)+h
\] Consider the function $g$ defined as
\[
g(x)=f(ax).
\] The graph of $g$ is obtained by horizontally scaling by a factor of $1/|a|$ (followed by a reflection in the $y$ axis if $a<0$).
Now consider the function $F$ defined as
\[
F(x)=g(x-b/a)=f(a(x-b/a)).
\] So the graph of $y=F(x)$ is the graph of $g$ horizontally shifted by $b/a$ units. Finally consider the function $G$ defined as
\begin{align*}
G(x) & =kF(x)+h\\
& =kf(a(x-b/a))+h.
\end{align*}
The graph of $G$ is what we are looking for and is obtained by a vertical scaling by a factor of $|k|$ (followed by a reflection in the $x$-axis if $k<0$) and then a vertical shift by $h$ units.

Example 6
Use the graph of $y=\sqrt{x}$ to obtain the graph of $y=2-\sqrt{2x+4}$ and determine its domain and range.
Solution
Rewrite $y=2-\sqrt{2x+4}$ as
\[
y=-\sqrt{2(x+2)}+2
\] Step 1: Start with the graph of $y=\sqrt{x}$.
Step 2: $y=\sqrt{2x}$ (Horizontally compress by a factor of $1/2$ toward the $x$-axis or stretch vertically by a factor of $\sqrt{2}$)

Step 3: $y=\sqrt{2(x+2)}$ (Horizontally shift the graph of $y=\sqrt{2x}$ to the left 2 units)

Step 4: $y=-\sqrt{2(x+2)}$ (Reflect in the $x$-axis)

Step 5: $y=-\sqrt{2(x+2)}+2$ (Vertically shift up 2 units)


Graph of y = |f(x)|: Reflection of the Negative Part

Taking the absolute value of $f(x)$ changes all negative outputs of $f$ into their opposites and leaves nonnegative outputs unchanged.

Graphically, this means:

We can obtain the graph of $y=|f(x)|$ by reflecting every point on the graph of $f$ that is below the $x$-axis up to the above $x$-axis,as illustrated in Figure 20.

 

Figure 20 : The graph of $y=|f(x)| $is obtained by reflection of every point on the graph of $y=f(x) $ that is below the $ x $ -axis to above.

 

 

Graph of y = f(|x|): Duplication and Reflection of the Right Part

Suppose the function $g$ is defined such that
\[
g(x)=f(|x|).
\] If, for example, $(1,-3)$ is on the graph of $f$, then $(1,-3)$ and $(-1,-3)$ are on the graph of $g$ because $g(1)=f(|1|)=f(1)=-3\text{ and }g(-1)=f(|-1|)=f(1)=-3$.

In general, if $(a,b)$ is on the graph of $f$ and $a\ge0$ then $g(a)=f(|a|)=f(a)=b$. Also $g(-a)=f(|-a|)=f(|a|)=f(a)=b$ Therefore:
\[
\boxed{(a,b)\text{ on the graph of }f\text{ and }a\ge0\Rightarrow(a,b)\text{ and }(-a,b)\text{ on the graph of }g}
\] Graphically it means:

We can obtain the graph of $y=f\left(|x|\right)$ by removing the graph of $y=f(x)$ for $x<0$ (deleting the points that are on the left of the $y$-axis) and reflecting the graph of $y=f(x)$ for $x\geq0$ in the $y$-axis while keeping this part of the graph of $f$ as well, as illustrated in Figure 21.

Figure 21 : The graph of $y=f(|x|)$ is obtained by reflecting every point on the graph of $ y=f(x) $ that is on the right of the $y $ -axis in the $y$-axis.
  • Note that if $g(x)=f(|x|)$, then $g$ is an even function because for all $x$ in the domain of $g$ we have
    \begin{align*}
    g(-x) & =f(|-x|)
    & =f(|x|)
    & =g(x).
    \end{align*}

So the graph of $g$ has to be symmetric about the $y$-axis.

  • Graphs of two functions $f$ and $g$ are shown in Figure 22(a,b). Because the parts of these two graphs that are left of the$y$-axis coincide, the graphs of $y=f(|x|)$ and $y=g(|x|)$ are the same (Figure 22(c)).
(a) Graph of $y=f(x)$ (b) Graph of $y=g(x)$ (c) Graph of $y=f(|x|)$ or $y=g(|x|)$

Figure 22

Example 7
Sketch the graph of each function:
(a) $f(x)=\left(|x|-1\right)^{2}-2$
(b) $g(x)=\left|\left(|x|-1\right)^{2}-2\right|$
Solution
(a) We use the following steps to get the graph of $y=f(x)$
Step 1: Start with the graph of $y=x^{2}$ that we know what it looks like. 
Step 2: $y=(x-1)^{2}$ (Horizontally shift to the right 1 unit)
Step 3: $y=(x-1)^{2}-2$ (Vertically shift down 2 units. See Figure 23(a))
Step 4: $y=(|x|-1)^{2}-2$ }(Ignore the part that is left of the $y$-axis, keep the right part and reflect it in the $y$-axis. See Figure 23 (b)

Figure 23(a)
Figure 23(b)

(b) Because in (a) we obtained the graph of $f(x)=\left(|x|-1\right)^{2}-2$, to get the graph of $g(x)=\left|\left(|x|-1\right)^{2}-2\right|$, we just need to reflect any portion of the graph of $f$ that is below the $x$-axis up to above the $x$-axis, using the $x$-axis as our mirror while leaving the rest of the graph of $f$ unchanged. The result is shown in the following figure.

Figure 24