Skip to main content

Section 5.2 Horizontal Shifts

Example 5.15. Warm-up.

Suppose \(f(x)\) is given in the table below:

Table 5.16.
\(x\) \(f(x)\)
\(-1\) \(2\)
\(0\) \(3\)
\(1.3\) \(-4\)
\(7\) \(0\)
\(14\) \(1\)

Now, let's define a new function \(g(x)=f(x+3)\text{.}\) We want to construct the table for \(g(x)\text{.}\) Let's follow the same logic we had for the warm-up in section Section 5.1: to fill in the top row, we need to find \(g(-1)\text{.}\) Based on our definition of \(g(x)\text{,}\) we have that \(g(-1)=f(-1+3)=f(2)\text{.}\) However, at this point we are stuck, because \(x=2\) is not in our table for \(f(x)\text{.}\) So, we cannot use the same input values for \(g(x)\text{.}\) Instead, we need to reverse engineer what inputs we can use for \(g(x)\) that will match up to the inputs we have for \(f(x)\text{.}\) For example, we know what \(f(-1)\) is, and \(g(-4)=f(-4+3)=f(-1)\text{,}\) that means we can use \(-4\) as one of our inputs for \(g(x)\) and we have that \(g(-4)=2\text{.}\) We can follow the same logic to get the rest of the table:

Table 5.17.
\(x\) \(g(x)\)
\(-4\) \(2\)
\(-3\) \(3\)
\(-2.3\) \(-4\)
\(4\) \(0\)
\(11\) \(1\)

Let's compare the two functions we looked at in the warm-up example:

Table 5.18.
\(x\) \(f(x)\)
\(-1\) \(2\)
\(0\) \(3\)
\(1.3\) \(-4\)
\(7\) \(0\)
\(14\) \(1\)
Table 5.19.
\(x\) \(f(x+3)\)
\(-4\) \(2\)
\(-3\) \(3\)
\(-2.3\) \(-4\)
\(4\) \(0\)
\(11\) \(1\)

In this case, we were changing the inputs, rather than the outputs. This should make sense because in our formula, the \(+3\) is on the inside of the function. The other weird thing you might notice is that although we might expect adding \(3\) to make things bigger, it actually made our \(x\)-values smaller.

In \(f(x+3)\text{,}\) all of the inputs are decreased by \(3\text{.}\) Remember that on a graph, the inputs are represented by the \(x\)-values, so this would decrease all of the \(x\)-values by \(3\text{.}\) So, the graph of \(f(x+3)\) would be the same as the graph of \(f(x)\text{,}\) but moved right (in the negative \(x\)-direction) by \(3\text{.}\)

Definition 5.20. Horizontal Shifts.

The graph of \(f(x+a)\) is the same as the graph of \(f(x)\text{,}\) but:

  • if \(a \gt 0\text{,}\) the graph is moved left (in the negative \(x\)-direction)

  • if \(a \lt 0\text{,}\) the graph is moved right (in the positive \(x\)-direction)

We call this a horizontal shift, since "horizontal" means "side-to-side". Notice that the horizontal shifts go backwards from what we might expect.

See below for an animation of what this transformation does to a graph. If you want to see the animation in a larger window, click here 10 .

Example 5.21.

Below is the graph of \(h(x)\text{:}\)

We want to figure out which of the following is the graph of \(h(x-2)\text{.}\) In each, the gray dotted graph is the orignal graph of \(h(x)\) so you can more easily see how it changed.

Since we are looking for \(h(x-2)\text{,}\) we are looking for the graph to move in the positive \(x\)-direction (right) by 2, which is graph B. Graph A shifted down, which we learned in Section 5.1 would be \(h(x)-2\text{.}\) Graph C shifted in the negative \(x\)-direction (left) by 2, which would be \(f(x+2)\text{.}\) Graph D changed the shape of the graph by squishing it, which you'll learn about in Section 5.4.

Checkpoint 5.22.

The graph of \(p(x)\) is below:

Sketch the graph of each of the following:

  1. \(\displaystyle p(x-4)\)

  2. \(\displaystyle p(x+1)\)

Answer.
Solution.
  1. To draw \(p(x-4)\text{,}\) we see that we are shifting the whole graph in the positive \(x\)-direction (right) by 4. You may find it helpful to move the corner points first, then connect them together to get the whole graph. So, you would move the point \((-5,5)\) on the original graph over to \((-1,5)\text{.}\) Similarly, you would move the point \((-1,-3)\) on the original graph over to \((3,-3)\text{,}\) you would move the point \((0,-2)\) on the original graph over to \((4,-2)\text{,}\) and you would move the point \((2,-6)\) on the original graph over to \((6,-6)\text{.}\) From there, you can connect the lines to get the final graph, shown in blue below, where the gray dotted line is the orignal graph of \(p(x)\text{.}\)
  2. To draw \(p(x+1)\text{,}\) we see that we are shifting the whole graph in the negative \(x\)-direction (left) by 1. You may find it helpful to move the corner points first, then connect them together to get the whole graph. So, you would move the point \((-5,5)\) on the original graph over to \((-6,5)\text{.}\) Similarly, you would move the point \((-1,-3)\) on the original graph over to \((-2,-3)\text{,}\) you would move the point \((0,-2)\) on the original graph over to \((-1,-2)\text{,}\) and you would move the point \((2,-6)\) on the original graph over to \((1,-6)\text{.}\) From there, you can connect the lines to get the final graph, shown in blue below, where the gray dotted line is the orignal graph of \(p(x)\text{.}\)

