<<

Complex Roots of Polynomials

1 Introduction

Newton Fractals are a beautiful consequence of studying roots of polynomials, namely complex roots, and applying numerical methods like the Newton method to nd them.

Introducing Newton Fractals to learners can be a great way to motivate the study of polynomials, complex numbers and numerical methods like the Newton method.

2 Complex Polynomials

A polynomial of degree n is a function of the form

n n−1 p(x) = anx + an−1x + ··· + a1x + a0

2 where an 6= 0. Quadratics, for example 2x + 3x − 2, are polynomials of degree 2. We can extend this idea to polynomials with complex coecients and a complex variable √ z = x + iy. (Recall i = −1.) Denition 2.1. A polynomial with complex coecients is a function of the form

n n−1 p(z) = anz + an−1z + ··· + a1z + a0 where , , and is a complex variable. If , then is the aj ∈ C j = 0, 1, . . . , n z an 6= 0 n degree of p(z). (The degree is essentially the highest power n of the polynomial.)

1 Example Below are some examples of polynomials with complex coecients of a complex variable z:

(a) z2 + (8 + i)z + 4,

(b) z16 − 64,

(c) 147, √ (d) (7 − 8i)z3 − (4 + 4i)z2 − 17,

(e) z − 1. What is the degree of each of these polynomials?

Solution.

(a) The degree of this polynomial is 2, this is a quadratic polynomial.

(b) The degree of this polynomial is 16.

(c) The degree of this polynomial is 0, this is a constant polynomial.

(d) The degree of this polynomial is 3, this is a cubic polynomial.

(e) The degree of this polynomial is 1, this is a quadratic polynomial.

2.1 Roots of Complex Polynomials Let's introduce the following denition.

n n−1 Denition 2.2. Let p(z) = anz + an−1z + ··· + a1z + a0 be a polynomial of degree n ≥ 1. A complex number r ∈ C is called a root of p(z), if p(r) = 0. Finding roots of polynomials is a long-standing problem in mathematics and this is tes- tament to the fact that algebra meant essentially theory of polynomial equations up until the 19th century. Finding the root of a linear polynomial (degree 1) is rather trivial, b p(z) = az + b = 0 ⇒ z = − a You are probably also familiar with nding roots of quadratic polynomials, either by factorisation or the quadratic formula, √ −b ± b2 − 4ac p(z) = az2 + bz + c = 0 ⇒ z = 2a An important (fundamental) result in algebra is known as the Fundamental Theorem of Algebra. We shall state here without proof.

2 Theorem 2.1 (Fundamental Theorem of Algebra). Let p(z) be a polynomial of degree n ≥ 1. Then p(z) always has a root r ∈ C. This theorem states that a root always exists for a polynomial of degree greater or equal to one. The theorem however does not give us a method or algorithm to nd a root. Applying the Fundamental Theorem of Algebra repeatedly we can obtain the following result.

Corollary 2.1. Let p(z) be a polynomial of degree n ≥ 1. Then there exists complex numbers , such that z1, z2, . . . , zn ∈ C

p(z) = an(z − z1)(z − z2) ··· (z − zn).

This corollary tells us that for any polynomial of degree n there are n roots. These root are in general complex and therefore may not be real. For example z1, z2, . . . , zn ∈ C z3 − 1 only has one real root z = 1, but Corollary 2.1 guarantees the existence of three roots in C. Let's investigate this with the following example. Example

Find the three roots of z3 − 1.

Solution. We know one root is z1 = 1 therefore, by Corollary 2.1 we can write the polynomial in the form,

(z − 1)(az2 + bz + c) = az3 + (b − a)z2 + (c − b)z − c = z3 − 1

equating coecients,

a = 1, b − a = 0, c − b = 0, c = 1,

