How do I use numerical methods to find the root of the equation F(x) = 0?

  • Google+ icon
  • LinkedIn icon

Generally you will be asked to find the root of an equation of the form F(x) = 0. In my answer below I will only touch on graphical methods, but will go into deeper detail on showing that a root lays in a given interval (a,b), and using iteration to find an approximation to a root.

Firstly it is important to note here that in your course F(x) will always be chosen specifically so that this kind of process works. By this I mean that F(x) will always be a “continuous” function – this essentially means it can be drawn as a graph of y=F(x) without taking your pen off the paper (this will be important later). The notion of using graphs here is important for an intuitive understanding of what is happening. If y = F(x) = 0 for some x then the graph is crossing the line y = 0, i.e. the x-axis. It is therefore often asked of students to draw a sketch of the function before trying to find a root, because this will show you whereabouts to expect to find such a root.

We will use the same example throughout this explanation. The questions, written in exam format, will be written in Italics, my answers in bold, and explanations will be in plain text.


(a) By sketching the curves y1 = x2+1 and y2 = 4x on the same axes show that x2 – 4x +1 = 0 has 2 roots.

It’s not possible to sketch these graphs in this text box but they are straightforward to sketch yourself: the first equation is a parabola that crosses the y-axis at 1, and the second equation is a straight line through the origin of gradient 4. If you would like a more accurate picture than that you can draw by hand or you want to verify your answer, nip over to ‘Wolfram Alpha’ and type these equations separated by a semi-colon. From viewing these graphs you can see that there are two points where the graphs cross, this is no coincidence. That means there are two points at which y1 = y2 and thus there are two points at which x2 + 1 = 4x. This equation is equivalent to x2 – 4x +1 = 0, and therefore there are two values of x that satisfy this equation, these are the values that we call ‘roots’. When answering this question your explanation is more important than the graph itself and should look something like this:

Let y1 = x2+1, y2= 4x.

(Then draw the graphs)

By the graphs above, there are two points at which y1 =  y2 – therefore two values of x satisfy x2 + 1 = 4x <=> two values of x satisfy x2 – 4x +1 = 0 <=> x2 – 4x +1 = 0 has two roots.

The symbol <=> should be used only if the two statements either side of the symbol are equivalent, but it is not necessary that you use it and it will not gain you marks, but it saves you having to write more in an exam. I recommend asking your teachers (or myself) about its use if you want to learn more, especially if they’ve studied Mathematics at degree level.

(b) Verify that x2 -4x + 1 =0 has a root in the interval [3,4].

For neatness and mathematical rigour, I would recommend the following approach (this will be justified in the following discussion).

Let F(x) = x2 -4x +1.

Then F(3) = -2 < 0, and F(4) = 1 > 0.

Since F is continuous on [3,4] , F(3) < 0, F(4) > 0, there is a point x in the interval [3,4] such that F(x) = 0, i.e. there is a root of F(x) = x2 -4x +1 = 0 in the interval [3,4].

Firstly, let me explain why this answer is correct. The kernel of the argument is this: if a function F(x) can be drawn without lifting your pen from the paper, and it goes from being below the x-axis at one point x1 to above the x-axis at a point x2 (or, alternatively, from above to below) then it must cross the axis between these two points, i.e. have a point x in the interval [x1,x2] where F(x) = 0. Now, since a function is positive if it is above the x-axis and negative if it is below the x-axis then we only need to check the whether the function goes from being positive to negative (or negative to positive).

This approach to this particular question (most papers have a question almost exactly like this) is likely to maximise your marks for several reasons. Firstly, by defining the function F(x) = x2 -4x +1, we save time writing F(x) out in full,  furthermore we make our argument clear to the examiner – they now know we understand the link between a ‘change of sign’ of y = F(x) on an interval, and the existence of a root. We then only need to ‘plug- in’ x=3 and x=4 to F(x) and show that this sign change has happened, and then justify ourselves by stating that a ‘change of sign’ occurred and the function is continuous.

