Sunday, August 12, 2012

Solving Quadratics the Hard Way

A post to a math Google Group asked about the effect of computerized equation solvers on math education. Don "The Mathman" Cohen replied that during his work with his students he's solved quadratic equations (like x2 - 5x + 6 = 0) no less than 12 ways! This list includes continued fractions and iterating using a calculator. Schools normally only teach 3 ways: factoring, completing the square and (my favorite) the quadratic formula.

Being in my calculus mode recently, I wanted to add Newton's method to the list. In the 1600s Newton used his new invention, calculus, to approximate roots of polynomials like the one below:


A "root" of a function is the x-value where the line or curve crosses the x-axis. In the figure above, the root is the red dot. You guess the root is at x0, then you plug x0, the function of x0 and the derivative of the function at x0 into the formula

x1 = x0 - f(x0)/f'(x0)

to get x1, the next approximation for the root. Do that again and x2 is even closer to the red dot in the picture.

I just wrote a short program in Sage to print 9 approximations and used x = 5 as my first guess:


f(x)= x^2-5*x+6
g(x)= derivative (f,x)
a=5
d=1
while d < 10:
    b=a-(f(a)/g(a))
    print N(b)
    a = b
    d = d + 1

Here are the approximations:

3.80000000000000
3.24615384615385
3.04060269627280
3.00152476019449
3.00000231782539
3.00000000000537
3.00000000000000
3.00000000000000
3.00000000000000
Sure enough, 3 is a solution of the equation: 3^2 - 5(3) + 6 = 9 - 15 + 6 = 0. An initial guess of 0 gives the other root of 2. The method gives the root closer to your initial guess.

Newton and his derivatives show up in the Math Through Technology Program starting September 6!

1 comment:

  1. In mathematics, the term quadratic describes something that pertains to squares, to the operation of squaring, to terms of the second degree, or equations or formulas that involve such terms.multiply polynomials

    ReplyDelete