Transformations of functions¶
Algebra · level 7, lesson 5 of 7
A question to start¶
Graph \(y = x^2\) and \(y = (x - 3)^2\). The second parabola is the first one moved 3 units to the right. But there is a minus sign in it. Shouldn't minus move things left?
And here is a second puzzle. \(y = x^2 + 3\) is the parabola moved up 3: the plus sign does what you expect. So why does a number added outside behave as expected, while a number added inside seems to do the opposite? The answer is one idea, and it explains every transformation in this lesson.
The idea¶
Four parent functions¶
A parent function is the simplest member of a family. We will move and stretch these four:
| Parent | Key points | Domain | Range |
|---|---|---|---|
| \(y = x^2\) | \((0, 0), (\pm1, 1), (\pm2, 4)\) | all reals | \(y \ge 0\) |
| \(y = \sqrt{x}\) | \((0, 0), (1, 1), (4, 2), (9, 3)\) | \(x \ge 0\) | \(y \ge 0\) |
| \(y = \dfrac1x\) | \((1, 1), (-1, -1), (2, \tfrac12), (\tfrac12, 2)\) | \(x \ne 0\) | \(y \ne 0\) |
| \(y = \lvert x \rvert\) | \((0, 0), (\pm1, 1), (\pm2, 2)\) | all reals | \(y \ge 0\) |
\(\lvert x \rvert\) is the absolute value of \(x\): its distance from 0, so \(\lvert 3 \rvert = 3\) and \(\lvert -3 \rvert = 3\). The graph of \(\dfrac1x\) has two pieces that get closer and closer to the axes without touching them; such lines are called asymptotes.
Changes outside: they act on \(y\)¶
Outside the function, the change happens after the function has done its work, so it acts on the output \(y\) directly:
- \(y = f(x) + c\): every point moves up \(c\) (down if \(c < 0\)). A vertical translation.
- \(y = af(x)\): every height is multiplied by \(a\). If \(a > 1\) the graph is stretched away from the \(x\)-axis; if \(0 < a < 1\) it is squashed towards it (a vertical stretch or compression). If \(a < 0\) the graph also flips over the \(x\)-axis (a reflection).
Changes inside: they act on \(x\), backwards¶
Now take \(g(x) = f(x - 3)\). Which input to \(g\) gives the same output as the input \(0\) gives to \(f\)? We need \(x - 3 = 0\), so \(x = 3\). Whatever \(f\) did at 0, \(g\) does at 3. Whatever \(f\) did at 1, \(g\) does at 4. Every feature arrives 3 later, so the graph moves 3 to the right.
The inside change acts before the function, on the input. To get the same output you have to undo it, and undoing "subtract 3" means "add 3". That is why the inside seems backwards. The same reasoning gives:
- \(y = f(x - d)\): moves right \(d\) (left if \(d < 0\)). A horizontal translation.
- \(y = f(kx)\): \(g\!\left(\tfrac{t}{k}\right) = f(t)\), so a point at \(x = t\) moves to \(x = \tfrac{t}{k}\). If \(k > 1\) the graph is squashed towards the \(y\)-axis by a factor \(\tfrac1k\) (a horizontal compression); if \(0 < k < 1\) it is stretched. If \(k < 0\) it also flips over the \(y\)-axis.
All at once: \(y = af(k(x - d)) + c\)¶
Put all four together and each point \((x, y)\) of the parent goes to
This is the mapping rule. Inside the function, \(k\) is applied after subtracting \(d\), so to undo it we first divide by \(k\), then add \(d\). Outside, we first multiply by \(a\), then add \(c\). So the safe order is:
- stretches, compressions and reflections (use \(k\) and \(a\));
- then translations (use \(d\) and \(c\)).
One warning: \(k\) must be factored out first. \(y = \sqrt{2x - 6}\) is \(y = \sqrt{2(x - 3)}\), so \(k = 2\) and \(d = 3\). The shift is 3, not 6.
A picture¶
Here is \(y = x^2\) (dashed) turned into \(y = -2(x + 1)^2 + 3\) with the mapping rule \((x, y) \to (x - 1, -2y + 3)\):
The vertex \((0, 0)\) goes to \((-1, 3)\). The points \((\pm1, 1)\) go to \((0, 1)\) and \((-2, 1)\). The points \((\pm2, 4)\) go to \((1, -5)\) and \((-3, -5)\). Plot these five and draw the curve through them.
Worked examples¶
1. A parabola. Sketch \(y = -2(x + 1)^2 + 3\).
- \(a = -2\): stretch by 2 and reflect in the \(x\)-axis. \(k = 1\). \(d = -1\): left 1. \(c = 3\): up 3.
- Mapping rule \((x, y) \to (x - 1, -2y + 3)\). The points are those in the picture above.
- Check one: at \(x = 1\), \(-2(2)^2 + 3 = -8 + 3 = -5\). ✓ The vertex \((-1, 3)\) is a maximum; the range is \(y \le 3\).
2. A square root with a reflection. Sketch \(y = 2\sqrt{4 - x} - 1\).
- Rewrite the inside as \(-(x - 4)\): \(y = 2\sqrt{-(x - 4)} - 1\). So \(a = 2\), \(k = -1\), \(d = 4\), \(c = -1\).
- Mapping rule \((x, y) \to (-x + 4, 2y - 1)\).
- \((0, 0) \to (4, -1)\); \((1, 1) \to (3, 1)\); \((4, 2) \to (0, 3)\); \((9, 3) \to (-5, 5)\).
- The graph starts at \((4, -1)\) and goes to the left. Domain \(x \le 4\), range \(y \ge -1\).
- Check: \(x = 0\) gives \(2\sqrt4 - 1 = 3\). ✓
3. A reciprocal. Sketch \(y = \dfrac{1}{x - 2} + 3\).
- Right 2, up 3. The asymptotes move with the graph: \(x = 0\) becomes \(x = 2\), and \(y = 0\) becomes \(y = 3\).
- \((1, 1) \to (3, 4)\) and \((-1, -1) \to (1, 2)\).
- Domain \(x \ne 2\), range \(y \ne 3\).
4. Factoring out \(k\). Describe \(y = \lvert 2x + 6 \rvert\).
- \(y = \lvert 2(x + 3) \rvert\): compress horizontally by \(\tfrac12\), then move left 3. The vertex goes from \((0, 0)\) to \((-3, 0)\).
- (For absolute value, \(\lvert 2(x + 3) \rvert = 2\lvert x + 3 \rvert\), so it is also a vertical stretch by 2. Some functions can be changed in more than one way to land on the same graph.)
5. Writing the equation. \(y = x^2\) is reflected in the \(x\)-axis, stretched vertically by 3, then moved 2 right and 5 up. Write the new equation.
- \(a = -3\), \(d = 2\), \(c = 5\): \(y = -3(x - 2)^2 + 5\).
Try it¶
- Describe how \(y = (x + 5)^2 - 2\) is made from \(y = x^2\). Give its vertex.
- Describe \(y = -\sqrt{x} + 3\), and give its domain and range.
- The point \((2, 4)\) is on \(y = x^2\). Where does it go on \(y = 3(x - 1)^2 + 2\)? Check by substituting.
- Describe \(y = \sqrt{3x - 12}\) and give its domain.
- Give the asymptotes, domain and range of \(y = -\dfrac{1}{x + 1} - 2\).
- Write the equation: \(y = \lvert x \rvert\) stretched vertically by 2, reflected in the \(x\)-axis, moved 3 left and 4 up.
- For \(f(x) = x^2\), compare \(y = f(2x)\) and \(y = 2f(x)\). Are they the same graph?
- The point \((6, -3)\) is on \(y = f(x)\). Find the matching point on \(y = -2f(3(x + 1)) + 4\).
Answers
- Left 5 and down 2. Vertex \((-5, -2)\).
- Reflect \(y = \sqrt{x}\) in the \(x\)-axis, then move up 3. The graph starts at \((0, 3)\) and goes down to the right. Domain \(x \ge 0\), range \(y \le 3\).
- Mapping rule \((x, y) \to (x + 1, 3y + 2)\): \((2, 4) \to (3, 14)\). Check: \(3(3 - 1)^2 + 2 = 12 + 2 = 14\). ✓
- \(y = \sqrt{3(x - 4)}\): compress horizontally by \(\tfrac13\), then move right 4. It starts at \((4, 0)\). Domain \(x \ge 4\).
- Reflect \(y = \dfrac1x\) in the \(x\)-axis, move left 1 and down 2. Asymptotes \(x = -1\) and \(y = -2\). Domain \(x \ne -1\), range \(y \ne -2\).
- \(y = -2\lvert x + 3 \rvert + 4\).
- \(f(2x) = (2x)^2 = 4x^2\), but \(2f(x) = 2x^2\). Not the same: \(f(2x)\) is a horizontal compression by \(\tfrac12\), which for this parabola looks like a vertical stretch by 4, not by 2.
- Here \(a = -2\), \(k = 3\), \(d = -1\), \(c = 4\). \(x\): \(\tfrac63 - 1 = 1\). \(y\): \(-2(-3) + 4 = 10\). The point is \((1, 10)\). Check: \(3(1 + 1) = 6\), so \(f(6) = -3\) is used, giving \(-2(-3) + 4 = 10\). ✓
Common mistake¶
Moving the wrong way inside. \(y = (x + 4)^2\) moves left 4, not right. Ask: "what input makes the inside 0?" Here \(x = -4\), so the vertex is at \(x = -4\).
Not factoring out \(k\). \(y = (2x - 6)^2\) is \(y = (2(x - 3))^2\): the vertex is at \(x = 3\), not \(x = 6\). Check: \(2(3) - 6 = 0\). ✓
Translating before stretching. If you move the graph first and then stretch it, the stretch moves the shifted points again and you land in the wrong place. Stretch and reflect first, translate last, or simply use the mapping rule on each point.
Where it leads¶
- Back: Functions · Next: Inverse functions, where the graph is reflected in the line \(y = x\).
- Level 7 page · Algebra topic page
- The same moves for sine and cosine waves: Graphs of sine and cosine. Translations, reflections and stretches of shapes: Transformations on a grid.
- The transformations of \(\dfrac1x\) are studied in detail in Rational functions; of exponential functions in lesson 7.