Intermediate level

Transforming a graph

One curve, four moves: up, sideways, mirrored in an axis and stretched. See how a change in the formula turns into a movement of the curve, why f(x − 2) shifts the graph to the right rather than the left, and how a plain sine becomes y = a·sin(bx + c) with any amplitude and period you like.

Before you start

This topic builds on earlier ideas. Before you start, it's worth working through the lessons below — they'll make everything click:

Where this is used

Real situations where you count exactly the way this lesson teaches:

  • Tuning an instrument
    A tuning fork sounds A4 at 440 Hz, that is the wave y = a·sin(2π·440·t). The same string pulled tighter sounds 466 Hz — the coefficient beside t grows, so the period drops from 1/440 ≈ 2.27 ms to 1/466 ≈ 2.15 ms. The tuner changes no shape, only one coefficient in the formula; plucking harder changes the amplitude alone, which is the loudness.
  • Tides in a harbour
    The water level in Gdańsk is modelled by h(t) = 0.3·sin(0.5t) + 2.4, with t in hours. The amplitude 0.3 m is half the difference between high and low water, and the constant 2.4 m is the upward shift, that is the mean sea level. A captain substitutes t = 3 and gets h = 0.3·sin 1.5 + 2.4 ≈ 2.70 m — the depth under the keel three hours from now.
  • A ball kicked on a pitch
    A ball kicked off the ground follows the parabola y = −0.05x² + x. The same kick taken from a 2 m platform is the same curve moved up: y = −0.05x² + x + 2. The vertex rises from 5 m to 7 m and the range grows from 20 m to about 21.8 m — the coach gets the answer without recomputing the trajectory.
  • Seasonal sales analysis
    Ice-cream sales across a year are modelled by S(m) = 120·sin(0.52·(m − 4)) + 200 thousand zloty, where m is the month number. The shift by 4 puts the peak in July; the amplitude 120 states the swing about the mean of 200 thousand. An analyst substitutes m = 1 and forecasts S ≈ 200 − 120·0.84 ≈ 99 thousand for January, less than half the mean.

All formulas

  • Shift along the y-axis

    y=f(x)+qy = f(x) + q

    up for q > 0, down for q < 0

  • Shift along the x-axis

    y=f(xp)y = f(x - p)

    to the right for p > 0 — against the sign in the formula

  • Translation by a vector

    y=f(xp)+qy = f(x - p) + q

    \vec{u} = [p,\, q]

  • Reflection in the x-axis

    y=f(x)y = -f(x)

    flips the sign of the value

  • Reflection in the y-axis

    y=f(x)y = f(-x)

    flips the sign of the argument

  • Vertical stretch

    y=af(x)y = a \cdot f(x)

    a times further from the x-axis

  • Horizontal squeeze

    y=f(bx)y = f(b x)

    b times closer to the y-axis

  • The general sinusoid

    y=asin(bx+c)y = a \sin(bx + c)

    amplitude |a|, period \tfrac{2\pi}{|b|}, shifted by -\tfrac{c}{b}

Not every curve has to be drawn from scratch. Most graphs you will meet are a handful of familiar shapes shifted, mirrored or stretched — and every one of those moves is visible in the formula.

Shifting along the y-axis

The simplest case: add a number to a finished formula.

y=f(x)+qy = f(x) + q

Every value grows by qq, so the whole graph rises by qq — up for q>0q > 0, down for q<0q < 0. The shape does not change, because the same amount was added to every value.

For the quadratic function f(x)=x2f(x) = x^2, the formula y=x2+3y = x^2 + 3 gives the same parabola with its vertex at (0,3)(0,\, 3) instead of at the origin.

Shifting along the x-axis

Here the argument changes, and this is where mistakes happen:

y=f(xp)y = f(x - p)

The graph moves pp units to the right — despite the minus sign. The reason is simple once you have seen it: the new function does at xx exactly what the old one did at xpx - p. To recover the old value at zero, you have to travel all the way to x=px = p.

formulawhat happens
y=f(x3)y = f(x - 3)three right
y=f(x+3)y = f(x + 3)three left
y=f(x)+3y = f(x) + 3three up
y=f(x)3y = f(x) - 3three down

The two middle rows look alike and do opposite things. The sign beside the argument works against intuition; the sign beside the value works with it.

Translation by a vector

Both moves at once make a translation by the vector u=[p,q]\vec{u} = [p,\, q]:

y=f(xp)+qy = f(x - p) + q
−4−3−2−10123456−1012345678xyu = [2, 3]y = x²y = (x − 2)² + 3u = [2, 3]
The parabola y = x² and its image under the translation by [2, 3]. The arrow runs from the old vertex to the new one — y = (x − 2)² + 3 says exactly the same thing in letters.

Multiplied out, (x2)2+3=x24x+7(x-2)^2 + 3 = x^2 - 4x + 7 — the same function, but the general form hides the translation. The vertex form is precisely the spelling in which the shift is written out.

The graph of f(x) = x² is translated by the vector [−3, 2]. Give the formula of g.

Reflections

Two transformations, two different minus signs:

y=f(x)andy=f(x)y = -f(x) \qquad \text{and} \qquad y = f(-x)

The first flips the sign of the value — the point (x,y)(x,\, y) goes to (x,y)(x,\, -y), so the graph is reflected in the x-axis. The second flips the sign of the argument — the point (x,y)(x,\, y) goes to (x,y)(-x,\, y), a reflection in the y-axis.

functionf(x)-f(x)f(x)f(-x)
x2x^2x2-x^2 (arms down)x2x^2 (unchanged — an even function)
2x+12x + 12x1-2x - 12x+1-2x + 1
x\sqrt{x}x-\sqrt{x}x\sqrt{-x} (domain x0x \le 0)

The middle row shows why it pays to compute rather than guess: for f(x)=2x+1f(x) = 2x+1 the two reflections give different lines.

Given f(x) = x² − 4x, find the formula of g(x) = f(−x).

Stretching and squeezing

Instead of adding, multiply — and again the result depends on which side the multiplier stands.

y=af(x)andy=f(bx)y = a \cdot f(x) \qquad \text{and} \qquad y = f(b x)
  • y=af(x)y = a \cdot f(x) stretches the graph along the y-axis: every point moves aa times further from the x-axis. The zeros stay where they were, because a0=0a \cdot 0 = 0.
  • y=f(bx)y = f(bx) squeezes the graph along the x-axis: what the function used to do over a unit interval it now fits into an interval of length 1b\tfrac{1}{b}. The intercept on the y-axis stays put.

Once more: the multiplier on the value behaves as you expect, the multiplier on the argument does the opposite. A 2 in front of the function makes the graph twice as tall; a 2 beside xx makes it twice as narrow.

The general sinusoid

All four moves at once show up best on the sine graph, because a plain sinx\sin x has such a recognisable shape:

y=asin(bx+c)+dy = a \sin(bx + c) + d
coefficientwhat it setsvalue
aaamplitudea\lvert a \rvert
bbperiod2πb\dfrac{2\pi}{\lvert b \rvert}
ccphase shiftcb-\dfrac{c}{b}
ddmidliney=dy = d
−π−2π/3−π/30π/32π/3π4π/35π/3−2−1012xyy = sin xy = 2 sin 2x
A plain sine and the sinusoid y = 2·sin 2x. The crests reach 2 instead of 1 (the amplitude), and a full cycle fits into π instead of 2π (the period).

The phase shift is cc divided by bb, not cc itself — only after factoring bb out of the bracket can you see how far the argument really travels:

sin(2xπ)=sin ⁣(2(xπ2))\sin(2x - \pi) = \sin\!\left(2\left(x - \tfrac{\pi}{2}\right)\right)

The graph moves π2\tfrac{\pi}{2} to the right, not π\pi.

Give the amplitude, the period and the phase shift of y = 3 sin(2x + π).

The same three coefficients describe every wave: sound, mains voltage and the water level in a harbour differ only in their values.

Practice

The set checks four things: the formula after a shift or a reflection, the image of a point of the graph (compute ff first, then move the point), the period of a sinusoid and its value at a point. Write the formula in whichever spelling suits you — (x−2)^2+3 and x^2−4x+7 are both accepted, because they are the same function. Describing a transformation in words ("a translation by the vector…") stays with the worked examples above: its answer is a sentence, not a number.

Practice

Work through a set of exercises — they get harder as you go. At the end you'll see your score and the mistakes worth reviewing.

Exercise 1 of 8Score: 0
f(x) = x²; g(x) = f(x + 1) + 4; g(x) =

Common mistakes

  • Shifting left for f(xp)f(x - p) — a minus beside the argument means a move to the right; check it on the vertex or on a zero.
  • Confusing f(x)-f(x) with f(x)f(-x) — the first reflects in the x-axis, the second in the y-axis; for an odd function they agree, which is exactly what lulls you into not checking.
  • Reading the phase shift off cc — only cb-\tfrac{c}{b} says how far the graph travels.
  • Believing aa in y=asinbxy = a\sin bx changes the period — it changes the amplitude; the period depends on bb alone.
  • Swapping a stretch and a vertical shift2f(x)+12 \cdot f(x) + 1 and 2(f(x)+1)2 \cdot (f(x) + 1) are two different graphs.
  • Forgetting the domain after a reflectionx\sqrt{-x} is defined for x0x \le 0, however innocent the formula looks.

Formula card

Topic: Transforming a graph

  • Shift along the y-axis

    y=f(x)+qy = f(x) + q

    up for q > 0, down for q < 0

  • Shift along the x-axis

    y=f(xp)y = f(x - p)

    to the right for p > 0 — against the sign in the formula

  • Translation by a vector

    y=f(xp)+qy = f(x - p) + q

    \vec{u} = [p,\, q]

  • Reflection in the x-axis

    y=f(x)y = -f(x)

    flips the sign of the value

  • Reflection in the y-axis

    y=f(x)y = f(-x)

    flips the sign of the argument

  • Vertical stretch

    y=af(x)y = a \cdot f(x)

    a times further from the x-axis

  • Horizontal squeeze

    y=f(bx)y = f(b x)

    b times closer to the y-axis

  • The general sinusoid

    y=asin(bx+c)y = a \sin(bx + c)

    amplitude |a|, period \tfrac{2\pi}{|b|}, shifted by -\tfrac{c}{b}

−4−3−2−10123456−1012345678xyu = [2, 3]y = x²y = (x − 2)² + 3u = [2, 3]
The parabola y = x² and the same parabola translated by the vector [2, 3]. The arrow shows where the vertex went: y = (x − 2)² + 3 reads as "two right, three up".
−π−2π/3−π/30π/32π/3π4π/35π/3−2−1012xyy = sin xy = 2 sin 2x
A sine and the sinusoid y = 2·sin(2x). The coefficient in front of the function lifts the crests to 2; the coefficient beside x cuts the period from 2π to π — two coefficients, two different effects.

Frequently asked questions

Related articles