The Complex Dynamics of Newton's Method: Bachelor Project Mathematics
The Complex Dynamics of Newton's Method: Bachelor Project Mathematics
2
Contents
1 Newton’s Method 4
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 How Newton’s method works . . . . . . . . . . . . . . . . . . . . . . 4
1.3 When Newton’s method fails . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Dynamics of Newton’s method . . . . . . . . . . . . . . . . . . . . . . 7
5 Conclusion 36
6 References 37
3
1 Newton’s Method
1.1 Introduction
Newton’s method is the best known iteration method for finding a real or a com-
plex root of a differentiable function. It is also called the Newton-Raphson method
named after Isaac Newton and Joseph Raphson. When the function f (x) has more
than one root, the root found by Newton’s method depends on the initial guess. This
behavior of which root is found leads to an interesting pattern. By expanding the
initial guess to include numbers in the complex plane a fractal pattern will emerge.
In the rest of this section we will look at how Newton’s method works, when it
fails and see how we can determine which initial point leads to which root. Then
in section 2 we will expand the method to the complex plane for a function with
two roots. We will look at functions with more than two roots in section 3. And
in section 4 we will look at two variations of Newton’s method and see if they have
similar or entirely different dynamics.
As an example of how this works let’s use the polynomial f (x) = 21 x3 − 14 this func-
3
tion can be seen in figure 1. As a starting point let’s use x0 = 12 then f (x0 ) = − 16 .
We can determine the formula for when the the tangent line crosses the x-axis using
the equation of a tangent line, which is
f (x0 )
In figure 1 we can see this process graphically. Using the equation x1 = x0 − f 0 (x0 )
f (xn )
we can generate a sequence of points: xn+1 = xn − f 0 (xn )
. We define the Newton
4
function for f as follows: N (x) = x − ff0(x)
(x)
. Newton’s method works by finding the
fixed points of the Newton function. These fixed points then correspond to the roots
of the function f (x).
Figure 1: First two iterations of Newton’s method for the function f (x) = 21 x3 − 41 .
Critical point
If the initial point x0 is a critical point of f (x), meaning f 0 (x0 ) = 0 then the tangent
line is a horizontal line, which can be seen in figure 2, and therefore will never cross
the x-axis. So the next iteration point doesn’t exist and Newton’s method will not
converge to a root.
Figure 2: Newton’s method applied to the function f (x) = x2 − 1. The initial guess
coincides with a critical point.
5
Periodic dynamics
It can happen that the initial point coincides with a cycle. The following example
3
is from [2]. Consider the function f (x) = x3 − 5x, which has N (x) = x − x3x−5x
2 −5 and
(1)3 − 5(1)
x1 = N (x0 ) = 1 − = −1,
3(1)2 − 5
and
(−1)3 − 5(−1)
x2 = N (x1 ) = −1 − = 1.
3(−1)2 − 5
So we have x2 = x0 this means we will get a cycle of period 2. This can be seen in
figure 3.
6
Figure 4: The function f (x) = x2 + 1 has no real roots.
In order to determine these basins of attractions we will first look at the Newton
function N (x) = x − ff0(x)
(x)
. By determining what kind of fixed points the Newton
function has we can find out which initial point leads to which root. From [6] we
have the following theorem:
Theorem 1. (Schroder fixed point theorem). If f is an analytic function with f (λ) =
λ and |f 0 (λ)| < 1, then there is neighborhood D of the fixed point λ on which all
points converge to λ under iteration by f ; that is, for any z ∈ D, limn→∞ f n (z) = λ.
Proof for real numbers [2]. Since |f 0 (λ)| < 1 there is a number α > 0 such that
|f 0 (λ)| < α < 1. Therefore we can choose a number δ > 0 so that |f 0 (x)| < 1
provided that x ∈ I, with I = [λ − δ, λ + δ]. Now let p be any point in I. Then by
the Mean Value Theorem we have
|f (p) − f (λ)|
< α,
|p − λ|
so that
|f (p) − f (λ)| < α|p − λ|.
7
Because λ is a fixed point so f (λ) = λ we have
So we have |f (p) − λ| < |p − λ| because 0 < α < 1. Therefore the distance between
f (p) and λ is smaller than the distance between p and λ. And since f (p) ∈ I we
can use the same argument again and get
Since α < 1 we also have α2 < 1. So the points f 2 (p) and λ are closer together than
the points f (p) and λ. And we have f 2 (p) ∈ I so we can repeat the argument. By
continuing this argument we find that, for n > 0,
By this definition we have that all fixed points of the Newton function N (x) are
super attracting fixed points. Because if we let x∗ be a root of f (x) then f (x∗ ) = 0
and we have
f 0 (x∗ )f 0 (x∗ ) − f (x∗ )f 00 (x∗ ) f 0 (x∗ )2
N 0 (x∗ ) = 1 − = 1 − = 0.
f 0 (x∗ )2 f 0 (x∗ )2
So we have that all fixed points of N (x) are super attracting points since |N 0 (x∗ )| = 0
for all fixed points x∗ of N (x).
8
Determining the basin of attraction
We can use the previous theorem and definitions to determine the basins of attraction
of Newton’s method. As an example consider the function f (x) = (x − 1)(x + 1) =
x2 − 1. This function has two roots x = 1 and x = −1. We want to find when
Newton’s method converges to x = 1 and when it converges to x = −1. First by
looking at figure 5 we can see that x = 0 is a critical point and therefore Newton’s
method will fail at this point. Furthermore from figure 5 we can see that when x0 > 1
Newton’s method will converge to the root x = 1 since it is a super attracting fixed
point. When 0 < x0 < 1 Newton’s method will also converge to x = 1 because
then x1 > 1. So we have (0, ∞) = B(1). With the same reasoning we find that
(−∞, 0) = B(−1).
Figure 5: The basins of attraction of Newton’s method for the function f (x) = x2 −1.
9
2 Functions with two roots
We can further analyze the behavior of Newton’s method by expanding the selection
of the initial point to the complex plane. We will still get a solution even when the
roots of the function are real. The best way to analyze the behavior of Newton’s
method in the complex plane is by drawing the basins of attractions in a figure.
This can be done by using Matlab, for the code see the appendix. The figure will
be drawn by taking a point in the complex plane and use it as an initial point for
Newton’s method and then depending on which root Newton’s method converges
to it will be a different color. Then we repeat this action for other points in the
complex plane. In this section we will go from −i to i and from −1 to 1. For
this range the step size we will use will be 0.0005. And figures that will have a
smaller range will have as step size of 0.0001. The step size determines the distance
between the chosen initial points. So if we start at −1 + i the next initial point will
be −0.9995 + i.
10
(a) Basins of attraction for z = 1 in red (b) The darker shades indicate more it-
and z = −1 in blue. erations are needed for convergence.
This explains the behavior because when y is close to zero the term y1 will be large.
And for the next iteration y is large and y1 will be small. And because of the 12 term in
front the next iteration point will be halved. This behavior then repeats itself until
the iteration point will be around zero. This can see in figure 7a. As an example
lets say that at some point we have x = 0.99 then the next iteration point will be
1 1
2
(0.99− 0.99 ) = −0.0050505 and the next will be 21 (−0.0050505− −0.010101
1
) = 49.495,
1 1
and the iteration after that 2 49.495 − 49.495 = 24.738, which is about half of the
previous iteration.
11
(a) Plot of the values that the iteration points take.
Figure 7: Behaviour of Newton’s method on the imaginary axis for the function
f (z) = z 2 − 1.
12
which we consider in C. Then we obtain
R(u) = T ◦ N ◦ T −1 (u) = u2 .
Figure 8: Newton basin for f (z) = z 2 + 1. The initial points converging to the root
z = i in red and to z = −i in blue.
13
Behavior of Newton’s method on the real axis
The behavior of Newton’s method on the real axis for the function f (z) = z 2 + 1 is
the same as the behavior of Newton’s method on the imaginary axis for the function
f (z) = z 2 − 1. This can be seen by looking at the Newton function. Since we want
to look a the behavior at the real line choose z = x + i0. Then
x2 − 1
1 1
N (x) = x − = x+ ,
2x 2 x
14
3 Functions with more than two roots
When there are two roots the dynamics of Newton’s method is still easy to explain.
As we saw in the previous section we can clearly define the boundary between the
basins of attraction of the two roots. In this section we discuss what happens when
there are more than two roots. Is there still a clearly defined boundary?
super attracting fixed points because all fixed points of Newton functions are super
attracting.
2x3
−x =
3x2 − 1
0 = 5x3 − x
1
x = ± √ or x = 0.
5
From this we conclude that − √15 , √15 ⊆ B(0).
15
Figure 9: The basins of attraction of Newton’s method for the function f (x) = x3 −x.
Reprinted from [1].
So all that is
left is to determine
what happens
when
we choose the initial point such
1 1 1 1
that x0 ∈ − √3 , − √5 or when x0 ∈ √5 , √3 . Since the function is symmetric
the interval − √13 , − √15 has the same behavior as the interval √15 , √13 . In these
two intervals the basins of attraction alternate between B(−1) and B(1) where the
length of each basin get’s smaller and smaller as can be seen in figure 10.
Figure 10: Basin structure in √15 , √13 for the function f (x) = x3 − x (distance is
not to scale). Reprinted from [1].
We can explain this behavior by looking at what the behavior of the tangent line
is in this interval. When we choose an initial point that is slightly to the left of
√1 then x1 will be a large negative number. So for this point Newton’s method
3
converges to x = −1. This means that the chosen inital point will be in B(−1).
This will continue to happen until x1 = − √13 . Then x1 will coincide with a critical
point and Newton’s method will fail, which can be seen in figure 11a.
16
(a) The first iteration point coincides with a critical point.
Figure 11: First two iterations of Newton’s method for the function f (x) = x3 − x.
Solving
1
x1 = N (x) = √ ,
− 3
gives x = 0.465601, so we have
1
√ , 0.465601 ⊂ B(−1).
3
As we choose x0 < 0.465601, x0 ∈ B(1) since x2 will be a large positive number as
seen in figure 11b. This will continue until x2 = √13 then x2 coincides with a critical
point, which can be seen in figure 12a. Solving
1
x2 = N (N (x)) = √ ,
3
gives x2 = 0.4502020, so we have
17
(a) The second iteration point coincides with a critical point.
Figure 12: First two iterations of Newton’s method for the function f (x) = x3 − x.
18
i bi bi − bi+1 (bi − bi−1 )/(bi+1 − bi )
0 0.577350
1 0.465601 0.111749 7.26
2 0.4502020 0.015399 6.18
3 0.4477096 0.0024924 6.03
4 0.4472962 0.0004134 6.01
5 0.44722736 0.00006884 6.00
6 0.44721589 0.00001147 6.00
7 0.44721398 0.00000191 6.00
6x2 (x2 − 1)
N 0 (x) =
(3x2 − 1)2
0 1
N √ = −6.
5
From the definition of the derivative we have that if bi and bi+1 are any two points
close to √15 then
N (bi+1 ) − N (bi )
≈ −6.
bi+1 − bi
And since N (bi ) = −bi−1 we get
bi − bi−1
≈ 6.
bi+1 − bi
This is why the ratios of the lengths of the basins approaches 6.
Complex plane
From section 2 we found that if there are two roots then the complex plane is equally
divided into two regions. So with this knowledge we expect that something similar
happens with the function f (z) = z 3 − z. That the complex plane will be divided
in three regions where iterates of initial points in each region converge to one of the
three roots. However as we can see in figure 13a this does not happen.
19
(a) Basins of attraction for the roots z = (b) Basins of attraction with time of con-
−1 in blue, z = 0 in red and z = 1 in vergence, where darker shades indicate
orange. more iterations.
Or rather not entirely. Roughly you can say that there are indeed three regions
however along the border Newton’s method behaves differently. The cause for this
behavior is the symmetry in the function. When only using real number as initial
points the basins of attraction were split into three regions. However at the bor-
der of these regions, which are the intervals (− √13 , − √15 ) and ( √15 , √13 ), Newton’s
method behaved differently. We found that in these intervals the basins of attrac-
tion alternated between B(−1) and B(1) indefinitely. From figure 14 we can see
this happening as well in the complex plane. In figure 13b we can see how many
iteration it takes for Newton’s method to convergence to that particular root. The
lighter the color means that there are less iteration needed. From this we can see
that it takes more iterations for Newton’s method to converge to each root when
the initial guess is close a boundary.
20
(a) Closeup of figure 13. (b) Closeup of figure 14a
Figure 14: Closeup of the region (− √13 , − √15 ), where you can see a fractal pattern
emerging.
21
Figure 15: Newton basin for f (z) = z 3 + 1.
By taking a closeup we can see in figure 16 that the fractal pattern continues.
We can explain this behavior by looking back closely at what happened in section
2. There we had that the boundaries of B(1) and B(−1) were equal since the
boundary for both was the imaginary axis. From [5] we have that this is the case
here as well. However since there are three roots in this case we get that each point
where two of the basins meet the third does as well. So each point is a tri-border
area. We can illustrate this with the following problem. You are asked to color a
square completely with three colors. And are given the following condition: when
two colors meet all of them meet. So then it is impossible to draw a clear boundary
between those colors as you cannot draw any straight lines. The solution for this
coloring problem can be seen in figure 15. This is what causes the fractal pattern
to emerge.
22
3.2 Fourth degree polynomials
Now let’s look at a function that has four real roots and see if this has similar
dynamics as a function with three real roots. The polynomials f (z) = z 4 − 5z 2 + 4
has four roots namely z = −2, z = −1, z = 1 and z = 2. In figure 17 we can see
that the left and the right boundary look similar to the boundaries of the function
f (z) = z 3 − z. Only now there is an extra boundary along the imaginary axis
which has similar behavior as the other boundaries. For all of the boundaries we
get alternating basins of attraction which keep getting smaller and this repeats itself
indefinitely.
(c) Closeup around left boundary. (d) Closeup around right boundary.
Complex roots
The function f (z) = z 4 + 1, which has complex roots has the same pattern as a
cubic function with complex roots the only difference is that it is split in four as can
be seen in figure 18.
23
Figure 18: Newton basin for f (z) = z 4 + 1.
24
have some bigger circles and within those circles are even smaller circles. This con-
tinues indefinitely where the circles keep getting smaller and smaller. In figure 20b
you can see a black circle, which indicates that Newton’s method does not converge.
This is not the case Newton’s method does converge only it converges to the roots
that are further away from z = 0. And because this figure was drawn using 10
roots we can only see when Newton’s method converges to these roots. Furthermore
along the boundary of each of the circles there are more smaller circles and this also
continues indefinitely.
We can explain this behavior by looking at what happens on the real line. Let’s
look at the boundary between the roots z = − π2 and z = π2 as seen in figure 20b.
The boundary is at z = 0, which corresponds to the value of a critical point of the
function f (z) = cos z. When we choose an positive initial point close to this critical
point we get a large positive value as the next iteration point. And this iteration
point is in the basin of attraction of the root that it is close to. Depending on the
tangent line at that point we can end up in the basin of attraction of any root, which
can be seen in figure 21a and in figure 21b.
25
(a) First iteration point of Newton’s (b) First iteration point of Newton’s
method is in B( 3π
2 ). method is in B( 5π
2 ).
This explains the bigger circles in figure 20b. However instead of immediately ending
up in the basin of attraction of a root we could also end up at a critical point at
this point Newton’s method fails. Or since the function is symmetric we could end
up in a cycle. These points are the boundary between the circles as seen in figure
20b. Or we could en up close to the critical point, which means the next iteration
point could end up in any of the basin of attraction of any root as seen in figure 21c.
This explains the smaller circles on the boundary of the bigger circles. Of course
this behavior repeats itself so if we would zoom in on those circles we would find
even smaller circles at the boundary of these circles.
26
4 Variations of Newton’s method
Over the years a lot of variations of Newton’s method have been made. The relaxed
Newton’s method is one of these variations. It improves the convergence of Newton’s
method for roots that have an order higher than one. To a convergence that is
quadratic as Newton’s method has a liner convergence for roots that have an order
higher than one [7]. Furthermore we will look at the secant method, which can be
considered a variation of Newton’s method if we use Newton’s method to determine
the second initial point.
mf (z)
Nm (z) = z − .
f 0 (z)
27
(a) Relaxed Newton’s method with (b) Relaxed Newton’s method with
m = 0.5. m = 1 (Newton’s method).
When we look at the number of iterations it takes for the Relaxed Newton’s method
and Newton’s method to converge, which can be seen in figure 23. We can see that
when m = 1.9 that the number of iterations have increased a lot in comparison with
Newton’s method. When looking at figure 22a we can see that this corresponds
to the more complicated fractal. And choosing m = 0.5 the amount of iterations
needed for convergence are less than using m = 1.9 however it is still more than
using m = 1.
28
(a) Relaxed Newton’s method with (b) Relaxed Newton’s method with m = 1.9.
m = 0.5.
29
(a) Relaxed Newton’s method with (b) Relaxed Newton’s method with
m = 2. m = 3.
Since we have roots of order 2 the relaxed Newton’s method converges faster than
Newton’s method, which can be seen in figure 25. However choosing a higher value
for m does not increase the amount of iterations needed in comparison with a lower
value of m. As was the case for the roots that had an order of 1.
30
(a) Newton’s method (m = 1). (b) Relaxed Newton’s method
with m = 2.
Figure 25: Number of iterations needed for the basin of f (z) = (z−i)2 (z+i)2 (z−1)2 .
31
(a) Using 10 iterations. (b) Using 5100 iterations.
Figure 26: The relaxed Newton’s method applied to f (z) = z(z − 1)(z + 1)2 , where
the tolerance=0.01.
f (x1 )(x1 − x0 )
x2 = x1 − .
f (x1 ) − f (x0 )
Then we use the second step again only this time using the points x1 and x2 as the
initial points. The iteration stops when |xn − xn+1 | < tolerance, where the tolerance
is predetermined. See figure 27 for a visualization of the first few iterations.
32
Figure 27: First few iterations of the Secant method for the function f (x) = x2 − 1
Figure 28: Secant basin for f (x) = x2 − 1, where black indicates that the method
does not converge to a root.
We can see that the two lines y = x and −y = −x do not converge, which is because
in those cases the initial values x0 and x1 are equal and in that case we can’t draw
a line between those two points.
33
4.2.1 Newton secant
Although we cannot determine the behavior of the Secant method in the complex
plane with all possible initial points x0 and x1 . We can still see what happens in
the complex plane by only using the initial value x0 for drawing the figure and then
determine x1 with Newton’s method. And then continuing with the Secant method
in order to determine the rest of the iterations points. The Secant basin for the
function f (z) = z 3 + 1 can be seen in figure 29a. Comparing this to the Newton
basin in figure 29b we can see that the place of the boundaries are the same only
the fractal patterns are different. Also with the Secant method we do not converge
to a root in some areas. As we seem to only increase the area of the boundary and
have a lot of areas where the secant method fails it is not useful to use the secant
method for this function.
34
(a) Secant method with d = 0.5. (b) Secant method with d = 10.
35
5 Conclusion
So we found that if a polynomial has two roots we can still clearly define the bound-
ary between the basins of attraction. However when we increase the number of roots
this is impossible because of the fractal patterns that emerge. This is because of
of the property that the boundaries of the basins of attraction are the same [5].
For three roots this means that for any point where two of the basins of the roots
meet the third basin does as well. For trigonometric functions the boundaries are
not clearly defined either. This happened because they have an infinite amount of
roots and because of repeating structure of the function. Furthermore we found
that the relaxed Newton’s method and the Secant method have different dynamics
than Newton’s method. Although the boundaries between the basin of attraction
are around the same position the fractal patterns at these boundaries are different.
And by choosing a lower value of m when using the relaxed Newton’s method we
can make the area of the boundary smaller. Finally the Secant method had large
areas for when the method does not converge to a root.
36
6 References
[1] Philip D. Straffin JR. Newtons Method and Fractal Patterns. UMAP Modules:
Tools for Teaching 1991.
[4] M. Szyszkowicz. Computer art generated by the method of secants in the complex
plane. Computers & graphics, volume 14, issue 3-5, 1990.
[5] H. O. Peitgen, D. Saupe, and F. V. Haesler Cayley’s Problem and Julia Sets.
The Mathematical Intelligencer, Volume 6, Issue 2, 1984.
[7] F.V. Haeseler and H.O. Peitgen, Newton’s method and complex dynamical sys-
tems, Acta Appl. Math. Volume 13, 3-58, 1998.
37
7 Appendix: Matlab code
Main.m
clearvars
% Functions
f = @(z)zˆ3+1;
df = @(z)3*zˆ2;
% Roots
root1 = −1;
root2 = (−1)ˆ(1/3);
root3 = −(−1)ˆ(2/3);
root4 = −1.5*pi;
root5 = −0.5*pi;
% Determines the roots with one of the root finding methods for all of
% the initial points.
[C,I] = Figure( f, df, tol,maxIt,reL,reR,imD,imU,stepSize, root1,...
root2,root3,root4,root5,0,method,m,d);
38
Figure.m
39
%Determines which root has been calculated
if abs(rootCalc − root1) <= tol
c = 6;
40
newton.m
Code for Newton’s method.
for k=1:maxIt
% create new x
xNew=x−(f(x)/df(x));
% update solution
update = xNew − x;
x = xNew;
% check convergence
if convHist(k) < tol
flag = 0;
break
end
end
root = x;
41
newtonRelaxed.m
Code for the relaxed Newton method.
for k=1:maxIt
% create new x
xNew=x−m*(f(x)/df(x));
% update solution
update = xNew − x;
x = xNew;
% check convergence
if convHist(k) < tol
flag = 0;
break
end
end
root = x;
42
secantN.m
Code for the Secant method using Newton’s method to determine x1 .
for k=1:maxIt
x0 = x1;
x1 = x2;
x2 = (x0*f(x1) − x1*f(x0))/(f(x1) − f(x0));
update = f(x2);
% check convergence
if convHist(k) < tol
flag = 0;
break
end
end
root = x2;
end
43
secant.m
Code for the Secant method where x0 is determined by x1 .
for k=1:maxIt
x0 = x1;
x1 = x2;
x2 = (x0*f(x1) − x1*f(x0))/(f(x1) − f(x0));
update = f(x2);
% check convergence
if convHist(k) < tol
flag = 0;
break
end
end
root = x2;
end
44