DA7. Newton’s Method to find square root¶
Statement¶
How might Newton’s Method be used to find the square roots of numbers that are otherwise hard to find. (eg, “the square root of 2”)? Provide examples.
Solution¶
Newton’s method is used to find the roots of a function, that is, the values of \(x\) that make \(f(x)=0\). The formula is:
For Square roots, we can use the function \(f(x)=x^2 - a\) where \(a\) is the number we want to find the square root of. For example, if we want to find the square root of 2, we can use \(f(x)=x^2 - 2\).
The meaning of \(f(x) = x^2 - a\) is that we want to find the value of \(x\) that makes \(x^2 - a = 0\), where \(x\) is the square root of \(a\).
Let’s try to apply the Newton’s method on \(f(x)=x^2 - a\):
The formula that we got exactly matches the formula mentioned by (Johnson, 2015). So we can use this formula to find the square root of any number \(a\).
When to stop iterating¶
There is one more critical point, is to know when to stop iterating, as we know, we can apply the Newton’s rule infinitely, but we need to stop at some point, accepting some kind of accuracy as this may never ends for irrational numbers.
According to (ASMI, 2015), Iterations of Newton’s should be stopped in any of the following cases, assuming that \(x_n\) is the current iteration and \(x_{n+1}\) is the next iteration, with some accuracy \(\epsilon\):
- If \(f'(x_n) = 0\), then we cannot proceed further as we will divide by zero.
- If \(|f(x_{n+1})| < \epsilon\), then we are close enough to the zero and no point of iterating further.
- If \(|f(x_{n+1}) - f(x_n)| < \epsilon\), then we are close enough to the root and no point of iterating further.
- If \(|x_{n+1} - x_n| < \epsilon\).
- If \(x_{n+1} = x_n\) (covered by point 4).
- If \(f(x_{n+1}) = f(x_n)\) (covered by point 3).
- If we exceed the maximum number of iterations that is allowed.
Examples¶
I will use two examples, one is hard to find the square root of like 13, and the other is easy like 100.
Let’s find the square root of 13, we can start with \(x_0 = 3\) and \(\epsilon = 0.06\):
The accuracy is \(|3.6667 - 3| = 0.6667 > 0.06\), so we need to continue.
Now we can use \(x_1\) to find \(x_2\):
We can see that \(|3.6667 - 3.6083| = 0.0584 < 0.06\), so we can stop here and say that the square root of 13 is 3.6083 (approximately).
Let’s find the square root of 100, we can start with \(x_0 = 10\) and \(\epsilon = 0.06\):
The accuracy is \(|10 - 10| = 0 < 0.06\), so we can stop here and since \(x_1 = x_0\), we can say that the square root of 100 is 10 (exactly).
References¶
- Johnson S. G. (2015). Square Roots via Newton’s Method. MIT. https://math.mit.edu/~stevenj/18.335/newton-sqrt.pdf
- ASMI. (2015). Newton’s method. https://amsi.org.au/ESA_Senior_Years/SeniorTopic3/3j/3j_2content_2.html