Computing the square root of 2 with Newton’s Method
Articles,  Blog

Computing the square root of 2 with Newton’s Method


Okay, last time we talked about
how Newton’s method works in general. Now we’re gonna use it to compute √2. So suppose you’re left
in the Dark Ages, like 1970 or so,
before calculators were common. And somebody said, “Okay,
I need you to tell me what √2 is “to 10 decimal places,
and you can only do it by hand.” If you had no calculus, this is actually
not nearly that bad a problem. It may sound tough, but you can
do it in about 5 minutes. So let’s see. What we’re looking for is places— a value of x for which x^2=2. In other words,
x^2 – 2=0. So that’s our function f(x). And the derivative of that is just 2x. And we set up the table
like we talked about last time. Let’s take as our first guess
something really rough. We’re gonna guess x=1. That’s not all that close to √2,
but it’s a good enough starting point. Then f(x)=1^2 – 2,
that’s -1. And f'(x)=2. And our new and improved guess
is gonna be 1 – (-1/2), so that’s 3/2. So that’s 1.5, okay? That does a little bit better. We try 3/2. And we say okay, f(x),
(3/2)^2 is 9/4, -2 leaves 1/4. f'(x) is 2(3/2), that’s 3. And so we want (3/2) – (1/4)/(3). That winds up being 17/12.
Okay? Let’s keep going.
17/12… You square that,
and you get 289/144, which is 2 and 1/144. So we’re getting pretty good. f'(x) is 17/6. And now we wind up getting
17/12 – (1/144)/(17/6). And the arithmetic gets
a little bit ugly, but you can do it. The answer turns out to be 577/408. And yes, I did this all by hand
without a calculator. You plug in 577/408,
you square that, you subtract 2, and you wind up
getting 1/166,464. The derivative—
577/204. And you take the difference, and it winds up being
665,857 / 470,832. Okay, it takes it a little while
to crank that out. But now we’ve got something
that is actually good… good—really accurate. If we do this in decimals,
this is 1.5. Our next guess was
1.41666. That’s good to two decimal places. √2 is actually closer to 1.414. So these first two
decimal places are good, the third one’s not so good. This one turns out to be
1.4142156, and so on. That’s good to 1, 2, 3, 4, 5 decimals;
this 5 is a little bit off. This winds up being
1.414213562376. And so on. All these decimal places are right,
it’s wrong on the 11th decimal place. So Newton’s method gives you
really accurate answers. And in fact, if you’re wondering
how does your calculator actually compute √2,
this is how it does it. It uses an algorithm that’s
equivalent to Newton’s method, and it zooms in on this number. Okay, next time we’ll come
to the modern age, assume that you do have a calculator,
and we’ll solve a problem that you can’t directly
solve on a calculator, but that you can solve
with Newton’s method.

14 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *