## Thursday, December 25, 2008

### Happy Newton's Day, 2008!

So here we are, celebrating our 5th Newton's Day at 3QD. Along with Richard Dawkins, we independently and simultaneously came upon the idea of celebrating Newton's Day on December 25th in 2004, and each year since then I have written a little something about Sir Isaac. Here are my posts from 2004, 2005, 2006, and 2007. Today, I'll explain a simple but very useful mathematical technique called Newton's Method, discovered by Newton in 1669, though he published it later.

Newton's Method is a way of iteratively finding closer and closer solutions to a certain kind of mathematical equation (a real-valued function *f(x)*, to be technical). We do this in the following way (it may help to look at the concrete example from Wikipedia in the graphic following my description of the general method, to better understand what I mean):

- Take a guess at the solution (a value for x).
- Plug in this value for
*x*and see what*f(x)*is. - Draw a line tangent to the function at this point.
- The point where this line intersects the x-axis is your new and improved value for
*x*. - Take this new value for
*x*and go back to step 2. (This repeating is called iteration.)

Have a look at the graph (from Wikipedia) on the right. The function *f(x)* is the curved line shown in blue. In other words, for any point *x* on the horizontal axis, the blue line shows the value of *f(x)* on the vertical axis. The root (or solution) of the function is where the function crosses the horizontal axis; in other words, where the value of *f(x)* is zero. In the graph here, this is the value marked *X*. So we take a guess, *X _{n}*, go up the dotted blue line to the function, and then calculate the tangent line to the function at that point. This is shown in red. We see where that line crosses the x-axis, and take that point,

*X*, as our value for

_{n+1}*x*in the next iteration. As you can see,

*X*is a better approximation of the actual root,

_{n+1}*X*. When we repeat the process over and over, one can very quickly converge on the correct solution.

How exactly do we do this? Let me show you. We know from calculus (as did Newton, since he invented it) that the derivative of a function *f(x)* at given point, written *f'(x _{n})*, is just the slope of the tangent line at that point. But we also know that the slope of a line is just the "rise", in this case, the value of

*f(x*(on the vertical axis), divided by the "run," the amount we move from

_{n})*X*to

_{n+1}*X*on the horizontal axis. Setting these two quantities as equal, we get this equation: the derivative of the function at

_{n}*X*is equal to the value of the function at

_{n}*X*divided by the distance between

_{n}*X*and

_{n}*X*. In proper algebraic notation:

_{n+1}*f'(x _{n}) = f(x_{n}) / (X_{n} - X_{n+1})*

Mutiplying both sides by *(X _{n} - X_{n+1})*, we get:

*(X _{n} - X_{n+1}) * f'(x_{n}) = f(x_{n})*

Dividing both sides by* f'(x _{n})*, we get:

*(X _{n} - X_{n+1}) = f(x_{n}) / f'(x_{n})*

Subtracting *X _{n}* from both sides, we get:

*- X _{n+1} = f(x_{n}) / f'(x_{n}) - X_{n}*

And finally, multiplying both sides by *-1*, we get:

*X _{n+1} = X_{n} - f(x_{n}) / f'(x_{n})*

So that's how once we make an initial guess *X _{n}*, we get our next value

*X*. And then repeat the process.

_{n+1}Look at this nice example from Wikipedia, where one wants to find the square root of 612:

In each successive result on the right hand side above, the correct digits are underlined. As you can see, one converges to a very accurate (to nine significant digits) approximation rather quickly. Well, there you go. That's Newton's Method. Interestingly, since computers are very fast at doing this sort of iteration, Newton's Method has become even much more useful now than when he invented it.

Oh, and if you don't understand "derivatives", just take my word for it: the derivative of the function "*x ^{2} - 612*" is "

*2x*" and don't worry about the details... :-)

I wish all of you a very happy holiday season, and also best wishes for a wonderful new year!

Posted by S. Abbas Raza at 12:00 AM | Permalink