# 3.2 Graphing Functions Using Vertical and Horizontal Shifts

Often when given a problem, we try to model the scenario using mathematics in the form of words, tables, graphs, and equations. One method we can employ is to adapt the basic graphs of the toolkit functions to build new models for a given scenario. There are systematic ways to alter functions to construct appropriate models for the problems we are trying to solve.

## Identifying Vertical Shifts

One simple kind of transformation involves shifting the entire graph of a function up, down, right, or left. The simplest shift is a vertical shift, moving the graph up or down, because this transformation involves adding a positive or negative constant to the function. In other words, we add the same constant to the output value of the function regardless of the input. For a function $\text{}g\left(x\right)=f\left(x\right)+k,\text{}$ the function $\text{}f\left(x\right)\text{}$ is shifted vertically $\text{}k\text{}$ units. See Figure 3-2 for an example.

To help you visualize the concept of a vertical shift, consider that $\text{}y=f\left(x\right)\text{}$. Therefore, $\text{}f\left(x\right)+k\text{}$ is equivalent to $\text{}y+k\text{}$. Every unit of $\text{}y\text{}$ is replaced by $\text{}y+k,\text{}$ so the $\text{}y\text{-}$ value increases or decreases depending on the value of $\text{}k\text{}$. The result is a shift upward or downward.

### Vertical Shift

Given a function $f\left(x\right)$, a new function $g\left(x\right)=f\left(x\right)+k$, where $\text{}k$ is a constant, is a vertical shift of the function $f\left(x\right)$. All the output values change by $k$ units. If $k$ is positive, the graph will shift up. If $k$ is negative, the graph will shift down.

### Example 1: Adding a Constant to a Function

To regulate temperature in a green building, airflow vents near the roof open and close throughout the day. Figure 3-3 shows the area of open vents $\text{}V\text{}$ (in square feet) throughout the day in hours after midnight, $\text{}t\text{}$. During the summer, the facilities manager decides to try to better regulate temperature by increasing the amount of open vents by 20 square feet throughout the day and night. Sketch a graph of this new function.

### How To

Given a tabular function, create a new row to represent a vertical shift.

1. Identify the output row or column.
2. Determine the magnitude of the shift.
3. Add the shift to the value in each output cell. Add a positive value for up or a negative value for down.

### Example 2: Shifting a Tabular Function Vertically

A function $\text{}f\left(x\right)\text{}$ is given in Table 1. Create a table for the function $\text{}g\left(x\right)=f\left(x\right)-3$.

 $x$ 2 4 6 8 $f\left(x\right)$ 1 3 7 11

#### Analysis

As with the earlier vertical shift, notice the input values stay the same and only the output values change.

### Example 3: Vertical Shift

The function $\text{}h\left(t\right)=-4.9{t}^{2}+30t\text{}$ gives the height $\text{}h\text{}$ of a ball (in meters) thrown upward from the ground after $\text{}t\text{}$ seconds. Suppose the ball was instead thrown from the top of a 10-m building. Relate this new height function $\text{}b\left(t\right)\text{}$ to $\text{}h\left(t\right)\text{}$, and then find a formula for $\text{}b\left(t\right)$.

## Identifying Horizontal Shifts

We just saw that the vertical shift is a change to the output, or outside, of the function. We will now look at how changes to input, on the inside of the function, change its graph and meaning. A shift to the input results in a movement of the graph of the function left or right in what is known as a horizontal shift, shown in Figure 3-4.

For example, if $\text{}f\left(x\right)={x}^{2}\text{}$, then $\text{}g\left(x\right)={\left(x-2\right)}^{2}\text{}$ is a new function. Each input is reduced by 2 prior to squaring the function. The result is that the graph is shifted 2 units to the right, because we would need to increase the prior input by 2 units to yield the same output value as given in $\text{}f$.

### Horizontal Shift

Given a function $\text{}f\text{}$, a new function $\text{}g\left(x\right)=f\left(x-h\right)\text{}$, where $\text{}h\text{}$ is a constant, is a horizontal shift of the function $\text{}f\text{}$. If $\text{}h\text{}$ is positive, the graph will shift right. If $\text{}h\text{}$ is negative, the graph will shift left.

### Example 4: Adding a Constant to an Input

Returning to our building airflow example from Example 1 (Figure 3-5 below), suppose that in autumn the facilities manager decides that the original venting plan starts too late, and wants to begin the entire venting program 2 hours earlier. Sketch a graph of the new function.

#### Analysis