In an exam, the next step would be something like:

(c) Show that x2-4x + 1= 0 can be written in the form x = 4 -1/x.

You can then re-arrange the formula to get the desired result. Beware: this sometimes takes a bit of practice, I recommend doing exercises until you are confident that you can breeze this in an exam. It is totally okay to take your time and practice as long as you are ready before the exam. Try it now and check your answer against mine below.

X2 - 4x + 1 = 0 <=> x2 = 4x -1 <=> x = 4 – 1/x

Moving from equation 1 to equation 2 involves adding (4x -1) to both sides, and moving from 2 to 3 we divide through by x. A quick note: this isn’t a particularly legal move especially since x can be 0, but on the interval [3,4] this doesn’t matter, because x is not 0 on this interval. Phew. The last part of the question of course, will ask you to use iteration to find an approximation to the root:

(d) Use the iteration formula xn+1 = 4 – 1/xn to find, to 3d.p. , a root of the equation x2-4x + 1= 0. Start with x0 = 3.5

Now, just handing the solution to you here will make no sense until I have explained what is going on. You won’t be asked to do any iterative numerical calculations unless it’s a calculator paper as these methods are generally used to find roots using a computer. So, I’ll talk you through how I would approach this question and why.

Firstly, type x0 – in this case 3.5 – into your calculator and press ‘=’. Now your calculator will have saved this value as ‘Ans’ – for ‘answer’. This will save you time in an exam as typing values into formulae is an unnecessary burden. Then type ‘4 – 1/Ans’ and press ‘=’. This will give you x1 and will automatically set ‘Ans’ = x1. Now the next time you press ‘=’ you have x2 and so on. Each time you press ‘=’ write down the value on the calculator. You should see that the values are ‘converging’, which means that they are getting closer and closer to a particular value. The chances are, this value is something horrible and irrational and you will never reach it, but you can reach any degree of accuracy you wish, and in this example, we want an answer to 3.d.p. So what we shall do is find an approximation to the root using iteration, and then for rigour, verify that it is correct using the ‘change of sign’ method described above. Therefore, follow the steps above and you should achieve a list of results like below:

Let x0 = 3.5

Then, using the iterative formula, we get:

x1 = 3.714 to 3.d.p
x2  = 3.731 to 3.d.p
x3  = 3.732 to 3.d.p
x4  = 3.732 to 3.d.p

Since x3 = x4 = 3.732, we will try the interval [3.7315,3.7325]:

Let F(x) = x2 – 4x + 1. Then F(3.7315) = -0.0019  to 4.d.p and F(3.7325) = 0.0016 to 4d.p. – since F(x) changes sign on the interval [3.7315,3.7325] the root must lay in this interval and is therefore equal to 3.732 to 3.d.p.

The last point on here relies on the fact that any value in the interval [3.7315,3.7325] must round to 3.732 if rounded to 3.d.p – that is why we used this interval. So to recap:

- Use iteration until you get the same answer twice (up to the number of decimal points specified),

- Take an interval around this answer so that all values in this interval round to the value you have found by iteration,

- Use the ‘change of sign’ method to verify the root is in this interval, and;

- Finally, justify yourself by saying that if the root is in this interval, then it is equal to the value you found via iteration to the number of decimal points you were asked.

Thank you for reading my tutorial on numerical methods. It would be fantastic if you dropped me a message on here to let me know if you found it helpful, or if any part of the tutorial is unclear. I hope to hear from you in the future. 

Mathew V. A Level Maths tutor, A Level Physics tutor, A Level Further...

About the author

is an online A Level Maths tutor with MyTutor studying at Warwick University

Still stuck? Get one-to-one help from a personally interviewed subject specialist.

95% of our customers rate us

Browse tutors

We use cookies to improve your site experience. By continuing to use this website, we'll assume that you're OK with this. Dismiss