Math Notes 26
On Newton’s Method
Newton’s method allows finding the ‘root’ of a function (where it is zero), given conditions expressed in the wikipedia article no doubt.
More than this however, it can be used to find the inverse of a function. The common example is . If you know where , then you know .
The rough gist of the algorithm is as follows.
- Take a function like
- Make an arbitrary guess on the value of where ,
- Evaluate at and find the line tangent to at
- Find the x-intercept of the tangent line. This x-intercept value is
- Repeat steps 2…5 (incrementing throughout) until a satisfactory precision is obtained.
Algebraically, we start with the function and its derivative:
And make a guess and create the tangent line at that guess location on
find by evaluating at :
Which finishes the line equation as:
Next, find the x-coordinate by evaluating at
As stated above, this value is actually , or generally
Going back the case of , we substitute in the function
With we see the first four approximations as:
Generally…
This process is easily generalized to finding inverses instead of roots — just as in the example.
was previously defined as , but more generically is described as . Then, inside the recursive equation, the is placed outside the function
The above approximates . the is replaced with some constant to find :
The generic case for then is:
Or
One way to loosely verify this is to: consider that when approaches , the differences between and will grow increasingly smaller (assuming the limit does indeed converge) and indeed will be come so close that we can consider them to be equal. So, we set and solve:
Other inverses
This method can be extended to other functions. Some examples:
Approximate Functions
By expanding the recursion a few steps, we can create an obnoxious approximation for :

And one for :

These examples were generated with the Python library SymPy. (I got exhausted of writing it by hand around third recursion)
View Code
from sympy import symbols, simplify, print_latex
x = symbols("x")
expr = 1
for i in range(0, 3):
expr = 0.5 * expr + x / (2 * expr)
print_latex(simplify(expr))
Arccos and π
Suppose , then when . (or suppose , then when .)
Which gives accurate to 100 digits in only 5 iterations.
View Code
from sympy import N, tan, pi
expr = 3
for i in range(0, 5):
expr = expr - tan(expr)
print(N(expr, 100))
print(N(pi - expr, 100))
Despite this method’s remarkable rate of convergence, it’s dependence of the tangent function makes it less useful. Internally, any computation using this method would require an ‘infinite’ series (or some other approximation) of . At which point I’m certain there’s a more direct way to compute it.
Nonetheless it remains a neat calculator trick to amuse mathematically included folks
Proof that π is rational (joke)
View Code
from sympy import N, pi, floor
best = (10000, 1)
for i in range(1, 1_000_000):
val = N(pi * i, 100)
lz = val - floor(val)
print(i, lz, val)
lz = lz.evalf()
if lz < best[0]:
best = (lz, i)
print(best)
If I were to trust google’s calculator… then I’d say π is rational.
