Skip to content
ihateDesmos

Graph transformations

8 min read · Updated 20 October 2026

Change a function’s formula in a few standard ways and its graph moves in predictable ones. Everything fits in a single template, y = a f(b(x − h)) + k, where each letter does exactly one job.

The template

y=af(b(x−h))+k

ChangeEffect on the graph
+ k outsideShift up by k (down if k is negative)
x − h insideShift right by h (left if h is negative)
a outsideVertical stretch by |a|; reflect in the x-axis if a < 0
b insideHorizontal compression by |b|; reflect in the y-axis if b < 0

The rule of thumb: changes outside the function act on y and do what they look like. Changes inside act on x and do the opposite of what they look like, because they change the input before the function sees it.

Shifts (translations)

Adding k to the output lifts every point by k. Replacing x with x − h moves every point right by h. To see why the inside shift is “backwards”, notice that f(x − 2) takes at x = 2 the value f took at x = 0: the whole graph has moved 2 to the right.

−4−2246−4−2240
Open in calculator
|x| in grey, shifted right 3 (blue) and up 2 (red).

Stretches and compressions

Multiplying the output by a stretches the graph vertically: every y-value is multiplied by a, and the x-intercepts stay put. Multiplying the input by b squeezes it horizontally by a factor of b: sin(2x) fits two waves where sin x fits one, and the y-intercept stays put. A factor between 0 and 1 does the opposite: y = ½ f(x) is flatter, f(x/2) is wider.

−6−4−2246−4−2240
Open in calculator
sin x in grey, stretched vertically by 2 (blue) and compressed horizontally by 2 (red).

Reflections

A minus sign outside, −f(x), reflects the graph in the x-axis: every y changes sign. A minus sign inside, f(−x), reflects it in the y-axis. Even functions such as x² and cos x are unchanged by f(−x); odd functions such as x³ and sin x give the same result for both reflections.

−6−4−2246−4−2240
Open in calculator
√x in grey, reflected in the x-axis (blue) and in the y-axis (red).

Combining them: the order matters

For y = a f(b(x − h)) + k, apply the transformations to the parent in this order: horizontal compression and reflection (b), horizontal shift (h), vertical stretch and reflection (a), then vertical shift (k).

Example: y = −2(x + 1)² + 3 starts from x², shifts left 1, stretches vertically by 2 and flips (−2), then shifts up 3. The vertex goes (0, 0) → (−1, 0) → (−1, 0) → (−1, 3), and the parabola opens downward.

The horizontal shift must be read after factoring b out. y = f(2x − 6) is f(2(x − 3)), a shift of 3, not 6.

−4−224−220
Open in calculator
x² transformed to
y=−2(x+1)2+3
: vertex (−1, 3), opening down.

Practice

A new problem every time. Answer in any form you like: fractions, decimals, √ and π all work, and equivalent equations count as right.

Problem 1

Start with y = x³. Move it 5 right and 3 up. Write the new equation.

Show the answer

Answer: y = (x − 5)³ + 3

  1. Moving right by 5 replaces x with x − 5. The sign is the opposite of the direction.
  2. Moving up by 3 adds 3 outside the function.
  3. So y = (x − 5)³ + 3.
Open in the calculator

Frequently asked questions

What does f(x − h) do to a graph?
It shifts the graph right by h units (left if h is negative).
What is the difference between f(2x) and 2f(x)?
2f(x) stretches the graph vertically by a factor of 2. f(2x) compresses it horizontally by a factor of 2.
How do I reflect a graph in the x-axis?
Put a minus sign in front of the function: y = −f(x).
In what order should I apply transformations?
Horizontal stretch or reflection, then horizontal shift, then vertical stretch or reflection, then vertical shift. Factor b out of the inside first so the shift is read correctly.

Keep going

Try it in the calculator

Every figure on this page opens in ihateDesmos, where you can drag sliders and watch the graph respond.

Open the calculator