hence a = 1, b = 1, c = 1, and z3 − 1 = (z − 1)(z2 + z + 1) using the quadratic formula to obtain the roots of z2 + z + 1, √ √ −1 ± −3 −1 ± i 3 √ z = = , where i = −1. 2 2 Therefore, the three complex roots of z3 − 1 are, √ √ 1 3 1 3 z = 1, z = − + i , z = − − i 1 2 2 2 3 2 2

We can plot the three roots of z3 − 1 are an Argand Diagram which is a representation of the complex numbers on a two-dimensional plane where the x-axis refers to the real part and the y-axis refers to the imaginary part of the complex number z = x+iy denoted Re{z} = x and Im{z} = y. Below is an illustration of the Complex Plane (Argand Diagram) where we have identied the locations of the roots of z3 − 1.

3 Im{z}

1.5i

√ 1 3 1i z = − + i 2 2 2

0.5i

−1.5 −1 −0.5 0.5 1 1.5 Re{z}

z1 = 1

−0.5i √ 1 3 z = − − i 3 2 2 −1i

−1.5i

2.2 Newton's Root Finding Method

For polynomials of degree 3 and 4 solutions to the root nding problem can be found in general but this is too complicated for our purposes (but still worthy of investigation). For polynomials of degree 5 or higher there is in general no method to acquire the roots exactly. So, except for low degrees, root nding of polynomials consists of nding approximations of the roots using numerical methods. What we mean by numerical method is the an algorithm that given an initial guess at the root say z0 the method would then give us a new and improved approximation to the root say z1, we can then use z1 and the method will produce a further improvement to our approximation say z2. One numerical method which has this feature is called Newton's method and is described by the following recurrence relation, f(zn) zn+1 = zn − 0 f (zn) Newton's method uses the function in question f(z) and also it's derivative f 0(z) to improve an approximation to the root of f(z). This method is useful in practice because of it's extremely fast convergence. The distance from the root to each approximation is roughly squared at each iteration; assuming the distance between the root and the approximation is less than 1. So, if you start with a reasonably good approximation to

4 the root the Newton method can very quickly provide an excellent approximation to the root. Let's try the Newton method out with our test polynomial we studied earlier z3 −1. Example

Use Newton's Method to nd an approximation to a root of the polynomial z3 − 1. (Experiment with dierent starting values z0.)

Solution. In this case our function f(z) = z3 − 1 and we require the derivative f 0(z) = 3z2, Newton's method can be written,

3 zn − 1 zn+1 = zn − 2 . 3zn Since we studied this polynomial earlier we know the roots already, so let's start

with an initial guess of z0 = 2 and see which root the iterative method above converges to,

3 3 z0 − 1 2 − 1 z1 = z0 − 2 = 2 − 2 = 1.416667, 3z0 3(2 ) 3 z1 − 1 z2 = z1 − 2 = 1.110534, 3z1 3 z2 − 1 z3 = z2 − 2 = 1.010637, 3z2 3 z3 − 1 z4 = z3 − 2 = 1.000112, 3z3 3 z4 − 1 z5 = z4 − 2 = 1.000000, 3z4 Working in 6 decimal places, after only 5 iterations we have acquired at least 6 −6 decimal places of accuracy in approximating the root r = 1, i.e., |z5 − r| < 10 . We can nd the other roots using Newton's method by just starting near to the corresponding root. For example if we let after iterations we obtain z0 = −1 + i 5 √ −6 z5 = −0.5 + 0.866025 which an accuracy of 10 to the root r = −1/2 + i 3/2. What starting value could we try which would make the Newton method converge z0 √ to the root r = −1/2 − i 3/2?

5 2.3 Python Programming Newton's Method All ready it is becoming a bit of a drag having to do these repeated computations by hand so how about we start using a bit of Python programming. On Canvas you can nd the complete program newton_method.py, here I will just show you the important parts of the code, highlighting where we have included the Newton method.

