Category: Functions Level: 201
y = x2 → y = -2(x - 2)2 + 4
Build y = −2(x − 2)² + 4 from y = x² one move at a time: shift right, stretch, reflect, shift up. Follow two points to see what each move does.
The parent graph y = x² has its vertex V at the origin. Track V and the point P(1, 1) through every move.
y = x2
Replace x with x − 2. Every point moves 2 to the right. Yes, minus means right here. The x inside has to reach 2 to do what x = 0 used to do.
(x, y) → (x + 2, y)
Multiply the outside by 2. Every height doubles, so P climbs from 1 to 2. The vertex sits at height 0, and twice nothing is still nothing.
(x, y) → (x, 2y)
Put a minus sign in front. Every height changes sign, so the cup turns into a cap and P drops to −2.
(x, y) → (x, -y)
Add 4 at the end. Every point rises 4, so the vertex lands at (2, 4) and P at (3, 2). Four moves, one equation.
y = -2(x - 2)2 + 4
cd svg-generator python3 -m svgmath render function-transformations --out /tmp/function-transformations
Source: svgmath/diagrams/function_operations.py