Sub topic 3
Moving a Graph Up and Down
Prerequisites and the basic rule
Assume you can evaluate function notation, plot points, and identify the domain and range of a basic function. A vertical shift moves every point of a graph up or down by the same distance.
Start with a function \(f\). Define a new function
\[ g(x)=f(x)+k. \]
The number \(k\) changes the output, or \(y\)-value. The input \(x\) stays the same.
- If \(k>0\), the graph moves up \(k\) units.
- If \(k<0\), the graph moves down \(|k|\) units.
- If \(k=0\), the graph does not move.
For example, if \(f(x)=x^2\), then
\[ g(x)=x^2+3 \]
is the graph of \(y=x^2\) shifted up 3 units. Its vertex moves from \((0,0)\) to \((0,3)\).
Why the output changes
Suppose \((x,y)\) lies on \(f\). This means \(y=f(x)\). For the new function,
\[ g(x)=f(x)+k=y+k. \]
Therefore, the point moves according to
\[ (x,y)\longrightarrow (x,y+k). \]
The \(x\)-coordinate does not change because the input has not changed. Only the output is increased or decreased.
Here are some common examples:
| Function | Value of \(k\) | Movement |
|---|---|---|
| \(g(x)=f(x)+5\) | \(5\) | Up 5 units |
| \(g(x)=f(x)-2\) | \(-2\) | Down 2 units |
| \(g(x)=f(x)\) | \(0\) | No movement |
Domain, range, and key points
A vertical shift does not change the domain. Every allowed input remains allowed.
The range changes by adding \(k\) to every output. If the range of \(f\) is \([m,\infty)\), then the range of \(g(x)=f(x)+k\) is
\[ [m+k,\infty). \]
For \(f(x)=x^2\), the domain is all real numbers and the range is \([0,\infty)\). For \(g(x)=x^2-4\), the domain is still all real numbers, but the range becomes \([-4,\infty)\).
You can verify a vertical shift by transforming several points. If \(f\) contains \((-1,1)\), \((0,0)\), and \((1,1)\), then \(g(x)=f(x)+2\) contains \((-1,3)\), \((0,2)\), and \((1,3)\).
Testing a shift with Python
The following program applies a vertical shift to a function and evaluates corresponding points.
def vertical_shift(f, k):
"""Return g(x) = f(x) + k."""
return lambda x: f(x) + k
f = lambda x: x ** 2
g = vertical_shift(f, 3)
for x in [-1, 0, 1]:
print((x, f(x)), "becomes", (x, g(x)))The output points are \((-1,4)\), \((0,3)\), and \((1,4)\). Their \(x\)-coordinates stay fixed, while each \(y\)-coordinate increases by 3.
Exercise
The graph of f has a minimum point at (2, -1). What is the minimum point of g(x) = f(x) - 6, and how does the range change?
Show answer
The point becomes (2, -7). The graph moves down 6 units, so every range value decreases by 6.