Example 5.23.

Suppose the solid blue graph below is the graph of \(f(x)\) and the dotted red graph is the graph of \(g(x)\text{:}\)

We want to write a formula for \(g(x)\) in terms of \(f(x)\text{.}\) In other words, we start with \(f(x)\) and figure out how the graph changed to get to \(g(x)\text{,}\) then write how that changes the formula. Since the question asks for the formula "in terms of \(f(x)\)", that means we will write \(f(x)\) somewhere in our answer. Looking at the graph, we see that \(g(x)\) is the graph of \(f(x)\) shifted left (in the negative \(x\)-direction) by \(1\text{.}\) Therefore, that means we are adding \(1\) to the inside of the function \(f(x)\text{.}\) So, our final answer is \(g(x)=f(x+1)\text{.}\)

Checkpoint 5.24.

Suppose the solid blue graph below is the graph of \(f(x)\) and the dotted red graph is the graph of \(g(x)\text{:}\)

Write a formula for \(g(x)\) in terms of \(f(x)\text{.}\)

Answer.

\(g(x)=f(x-2)\)

Solution.

We want to write a formula for \(g(x)\) in terms of \(f(x)\text{.}\) In other words, we start with \(f(x)\) and figure out how the graph changed to get to \(g(x)\text{,}\) then write how that changes the formula. Since the question asks for the formula "in terms of \(f(x)\)", that means we will write \(f(x)\) somewhere in our answer. Looking at the graph, we see that \(g(x)\) is the graph of \(f(x)\) shifted right (in the positive \(x\)-direction) by \(2\text{.}\) Therefore, that means we are subtacting \(2\) from the inside of the function \(f(x)\text{.}\) So, our final answer is \(g(x)=f(x-2)\text{.}\)

Example 5.25.

Suppose \(f(x)=x^2+3x-4\) and \(g(x)\) is the same as \(f(x)\) but shifted left by \(7\text{.}\) Let's write a formula for \(g(x)\text{.}\) Since we have an explicit formula for \(f(x)\) in this case, we can write an explicit formula for \(g(x)\text{,}\) too. Since we are shifting left by \(7\text{,}\) that means we are adding \(7\) to the inside of the function. So,

\begin{equation*} g(x)=f(x+7) = (x+7)^2+3(x+7)-4 \end{equation*}

So our final answer is \(g(x)=(x+7)^2+3(x+7)-4\text{.}\)

Checkpoint 5.26.

Suppose \(f(x)=3x^3-2x+1\) and \(g(x)\) is the same as \(f(x)\) but shifted right by \(4\text{.}\) Write a formula for \(g(x)\text{.}\)

Answer.

\(g(x)=3(x-4)^3-2(x-4)+1\)

Solution.

Since we have an explicit formula for \(f(x)\) in this case, we can write an explicit formula for \(g(x)\text{,}\) too. Since we are shifting right by \(4\text{,}\) that means we are subtracting \(4\) from the inside of the function. So,

\begin{equation*} g(x)=f(x-4) = 3(x-4)^3-2(x-4)+1 \end{equation*}

So our final answer is \(g(x)=3(x-4)^3-2(x-4)+1\text{.}\)

Example 5.27.

Suppose \(f(x)=x^2-x+5\) and \(g(x)=(x-1)^2-(x-1)+5\text{.}\) Let's figure out what transformations took \(f(x)\) to \(g(x)\text{.}\) Comparing the two formulas, we see that in the formula for \(g(x)\text{,}\) all of the \(x\)'s turned into \((x-1)\text{.}\) That means that to get from \(f(x)\) to \(g(x)\text{,}\) we must have subtracted \(1\) from the inside so that \(g(x)=f(x-1)\text{.}\) That means there was a shift right by \(1\text{.}\)

Checkpoint 5.28.

Suppose \(f(x)=3x+2\) and \(g(x)=3(x+4)+2\text{.}\) What transformations took \(f(x)\) to \(g(x)\text{?}\)

Answer.

Shift left by \(4\text{.}\)

Solution.

Comparing the two formulas, we see that in the formula for \(g(x)\text{,}\) all of the \(x\)'s turned into \((x+4)\text{.}\) That means that to get from \(f(x)\) to \(g(x)\text{,}\) we must have added \(4\) to the inside so that \(g(x)=f(x+4)\text{.}\) That means there was a shift left by \(4\text{.}\)

https://www.desmos.com/calculator/0091evx11c