Sub topic 2
Two Ways to Change a Function: The Output and the Input
Prerequisites and the central idea
Assume you can evaluate a function, plot points, and identify the domain and range of basic functions. You should also know that \(f(x)\) means the output of function \(f\) when the input is \(x\).
A graph can change in two main ways:
- Change the output: modify the value produced by the function.
- Change the input: modify the value sent into the function.
These changes look similar in notation, but they affect the graph differently.
Changing the output
Consider
\[ g(x)=f(x)+k. \]
The input \(x\) stays the same. The output increases by \(k\).
- If \(k>0\), the graph moves up \(k\) units.
- If \(k<0\), the graph moves down \(|k|\) units.
For example, let \(f(x)=x^2\). Then
\[ g(x)=x^2+3 \]
moves the graph of \(y=x^2\) up three units. The point \((2,4)\) becomes \((2,7)\). The \(x\)-coordinate does not change.
The same idea works for multiplying the output:
\[ g(x)=a f(x). \]
Every \(y\)-value is multiplied by \(a\).
- If \(|a|>1\), the graph stretches vertically.
- If \(0<|a|<1\), the graph compresses vertically.
- If \(a<0\), the graph also reflects across the \(x\)-axis.
The output changes directly, so the vertical position changes directly.
Changing the input
Now consider
\[ g(x)=f(x-h). \]
The expression inside \(f\) changes. The graph moves horizontally, but the sign works opposite to the usual first impression:
- \(f(x-h)\) moves the graph right \(h\) units.
- \(f(x+h)\) moves the graph left \(h\) units.
For \(g(x)=f(x-3)\), the input must be \(3\) before the original function receives \(x\). To get the old input \(u\), solve \(x-3=u\), which gives \(x=u+3\). Thus every point moves right three units.
This is why the sign seems reversed. The graph location is determined by solving for the new input, not by reading the expression as an ordinary coordinate.
A horizontal scale also acts inside the function:
\[ g(x)=f(bx). \]
A point with original input \(u\) appears at the new input \(x=u/b\).
- If \(|b|>1\), the graph compresses horizontally.
- If \(0<|b|<1\), the graph stretches horizontally.
- If \(b<0\), the graph reflects across the \(y\)-axis as well.
| Expression | Main effect | Point change |
|---|---|---|
| \(a f(x)+k\) | Vertical scale and shift | \((x,y)\to(x,ay+k)\) |
| \(f(b(x-h))\) | Horizontal scale and shift | \((x,y)\to(x/b+h,y)\) |
Seeing both changes together
The general form
\[ g(x)=a f(b(x-h))+k \]
combines input and output changes. The input changes happen inside \(f\). The output changes happen outside \(f\).
For an original point \((u,v)\), where \(v=f(u)\), the transformed point is
\[ (u,v)\longrightarrow\left(\frac{u}{b}+h,\;av+k\right). \]
This rule separates the horizontal and vertical effects. First identify the old input and output. Then transform each coordinate using the matching part of the formula.
def transform(f, a=1, b=1, h=0, k=0):
"""Return g(x) = a * f(b * (x - h)) + k."""
return lambda x: a * f(b * (x - h)) + k
f = lambda x: x ** 2
g = transform(f, a=-2, b=1, h=3, k=1)
print(g(3)) # 1
print(g(4)) # -1Exercise
The graph of f contains the point (4, -2). What point appears on g(x) = 3f(x - 5) + 1?
Show answer
Use h = 5, a = 3, and b = 1. The point maps to (4 + 5, 3(-2) + 1) = (9, -5).