Skip to content
Tutorials Center
My learning

Topics

Lesson 8 of 37 · Function Analysis

Transformations of Graphs

Shift, stretch, compress and reflect graphs using a clear order of operations, and see each transformation drawn with runnable Python plots.

You do not need to learn every graph from scratch. A handful of basic "parent" functions, combined with a few transformations, produce a huge family of curves. If you know that y = x² is a parabola, you can sketch y = -2(x - 3)² + 1 in seconds. This lesson explains each transformation and the order in which to apply them.

The parent functions

Memorize the shapes of these building blocks: x, x², x³, √x, |x|, 1/x, 2^x. A transformation changes a parent graph without changing its basic character.

The basic moves

Start with y = f(x).

Equation Effect on the graph
y = f(x) + k shift up k (down if k < 0)
y = f(x - h) shift right h (left if h < 0)
y = a·f(x), a > 1 vertical stretch by factor a
y = f(bx), b > 1 horizontal compression by factor 1/b
y = -f(x) reflect in the x-axis
y = f(-x) reflect in the y-axis

Two things catch learners out.

  1. Changes inside the brackets act "backwards". f(x - 3) moves the graph right, because the input must be 3 larger to produce the old output. f(x + 2) moves it left.
  2. Changes inside affect x; changes outside affect y. Outside changes do what they look like. Inside changes work on x and do the opposite for shifts, and the reciprocal for scaling.

Check with a point. If (2, 5) is on y = f(x), then (2 + 3, 5) = (5, 5) is on y = f(x - 3), and (2, 5 + 4) = (2, 9) is on y = f(x) + 4.

Python Shifts: the same parabola moved around

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Stretches, compressions and reflections

  • y = 2f(x) doubles every height: a vertical stretch by 2. y = ½f(x) squashes it.
  • y = f(2x) makes the graph twice as narrow: a horizontal compression by 2. y = f(x/2) stretches it horizontally by 2.
  • y = -f(x) flips the graph upside down. y = f(-x) flips it left to right.

For a function with symmetry the flips can look identical: reflecting x² in the y-axis changes nothing, because x² is even.

Python Stretch and reflect |x|

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that 2|x| and |2x| coincide, since |2x| = 2|x|. For most functions the vertical stretch and horizontal compression are different curves.

Combining transformations

For y = a·f(b(x - h)) + k, apply the changes in this order:

  1. Horizontal work first: scale by b (and reflect if b < 0), then shift right by h.
  2. Vertical work next: stretch by a (and reflect if a < 0), then shift up by k.

Example: sketch y = -2(x - 3)² + 1. Start with x², shift right 3, stretch vertically by 2, reflect in the x-axis, shift up 1. The vertex moves from (0, 0) to (3, 1) and the parabola opens downward.

A safe way to apply the changes to individual points: track the vertex or any key point (x, y). Under a·f(b(x - h)) + k it maps to (x/b + h, a·y + k).

flowchart LR
A["Parent<br/>f(x)"] --> B["Scale x by b<br/>f(bx)"]
B --> C["Shift right h<br/>f(b(x-h))"]
C --> D["Stretch y by a<br/>a·f(...)"]
D --> E["Shift up k<br/>result"]

Apply horizontal changes first, then vertical changes.

Python Transform key points automatically

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A horizontal change f(bx) divides the x-coordinates by b, which is why the point formula above uses x / b.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. How does y = f(x + 5) compare with y = f(x)?

    Changes inside the brackets work backwards: adding 5 to the input shifts the graph left by 5.
  2. 2. Where is the vertex of y = -2(x - 3)² + 1?

    The parent vertex (0, 0) moves right 3 and up 1; the -2 stretches and flips but leaves the vertex in place.
  3. 3. Which transformation reflects a graph in the y-axis?

    Replacing x by -x swaps the left and right sides of the graph.
  4. 4. A point (4, 6) is on y = f(x). Which point is on y = 3f(x) - 2?

    The x-coordinate stays 4. The y-coordinate becomes 3(6) - 2 = 16.

Summary

  • Outside changes (a·f(x) + k) act on y as written; inside changes (f(b(x - h))) act on x in reverse.
  • Reflect with a minus sign: -f(x) in the x-axis, f(-x) in the y-axis.
  • Apply horizontal changes first, then vertical, tracking key points.

Next: Composition and Inverse Functions