## Sunday, February 6, 2011

### Sketching a parabola

My son has homework (algebra class). Given a problem like this:

 `y = -(3/2)x2 - 12x - 25`

he is supposed to find 5 points on the curve and plot them, and then sketch the curve. Well, actually the software (ALEKS) will plot the curve.

We could use the quadratic equation (my post here) to find the x-intercepts, where

`y = 0`

And in algebra class they are taught (though not shown why) the axis of symmetry of the parabola is

 `x = -b/2a`

You can derive this as perhaps the most elementary result in calculus:

 `y = ax2 + bx + cy' = 2ax + b`

for a minimum or a maximum the slope is zero:

 `y' = 0 = 2ax + bx = -b/2a`

Or you can complete the square:

 `y = ax2 + bx + cy/a - c/a = x2 + (b/a)xy/a - c/a + (b/2a)2 = = x2 + (b/a)x + (b/2a)2 = (x + b/2a)2`

and recognize that the maximum (or minimum) for y will come when this squared term in` x` is equal to zero.

However, the problem requires getting 5 points and we only have 3. We remember (or are clued by the word "symmetry" above) and recognize that, if we define x0 as the x at the min/max (equal to `-b/2a`):

 `y(x0 + n) = y(x0 - n)`

so we really need only one `y`.

Still, it occurs to me that `y(x0 + 1)` ought to be simple. We ought not to have to calculate the whole `ax2 + bx + c` (with those stupid fractions)..

And I wonder what this looks like:

 `y(x1) = y(-b/2a + 1) = ?y(x2) = y(-b/2a + 2) = ?etc..`

It turns out to be extremely simple! Let's call y0 the y when x is on the axis of symmetry (the minimum or maximum), and y1 is when `x = x0 +/- 1`. We have

 `y = ax2 + bx + cy0 = a(-b/2a)2 + b(-b/2a) + c = b2/4a - b2/2a + c`

We could simplify that, but wait..

 `y1 = a(-b/2a + 1)2 + b(-b/2a + 1) + c`

If you'll let me I'll do the square and multiply by `a`:

 `y1 = b2/4a - b + a - b2/2a + b + c`

And the difference in` y` is (since everything in `y0` cancels):

 `y1 = b2/4a - b + a - b2/2a + b + cy0 = b2/4a - b2/2a + cΔy = y1 - y0 = a`

Wow! But wait, `x0 + 2` is also easy:

 `y2 = a(-b/2a + 2)2 + b(-b/2a + 2) + c = b2/4a - 2b + 4a - b2/2a + 2b + cΔy = 4a`

Let's check with the values given for the problem:

 `y = -(3/2)x2 - 12x - 25x0 = -b/(2a) = 12/(-3) = -4y0 = -24 + 48 -25 = -1`

So if `x1 = -3 (or -5)` then `y1` should be equal to

 `y0 + a = -1 - 3/2 = -5/2`

Try `x = -3` in the original equation:

 `-27/2 + 36 -25 = -5/2 check`

And if `x2 = -2 (or -6)` then `y2` should be equal to

 `y0 + 4a = -1 - 6 = -7.`

Try `x = -2` in the original equation:

 `-6 + 24 - 25 = -7 check`

How cool is that! I'll leave it as an exercise for the reader to show that:

 `Δy = (Δx)2a`

[ UPDATE: I guess I never really appreciated that since we can complete the square to make any linear term in x go away, what we are left with is something of the form `(y - y0) = a(x - x0)2`.

 `y = ax2 + bx + cComplete the square:y/a - c/a = x2 + (b/a)xy/a - c/a + (b/2a)2 = = x2 + (b/a)x + (b/2a)2 = (x + b/2a)2y - c + b2/4a = a(x + b/2a)2`

Define

 `y0 = c - b2/4ax0 = -b/2a(y - y0) = a(x - x0)2`

So this is just

 `y = ax2`

with its vertex moved to the point (x0, y0). It's easy to confirm that x = x0 is on the axis of symmetry and thtat (x0, y0) is a solution of the original equation.