Vertical and Horizontal Shifts
Textbook Reference
| Primary source | OpenStax Calculus Volume 1, Section 1.3: “New Functions from Old Functions” |
| Direct link | https://openstax.org/books/calculus-volume-1/pages/1-3-the-basic-classes-of-functions |
| Supplementary | OpenStax Algebra and Trigonometry 2e, Section 3.5: “Graphing Functions Using Transformations” |
| Supplementary link | https://openstax.org/books/algebra-and-trigonometry-2e/pages/3-5-graphing-functions-using-transformations |
Both sources are free and openly licensed. OpenStax Calculus Volume 1 Section 1.3 treats shifting as the first class of transformation from an existing function.
Try This First
Below is a table of values for a function $f$.
| $x$ | $-2$ | $-1$ | $0$ | $1$ | $2$ |
|---|---|---|---|---|---|
| $f(x)$ | $3$ | $1$ | $0$ | $1$ | $3$ |
Before reading further, predict the following:
- Without computing anything, guess: where does the highest point of $f$ sit in a rough sketch?
- If the rule changes to $g(x) = f(x) + 2$, what do you expect the new table of values to look like? Write your guess.
- If the rule changes to $h(x) = f(x + 2)$, what do you expect the table to look like? Write your guess before computing.
Work through both predictions on paper, then build the tables to check.
Those two operations, adding a constant outside the function versus adding a constant inside the function, are the focus here. The difference between the two is more interesting than it first appears.
Key idea
A function is a process. When the rule says $f(x)$, the input $x$ goes in, the process runs, and an output comes out.
Adding a constant outside, as in $f(x) + c$, adjusts the output after the process finishes. Adding a constant inside, as in $f(x + c)$, adjusts the input before the process begins.
Those are two genuinely different things, and they move the graph in genuinely different directions. The surprise -- and the most common source of confusion in this topic -- is that adjusting the input moves the graph in the opposite direction from what many students expect.
There is no need to rush through this idea. Taking time to think about it carefully, and to predict before computing, is exactly what doing mathematics well looks like here.
Prerequisite Check
Before this lesson, make sure you can do all of the following:
If any of these is uncertain, review the function-notation skill first.
Quick Reference
Vertical shift by $c$ (c > 0).
| Transformation | Rule | Effect on graph |
|---|---|---|
| Shift up $c$ units | $g(x) = f(x) + c$ | Every point $(x, y)$ moves to $(x, y + c)$ |
| Shift down $c$ units | $g(x) = f(x) - c$ | Every point $(x, y)$ moves to $(x, y - c)$ |
Horizontal shift by $c$ (c > 0).
| Transformation | Rule | Effect on graph |
|---|---|---|
| Shift left $c$ units | $g(x) = f(x + c)$ | Every point $(x, y)$ moves to $(x - c, y)$ |
| Shift right $c$ units | $g(x) = f(x - c)$ | Every point $(x, y)$ moves to $(x + c, y)$ |
Memory device: Outside changes the output (vertical). Inside changes the input (horizontal, opposite direction).
Key Concepts
1. Vertical Shifts: Adding to the Output
When a constant $c$ is added to the output of a function, every output value increases by $c$. The graph moves up by $c$ units. When $c$ is negative, the graph moves down.
Why this is true: The rule $g(x) = f(x) + c$ means: take whatever output $f$ gives, then add $c$. Every point on the graph of $f$ has the form $(x, f(x))$. The corresponding point on the graph of $g$ is $(x, f(x) + c)$. The $x$-coordinate is unchanged; the $y$-coordinate is shifted by $c$. Since this holds for every point, the entire graph moves vertically.
Numerical representation. Let $f(x) = x^2$.
| $x$ | $f(x) = x^2$ | $g(x) = x^2 + 3$ | $h(x) = x^2 - 2$ |
|---|---|---|---|
| $-2$ | $4$ | $7$ | $2$ |
| $-1$ | $1$ | $4$ | $-1$ |
| $0$ | $0$ | $3$ | $-2$ |
| $1$ | $1$ | $4$ | $-1$ |
| $2$ | $4$ | $7$ | $2$ |
Every entry in the $g$ column is 3 more than the corresponding entry in the $f$ column. Every entry in the $h$ column is 2 less. The graph of $g$ is the graph of $f$ moved up 3 units; the graph of $h$ is moved down 2 units.
Translation prompt. Look at the table above. Can you describe in words -- without pointing at the formula -- how the graph of $g$ is related to the graph of $f$? Then switch: look at the graph description and write the formula that produces it. Practice going in both directions.
Graphical representation. The parabola $y = x^2$ has vertex $(0, 0)$. The parabola $y = x^2 + 3$ has vertex $(0, 3)$. The parabola $y = x^2 - 2$ has vertex $(0, -2)$. The shape of each parabola is identical; only the vertical position differs.
Ask why. If $f$ has a maximum value, does $g(x) = f(x) + c$ also have a maximum? Where is it? How does adding $c$ to every output change the maximum, minimum, and the $x$-values where they occur?
2. Horizontal Shifts: Adding to the Input
When a constant $c$ is added inside the argument of $f$, as in $g(x) = f(x + c)$, the graph shifts horizontally -- but in the direction opposite to the sign of $c$.
Why this is true. Consider a specific output value. Suppose $f$ achieves the value $y_0$ at $x = a$, so $f(a) = y_0$. For the transformed function $g(x) = f(x + c)$, the same output $y_0$ occurs when $x + c = a$, that is, when $x = a - c$. The point that was at $x = a$ has moved to $x = a - c$.
- If $c > 0$: $a - c < a$, so the point moved left. The graph shifts left.
- If $c < 0$: $a - c > a$, so the point moved right. The graph shifts right.
Numerical representation. Let $f(x) = x^2$ again.
| $x$ | $f(x) = x^2$ | $g(x) = f(x+2) = (x+2)^2$ | $h(x) = f(x-3) = (x-3)^2$ |
|---|---|---|---|
| $-3$ | $9$ | $1$ | $36$ |
| $-2$ | $4$ | $0$ | $25$ |
| $-1$ | $1$ | $1$ | $16$ |
| $0$ | $0$ | $4$ | $9$ |
| $1$ | $1$ | $9$ | $4$ |
| $2$ | $4$ | $16$ | $1$ |
| $3$ | $9$ | $25$ | $0$ |
The minimum of $f$ occurs at $x = 0$. The minimum of $g(x) = (x+2)^2$ occurs at $x = -2$: the vertex moved 2 units to the left. The minimum of $h(x) = (x-3)^2$ occurs at $x = 3$: the vertex moved 3 units to the right.
Translation prompt. From the table for $h$, locate the output value $0$. At what $x$ does it occur? Now locate the output value $0$ for $f$. At what $x$ does it occur? Write one sentence describing how the input that produced zero output changed. Then generalize: write one sentence describing where any output value $y_0$ of $f$ has moved in $h$.
Graphical representation. The vertex of $y = x^2$ is at $(0, 0)$. The vertex of $y = (x+2)^2$ is at $(-2, 0)$. The vertex of $y = (x-3)^2$ is at $(3, 0)$. The shape is identical in each case; only the horizontal position differs.
See It: Shift the Parabola
The dashed curve is $y = (x+2)^2 + 3$: the parent parabola shifted left and up. Turn the two knobs to slide your solid curve onto the dashed target. Watch which way the horizontal knob moves the graph.
3. Why the Horizontal Direction Is Counterintuitive
This is the heart of the lesson, and it is worth thinking through carefully.
When students see $g(x) = f(x + 2)$, many expect the graph to shift right, because “$x + 2$ is bigger than $x$.” That reasoning sounds plausible, but it is wrong. The graph shifts left.
The correct argument is in Section 2 above: the output value that $f$ achieved at $x = a$ is now achieved at $x = a - 2$, which is to the left of $a$. Every feature of the graph -- every peak, trough, crossing, and endpoint -- has moved 2 units to the left.
Another way to see it: $g(x) = f(x + 2)$ asks for the output that $f$ would give at the input $x + 2$. To get the same output that $f$ gives at $x = 5$, you need $x + 2 = 5$, so $x = 3$. The graph of $f$ at $x = 5$ corresponds to the graph of $g$ at $x = 3$. The feature moved left.
Predict-then-check. Before reading the next sentence: predict whether $y = f(x - 1)$ shifts the graph left or right by 1 unit. Write your prediction. Now apply the argument above to verify: to reproduce the output of $f$ at $x = 4$, you need $x - 1 = 4$, so $x = 5$. The feature moved right. Check against your prediction.
Named Misconception: input-output-confusion
The tempting reasoning. Students often reason as follows: “In $f(x + c)$, the input is $x + c$, which is larger than $x$. Larger input means the function is evaluated further to the right. So the graph shifts right.”
Why this breaks. Test it on $f(x) = x^2$ with $c = 2$. The vertex of $f$ is at $x = 0$, where $f(0) = 0$. For $g(x) = (x + 2)^2$, compute $g(-2) = (-2 + 2)^2 = 0$. The vertex is at $x = -2$, not at $x = 2$. The graph moved left, not right.
The repair. The shift direction is determined not by where the input is evaluated, but by where the same output reappears. The output value $f(0) = 0$ reappears in $g$ at $x = -2$, because $g(-2) = f(-2 + 2) = f(0) = 0$. To find where a feature of $f$ lands in $g(x) = f(x + c)$, solve $x + c = a$ for $x$. The answer is $x = a - c$, which is $c$ units to the left when $c > 0$.
A different framing. Think of it this way: $g(x) = f(x + 2)$ means the function $g$ gets its value from a position 2 units ahead of where $x$ is. So $g$ is “running ahead” by 2 units -- which means the graph of $g$ appears 2 units behind (to the left of) the graph of $f$.
Worked Examples
Worked Example 1: Identifying the Shift from a Formula
Problem. Let $f(x) = \sqrt{x}$. Describe the graph of each of the following without computing any outputs:
(a) $g(x) = \sqrt{x} + 5$ (b) $h(x) = \sqrt{x} - 3$ (c) $p(x) = \sqrt{x + 4}$ (d) $q(x) = \sqrt{x - 7}$
Predict first. Before working through the algebra, write down whether each graph moves up, down, left, or right, and by how many units. The graph of $f(x) = \sqrt{x}$ starts at $(0, 0)$ and increases to the right.
Solution.
(a) $g(x) = \sqrt{x} + 5 = f(x) + 5$. Adding 5 to the output. Vertical shift up 5 units. Starting point moves from $(0, 0)$ to $(0, 5)$.
(b) $h(x) = \sqrt{x} - 3 = f(x) - 3$. Subtracting 3 from the output. Vertical shift down 3 units. Starting point moves from $(0, 0)$ to $(0, -3)$.
(c) $p(x) = \sqrt{x + 4} = f(x + 4)$. Adding 4 inside the argument. Horizontal shift left 4 units. Starting point moves from $(0, 0)$ to $(-4, 0)$. (The domain is now $x \geq -4$, since we need $x + 4 \geq 0$.)
(d) $q(x) = \sqrt{x - 7} = f(x - 7)$. Subtracting 7 inside the argument. Horizontal shift right 7 units. Starting point moves from $(0, 0)$ to $(7, 0)$. (The domain is now $x \geq 7$.)
Check on (c). Compute $p(-4) = \sqrt{-4 + 4} = \sqrt{0} = 0$. The starting point is indeed $(-4, 0)$. Compute $p(-3) = \sqrt{-3 + 4} = \sqrt{1} = 1$. Compare: $f(1) = \sqrt{1} = 1$. The output value $1$ occurs at $x = 1$ in $f$ and at $x = -3$ in $p$. It moved left by 4 units. Consistent.
Worked Example 2: Writing the Formula from the Graph
Problem. The graph of $y = f(x)$ passes through $(1, 2)$, $(3, 5)$, and $(6, 1)$.
(a) A transformed graph $g$ passes through $(1, 7)$, $(3, 10)$, and $(6, 6)$. What is $g$ in terms of $f$?
(b) A transformed graph $h$ passes through $(-1, 2)$, $(1, 5)$, and $(4, 1)$. What is $h$ in terms of $f$?
Predict first. For (a): the $y$-coordinates all increased by 5 and the $x$-coordinates did not change. For (b): the $y$-coordinates are unchanged and the $x$-coordinates all decreased by 2.
Solution.
(a) Every output value increased by 5, with inputs unchanged. This is a vertical shift up 5. So $g(x) = f(x) + 5$.
Check: $g(1) = f(1) + 5 = 2 + 5 = 7$. $g(3) = f(3) + 5 = 5 + 5 = 10$. $g(6) = f(6) + 5 = 1 + 6$... wait: $g(6) = f(6) + 5 = 1 + 5 = 6$. All three points match.
(b) Every output value stayed the same, but the $x$-coordinate decreased by 2. The output of $h$ at $x$ equals the output of $f$ at $x + 2$. So $h(x) = f(x + 2)$.
Check: $h(-1) = f(-1 + 2) = f(1) = 2$. $h(1) = f(1 + 2) = f(3) = 5$. $h(4) = f(4 + 2) = f(6) = 1$. All three points match.
Worked Example 3: Both Shifts Together
Problem. The graph of $f$ has a minimum at $(2, -3)$. Find the minimum of $g(x) = f(x - 5) + 4$.
Predict first. The $-5$ inside the argument will shift the graph horizontally. The $+4$ outside will shift it vertically. Write down where you predict the minimum will land before computing.
Solution.
The minimum of $f$ is at the point $(2, -3)$.
Horizontal shift: $x - 5$ inside means the graph shifts right 5 units. The $x$-coordinate of the minimum moves from $2$ to $2 + 5 = 7$.
Vertical shift: $+4$ outside means the graph shifts up 4 units. The $y$-coordinate of the minimum moves from $-3$ to $-3 + 4 = 1$.
The minimum of $g$ is at $(7, 1)$.
Check by direct substitution. Compute $g(7) = f(7 - 5) + 4 = f(2) + 4 = -3 + 4 = 1$. Correct.
Common Errors
| Error | Example | Correction |
|---|---|---|
| Shifting horizontal in wrong direction | $f(x+3)$ shifts right by 3 | $f(x+3)$ shifts left by 3; solve $x+3=a$ to get $x=a-3$ |
| Treating $f(x)+c$ as a horizontal shift | $f(x)+3$ shifts right by 3 | $f(x)+c$ is outside the function; it shifts vertically |
| Incorrect domain after horizontal shift | Keeping domain $x \geq 0$ for $\sqrt{x+4}$ | Solve $x+4 \geq 0$; new domain is $x \geq -4$ |
| Moving the wrong coordinate | $f(x)+5$ moves $x$-coordinates up by 5 | Adding to output moves $y$-coordinates; $x$-coordinates unchanged |
| Sign error on shift amount | Seeing $f(x-3)$ and saying shift left 3 | Shift right 3; the minus sign inside means right |
Common Misconceptions
$f(x + c)$ shifts the graph to the right because $x + c$ is larger than $x$.
This is the input-output-confusion error. The reasoning treats the input value $x + c$ as the new position of the graph, but it is the position of the output that matters. For $g(x) = (x + 2)^2$, the vertex of $f(x) = x^2$ is at $x = 0$ where $f(0) = 0$. Setting $x + 2 = 0$ gives $x = -2$, so $g(-2) = 0$: the vertex moved to $x = -2$, which is 2 units to the left. The graph of $g(x) = f(x + c)$ shifts left by $c$ units when $c > 0$, not right.
Leveled Practice
Level 1: Direct Application
Problem 1. The function $f$ has graph passing through $(0, 1)$, $(1, 3)$, $(2, 7)$. Write the output table for each transformation and state the shift.
(a) $g(x) = f(x) + 4$ (b) $h(x) = f(x) - 2$ (c) $p(x) = f(x + 1)$ (d) $q(x) = f(x - 3)$
Show answer
(a) $g(x) = f(x) + 4$: outputs become $5, 7, 11$; inputs unchanged. Vertical shift up 4 units.
(b) $h(x) = f(x) - 2$: outputs become $-1, 1, 5$; inputs unchanged. Vertical shift down 2 units.
(c) $p(x) = f(x+1)$: $p(x)$ at input $x$ equals $f(x+1)$. So $p(-1) = f(0) = 1$, $p(0) = f(1) = 3$, $p(1) = f(2) = 7$. The points $(-1,1)$, $(0,3)$, $(1,7)$ form the new graph. Horizontal shift left 1 unit.
(d) $q(x) = f(x-3)$: $q(3) = f(0) = 1$, $q(4) = f(1) = 3$, $q(5) = f(2) = 7$. Points $(3,1)$, $(4,3)$, $(5,7)$. Horizontal shift right 3 units.
Problem 2. For $f(x) = |x|$, identify the vertex of each transformed graph and state whether it is a vertical or horizontal shift.
(a) $y = |x| + 6$ (b) $y = |x| - 4$ (c) $y = |x + 3|$ (d) $y = |x - 5|$
Show answer
(a) Vertex $(0, 6)$; vertical shift up 6. (b) Vertex $(0, -4)$; vertical shift down 4. (c) Vertex $(-3, 0)$; horizontal shift left 3. (d) Vertex $(5, 0)$; horizontal shift right 5.
Level 2: Translating Between Representations
Problem 3. The graph below is described by these key points: minimum at $(2, 0)$, passes through $(0, 4)$ and $(4, 4)$, and has the shape of a parabola opening upward.
(a) Write a formula for a function $f$ that has this graph.
(b) Write a formula for the graph shifted left 2 units and down 1 unit.
(c) Find the minimum of the transformed graph in part (b).
Show answer
(a) A parabola opening upward with vertex $(2, 0)$ is $f(x) = (x-2)^2$.
Check: $f(2) = 0$. $f(0) = (-2)^2 = 4$. $f(4) = (2)^2 = 4$. All correct.
(b) Shift left 2: replace $x$ with $x+2$ inside, giving $(x+2-2)^2 = x^2$. Shift down 1: subtract 1 outside. Result: $g(x) = x^2 - 1$.
Alternatively, using transformation notation: $g(x) = f(x+2) - 1 = ((x+2)-2)^2 - 1 = x^2 - 1$.
(c) The minimum of $g(x) = x^2 - 1$ is at $x = 0$, giving $g(0) = -1$. Minimum at $(0, -1)$.
Check: the minimum of $f$ was at $(2, 0)$. Shifting left 2 gives $x$-coordinate $2 - 2 = 0$. Shifting down 1 gives $y$-coordinate $0 - 1 = -1$. Consistent.
Problem 4. Without graphing, determine whether the statement is true or false, and explain why in one sentence.
“The graph of $y = (x+4)^2 - 7$ is obtained by moving the graph of $y = x^2$ four units to the right and seven units down.”
Show answer
False. The $+4$ inside the argument shifts the graph left 4 units (not right). The graph of $y = (x+4)^2 - 7$ is obtained by moving $y = x^2$ four units to the left and seven units down, giving vertex $(-4, -7)$.
Verification: $(x+4)^2 - 7 = 0$ at $x+4 = \pm\sqrt{7}$, so $x = -4 \pm \sqrt{7}$. The vertex is at $x = -4$, confirming leftward shift.
Level 3: Extension and Justification
Problem 5. A function $f$ is defined on $[-3, 3]$ with maximum value $M$ occurring at $x = 1$.
(a) On what interval is $g(x) = f(x+2)$ defined?
(b) Where does $g$ achieve its maximum, and what is the maximum value?
(c) On what interval is $h(x) = f(x) + 5$ defined?
(d) Where does $h$ achieve its maximum, and what is the maximum value?
Show answer
(a) $g(x) = f(x+2)$ requires $x+2$ to be in $[-3, 3]$, so $-3 \leq x+2 \leq 3$, giving $-5 \leq x \leq 1$. Domain: $[-5, 1]$.
(b) $g$ achieves the maximum of $f$ when $x+2 = 1$, i.e., $x = -1$. The maximum value is still $M$ (shifting horizontally does not change output values, only where they occur). Maximum of $g$ is $M$ at $x = -1$.
(c) $h(x) = f(x) + 5$ is defined on the same domain as $f$: $[-3, 3]$.
(d) $h$ achieves its maximum when $f$ achieves its maximum, at $x = 1$. The maximum value is $M + 5$. Maximum of $h$ is $M + 5$ at $x = 1$.
Problem 6 (LFHC Extension). Prove the horizontal shift direction using the definition of a function.
Let $f$ be any function and let $g(x) = f(x + c)$ for a positive constant $c$.
(a) Suppose the graph of $f$ passes through the point $(a, b)$, meaning $f(a) = b$. Show algebraically that the graph of $g$ passes through the point $(a - c, b)$.
(b) Explain in one sentence why this proves the graph shifts left by $c$ units when $c > 0$.
(c) By replacing $c$ with $-c$ in your argument, prove that $g(x) = f(x - c)$ shifts the graph right by $c$ units.
Show answer
(a) We need to find the $x$-value where $g$ has output $b$. Since $g(x) = f(x+c)$, we need $f(x+c) = b$. We are told $f(a) = b$, so $x + c = a$, giving $x = a - c$. Therefore $g(a-c) = f((a-c)+c) = f(a) = b$. The graph of $g$ passes through $(a-c, b)$.
(b) Every point $(a, b)$ on the graph of $f$ corresponds to the point $(a-c, b)$ on the graph of $g$, and $a - c < a$ when $c > 0$, so every feature of the graph has moved $c$ units to the left.
(c) Replace $c$ with $-c$ in part (a): $g(x) = f(x+(-c)) = f(x-c)$. The point $(a, b)$ on $f$ maps to $(a - (-c), b) = (a+c, b)$ on $g$. Since $a + c > a$ when $c > 0$, every feature has moved $c$ units to the right.
Mastery Checklist
You have mastered this skill when you can do all of the following without referring to notes:
Mental Model
Think of the graph of $f$ as a physical object -- a wire bent into the shape of the curve.
A vertical shift picks up the wire and moves it straight up or down. Every point rises or falls by the same amount. This happens because you are adding to the output, the final result of the process.
A horizontal shift slides the wire left or right. Every point moves by the same horizontal amount. This happens because you are adjusting the input, the starting value fed into the process.
The key to horizontal shifts: the graph moves in the direction opposite to the sign inside the argument. To see why, ask: “What input to $g$ produces the same output as $x = a$ in $f$?” For $g(x) = f(x+c)$, you need $x + c = a$, so $x = a - c$. The feature moved left if $c > 0$.
A useful check: locate a specific output value (such as the minimum or a zero) in both $f$ and the transformed version. Confirm that it moved in the direction you predicted.
Connections
Within MATH161
- Reflections and Stretches (this section): Shifts are additive transformations; the next skill covers multiplicative transformations. The two types combine in the standard form $y = Af(B(x-h)) + k$.
- Combining Transformations: When shifts and stretches appear together, the order of operations matters. Studying shifts in isolation first gives the foundation.
- Domain and range: A horizontal shift changes the domain (the set of valid inputs). A vertical shift changes the range (the set of possible outputs). Both in predictable ways.
Toward Later MATH161
- Even and odd functions: A function is even if $f(-x) = f(x)$ (symmetric about the $y$-axis). Recognizing this is related to the effect of replacing $x$ with $-x$, which is the next skill.
- Trigonometric functions: Phase shifts in $\sin(x + \phi)$ and $\cos(x + \phi)$ are horizontal shifts. Understanding now prevents confusion about “phase shift direction” later.
- Derivatives: When $g(x) = f(x - h)$, the derivative $g'(x) = f'(x - h)$. A horizontal shift of the function produces the same horizontal shift in the derivative. This is a clean, useful fact.
Audience Notes
For students who find the horizontal direction confusing: This is one of the most reliably confusing ideas in precalculus, and every calculus section deals with it. The confusion is not a sign that something is wrong -- it is a sign that you are thinking carefully. Work through the predict-then-check in Section 3 one more time with a different function (try $f(x) = |x|$) until the argument makes sense in your own words.
For students who want a deeper understanding: The shift $g(x) = f(x - h)$ is a composition: $g = f \circ T_h$, where $T_h(x) = x - h$ is the translation-by-$h$ function. The graph of $g$ is the preimage of the graph of $f$ under $T_h$. This is the language of transformations in linear algebra and topology.
For students interested in applications: In signal processing, a time delay in a signal $s(t)$ is written as $s(t - \tau)$, where $\tau > 0$ is the delay in seconds. The formula says: the delayed signal at time $t$ is whatever the original signal was doing $\tau$ seconds earlier. This is exactly a rightward shift on the time axis.
Back to Ch. 1 Sec. 3 Skills | Next: Reflections and Stretches