Sub topic 2
Stretching and compressing vertically
This chapter assumes you can evaluate f(x), plot points, recognize the graphs of x², |x|, and x³, and find domain and range. We start with a parent function f(x) and change its outputs or its inputs.
Vertical stretches and compressions
Multiplying the output by a constant a gives g(x) = a·f(x). Each y-value of the parent graph is multiplied by a. The graph stretches away from the x-axis when |a| > 1 and compresses toward the x-axis when 0 < |a| < 1. The x-values do not change.
If (2, 4) lies on f(x) = x², then (2, 12) lies on g(x) = 3x². The y-value triples, and x stays 2.
Horizontal stretches and compressions
Multiplying the input by b gives g(x) = f(bx). Each point (x, y) on the parent moves to (x/b, y).
The sign rule runs opposite to intuition. With b = 2, the graph compresses toward the y-axis. Check: f(2x) = (2x)² = 4x², and the point (1, 1) on f moves to (0.5, 1) on g because g(0.5) = f(1) = 1.
Reflections across the axes
The expression −f(x) reflects the graph across the x-axis, because every y-value changes sign. The expression f(−x) reflects the graph across the y-axis, because every x-value changes sign.
def transform(f, a=1, b=1):
"""Return g(x) = a * f(b * x)."""
return lambda x: a * f(b * x)
f = lambda x: x ** 2
vertical = transform(f, a=3)
horizontal = transform(f, b=2)
reflected = transform(lambda x: x ** 3, a=-1)
print(vertical(2)) # 12
print(horizontal(1)) # 4
print(reflected(2)) # -8Exercise
Let f(x) = x². For g(x) = f(x/2), what is g(4)?
Show answer
g(4) = f(4/2) = f(2) = 4. Here b = 1/2, so the graph stretches horizontally, away from the y-axis.