Note that $\text{}V\left(t+2\right)\text{}$ has the effect of shifting the graph to the left.

Horizontal changes or “inside changes” affect the domain of a function (the input) instead of the range and often seem counterintuitive. The new function $\text{}F\left(t\right)\text{}$ uses the same outputs as $\text{}V\left(t\right)\text{}$, but matches those outputs to inputs 2 hours earlier than those of $\text{}V\left(t\right)\text{}$. Said another way, we must add 2 hours to the input of $\text{}V\text{}$ to find the corresponding output for $F:F\left(t\right)=V\left(t+2\right)$.

### How To

Given a tabular function, create a new row to represent a horizontal shift.

1. Identify the input row or column.
2. Determine the magnitude of the shift.
3. Add the shift to the value in each input cell.

### Example 5: Shifting a Tabular Function Horizontally

A function $\text{}f\left(x\right)\text{}$ is given in Table 2. Create a table for the function $\text{}g\left(x\right)=f\left(x-3\right)$.

 $x$ 2 4 6 8 $f\left(x\right)$ 1 3 7 11

#### Analysis

Figure 3-6 represents both of the functions. We can see the horizontal shift in each point.

### Example 6: Identifying a Horizontal Shift of a Toolkit Function

Figure 3-7 represents a transformation of the toolkit function $\text{}f\left(x\right)={x}^{2}\text{}$. Relate this new function $\text{}g\left(x\right)\text{}$ to $\text{}f\left(x\right)\text{}$, and then find a formula for $\text{}g\left(x\right)$.

#### Analysis

To determine whether the shift is $\text{}+2\text{}$ or $\text{}-2$, consider a single reference point on the graph. For a quadratic, looking at the vertex point is convenient. In the original function, $\text{}f\left(0\right)=0\text{}$. In our shifted function, $\text{}g\left(2\right)=0\text{}$. To obtain the output value of 0 from the function $\text{}f\text{}$, we need to decide whether a plus or a minus sign will work to satisfy $\text{}g\left(2\right)=f\left(x-2\right)=f\left(0\right)=0\text{}$. For this to work, we will need to subtract 2 units from our input values.

### Example 7: Interpreting Horizontal versus Vertical Shifts

1. The function $\text{}G\left(m\right)\text{}$ gives the number of gallons of gas required to drive $\text{}m\text{}$ miles. Interpret $\text{}G\left(m\right)+10\text{}$ and $\text{}G\left(m+10\right)$.
2. Given the function $\text{}f\left(x\right)=\sqrt{x}\text{}$, graph the original function $\text{}f\left(x\right)\text{}$ and the transformation $\text{}g\left(x\right)=f\left(x+2\right)\text{}$ on the same axes. Is this a horizontal or a vertical shift? Which way is the graph shifted and by how many units?

## Combining Vertical and Horizontal Shifts

Now that we have two transformations, we can combine them together. Vertical shifts are outside changes that affect the output $(y\text{-})$ axis values and shift the function up or down. Horizontal shifts are inside changes that affect the input $(x\text{-})$ axis values and shift the function left or right. Combining the two types of shifts will cause the graph of a function to shift up or down and right or left.

### How To

Given a function and both a vertical and a horizontal shift, sketch the graph.

1. Identify the vertical and horizontal shifts from the formula.
2. The vertical shift results from a constant added to the output. Move the graph up for a positive constant and down for a negative constant.
3. The horizontal shift results from a constant added to the input. Move the graph left for a positive constant and right for a negative constant.
4. Apply the shifts to the graph in either order.

### Exercise 8: Graphing Combined Vertical and Horizontal Shifts

1. Given $\text{}f\left(x\right)=|x|\text{}$, sketch a graph of $\text{}h\left(x\right)=f\left(x+1\right)-3$.
2. Given $\text{}f\left(x\right)=|x|\text{}$, sketch a graph of $\text{}h\left(x\right)=f\left(x-2\right)+4$.

### Example 9: Identifying Combined Vertical and Horizontal Shifts

1.  Write a formula for the graph shown in Figure 3-8, which is a transformation of the toolkit square root function.

#### Analysis

Note that this transformation has changed the domain and range of the function. This new graph has domain $\text{}\left[1,\infty \right)\text{}$ and range $\text{}\left[2,\infty \right)$.

1. Write a formula for a transformation of the toolkit reciprocal function $\text{}f\left(x\right)=\frac{1}{x}\text{}$ that shifts the function’s graph one unit to the right and one unit up.