16 while error > Tol and count < nIteration: 17 count = count + 1 18 znew = z - (z**3-1)/(3*z**2)#newton method 19 error = abs(z - znew)#compute the error at this step 20 z = znew 21 print('{0:^6d}{1:^20.6f}'.format(count,z)) As you can see in the code above the Newton method is applied at line ##, where the variable z is the initial value and the variable znew is the new approximation after applying the Newton method. On line ## we store the new approximation znew into z and thus replace z with the new approximation value. We then print the iteration number count and this new approximation of the root, which has been stored in z, to the python console. This loop will continue to run until the error variable is no longer greater than the Tol variable which we set in the beginning of the code. (Don't worry to much about the print statement at this stage as it just looks a little complicated so that the output is well presented.) Now we have a better understanding of how the program newton_method.py works we can start experimenting with dierent starting values in the complex plane and see which root the Newton method will converge to.

5 z = complex(-1,-1)#initial starting value

6 Tol = 1.e -6#tolerance(accuracy) 7 count = 0#iteration number 8 nIteration = 50 9 error = 1#this variable will keep track of the error after each step

Let's set the initial starting value as z0 = −1 − i, which is written on line ## above using the command z = complex(-1,-1); rst and second arguments refers to the real and imaginary parts of the complex number respectively. Running the program new- ton_method.py displays the following output:

step z 0 -1.000000-1.000000j 1 -0.666667-0.833333j 2 -0.508692-0.841100j 3 -0.499330-0.866269j 4 -0.500000-0.866025j 5 -0.500000-0.866025j

As we can see, after 5 iterations (step) the program has obtained an accuracy of 10−6.

6 3 Newton Fractals

To motivate further investigation into the Newton method, let's ponder over a couple of questions:

1. Does the Newton method always converge to a root?

2. Does the Newton method always converge to the closest root to the starting value?

To try and answer these questions we could experiment with dierent starting values for the variable z in the program newton_method.py; which implements the Newton method on the polynomial z3 − 1. Doing so we can produce the following table where in the rst column we have our starting value for the Newton method z0, in the second column we indicate which root this starting value is closet to, and in the last column the nal approximation to the root which meets the tolerance set 10−6

Starting Value (z0) Closet root to z0 Final Approximation 0 neither does not converge 0.5 + 0.5i 1 1.000000 − 0.000000i 0.4 + 0.5i 1 −0.500000 + 0.866025i 0.3 + 0.5i 1 1.000000 − 0.866025i

As we can see above, for z0 = 0 the Newton method does not converge at all, this is z3−1 because in the Newton method, 0 1 , which is undened. Hence, the z1 = z0 − 2 = 3z0 0 Newton method will throw an error if z0 = 0 in this case. For the other starting values the Newton method does converge to a root of z3 − 1, but as we can see from the table above it does not always converge to the closet root we start the iterations near. In order to get a better understanding of how the Newton method behaves for dierent starting values let's create an image where each point in the image refers to a point in 3 the complex plane. For the polynomial z − 1 we will colour the starting point z0 in the complex plane red, green or blue depending on whether the Newton method converges √ √ to , 1 3 or 1 3 respectively. Doing this we obtain the image below, 1 − 2 + i 2 − 2 − i 2

7 This is image is known as the Newton for the polynomial z3 − 1. The image contains repeated copies of itself at dierent levels of magnitude which is known as self- similarity, a hallmark of a fractal. But, more than it's beautiful structure, this image also describes the way in which the Newton method behaves for dierent starting points in the complex plane. We can go further. What if we also wanted, in some way, to display on this image how quickly the Newton method converged? We could do this by adding a shading eect to the colours such that a brighter point would indicate fast convergence and a darker point would indicate slow convergence. Including shading we obtain the image below,

This has signicantly improved the image it terms of it's aesthetic value and has also provided us with information about the rate of convergence to the roots from dierent points in the complex plane. Both fractal images were generated using the python program newton_fractal_ver1.py, which can be downloaded from the Canvas page for this section. You should try to familiarise yourself with this program and then start constructing your own Newton fractals. Below are a few of my favourites.

Note the on the right contains what looks like the !!! I think this a great place to stop, ponder and enjoy what we have constructed.

8