Use this free function transformations visualizer to see exactly how the constants in g(x)=af(b(x−h))+k stretch, reflect and slide a parent graph. Pick a parent function, drag four sliders, and compare the transformed curve with the original on the same grid.
Controls
parentabhk
How to use the simulator
The parent f(x) is drawn as a dashed teal curve and g(x) as a solid coral curve, on a grid from −10 to 10 on both axes.
Parent f(x) menu: choose x2, ∣x∣, x, x3, sin(x) or 1/x. The default is x2.
vertical stretch a: from −3 to 3 in steps of 0.1 (default 1). A negative value reflects the graph over the x-axis.
horizontal stretch b: from −3 to 3 in steps of 0.1 (default 1). A negative value reflects the graph over the y-axis.
horizontal shift h and vertical shift k: each from −6 to 6 in steps of 0.5 (default 0).
Reset to parent: puts a and b back to 1 and h and k back to 0. It keeps the parent you picked.
The panel above the sliders writes the current equation in terms of f, for example g(x) = −2·f(x − 3) + 1, and lists each transformation as a tag, such as "reflect over x-axis" or "shift right 3". For the horizontal factor, the tag reports 1/∣b∣, the actual factor by which horizontal distances change, so b = 2 is labeled a compression by 0.5.
Move one slider at a time first, then combine them and predict where a key point, such as the vertex of x2, will land before you let go. Avoid b = 0: the slider allows it, but then g is constant and the graph collapses to a horizontal line.
The formula
Every transformation in AP Precalculus Topic 1.12 is a piece of g(x)=af(b(x−h))+k. Constants outside f act on outputs (vertical changes). Constants inside f act on inputs (horizontal changes), and they act in the opposite way to what the symbol suggests.
k: vertical translation. g(x)=f(x)+k moves every point up k units (down if k < 0).
h: horizontal translation. g(x)=f(x−h) moves every point right h units. So f(x+4) has h=−4 and moves left 4.
a: vertical dilation by a factor of ∣a∣; if a<0, also a reflection over the x-axis.
b: horizontal dilation by a factor of 1/∣b∣; if b<0, also a reflection over the y-axis.
A clean way to track all four at once is the point mapping (x,y)⟼(bx+h,ay+k). Apply it to two or three easy points on the parent graph and you have the transformed graph.
Worked example
Describe and sketch g(x)=−2x−3+1.
Step 1: match the template. With f(x)=x: a=−2, b=1, h=3, k=1.
Step 2: name the transformations. Reflect over the x-axis, stretch vertically by a factor of 2, shift right 3, shift up 1.
Step 3: map key points. Using (x,y)↦(x+3,−2y+1): (0,0)→(3,1), (1,1)→(4,−1), (4,2)→(7,−3).
Step 4: domain and range. The parent has domain x≥0 and range y≥0. After the shift right the domain is x≥3; after the reflection, stretch and shift up the range is y≤1.
Check it in the simulator: choose √x, set a = −2, h = 3 and k = 1. The equation reads g(x) = −2·f(x − 3) + 1, and the tags read reflect over x-axis, vertical stretch ×2, shift right 3, shift up 1. The coral curve should begin at (3, 1) and pass through (4, −1) and (7, −3).
Follow-up with b. Write g(x)=(2x−2)2 in the template. Factor the inside first: 2x−2=2(x−1), so b=2 and h=1, not 2. Choose x², set b = 2 and h = 1: the label reads g(x) = f(2(x − 1)), the tags say horizontal compression ×0.5 and shift right 1, and the vertex sits at (1, 0).
Common mistakes on the AP exam
Shifting the wrong way.f(x−3) moves right, f(x+3) moves left. Use the slider: positive h always moves the coral graph right.
Not factoring out b. In f(2x+6) the shift is −3, because 2x+6=2(x+3). Reading it as a shift of 6 is the most common horizontal error.
Inverting the horizontal factor the wrong way.f(3x) compresses horizontally by a factor of 31; it does not stretch by 3.
Mixing up the reflections. A negative a flips over the x-axis; a negative b flips over the y-axis. For an even function like x2, a negative b makes no visible difference.
Forgetting the domain. Shifting x or 1/x moves the endpoint or the asymptotes too. For 1/(x−2)+3 the asymptotes are x=2 and y=3.
When the AP exam uses this
Transformations recur throughout the course: Unit 3 sinusoids build amplitude, period, phase shift and midline from these four constants, and exponential and logarithmic models in Unit 2 are often written as transformations of bx or logbx. Questions may give a table of values for f and ask for values of g, or show two graphs and ask which transformation links them.
Embed this simulator on your class page
Free for classroom use. Paste this into your site, LMS page or blog; keep the credit link under it.
Sitting a paper sets one essential cookie so your attempt stays yours (paying or signing in sets the ones those need). Nothing identifying is set unless you accept: advertising cookies only help us measure our adverts, and the site works either way.
Sitting a paper sets one essential cookie so your attempt stays yours. Nothing identifying is set unless you accept; advertising cookies only measure our adverts.