### Numerical Methods - Iteration for GCSE 9-1 and A-Level C3

In this tutorial, you will learn:

- How to find a range of the variable, x, where a root - or a solution - of a function could exist in
- How to turn a function into an
*iterative*form - How to use
**iteration**to find a specific root - or a solution

### Finding a range for a root by change in sign method

If f(x) is a function and it changes its sign from +ve to -ve or vice versa in a certain range of x, then a root of the function exists within the same range. The following image shows it:

**E.g.1**Find a range of x in which a root for f(x) = x^{2} -x -3 exists.

f(x) = x^{2} -x -3

f(2) = 4 - 2 - 3 = -1 => -ve

f(3) = 9 - 2 - 3 = 4 => +ve

Since there is a chagne in sign in the range, 2≤ x ≤3, a root of the function exists in the same range.

### Exceptions

Sometimes, there is not a change in sign, yet there will be a root in a particular region. On the other hand, a change in sign does not necessarily indicate the existance of a root within a range. The following images illustrate this:

### Iteration

If f(x) = 0 and it can be rearranged in such a way that x = g(x), where both f(x) and g(x) are functions of x, **x = g(x)** is said to be in **iterative** form.

**E.g.**

x^{2} - x - 6 = 0

Let's make 'x' the subject of this equation; there are three possibilities:

- x = √(6 + x)
- x = x
^{2}- 6 - x = 1 + 6 / x

In the above iterations, g(x) = √(6 + x) or g(x) = x^{2}- 6 or g(x) = 1 + 6 / x.

When the above equation - x^{2} -x - 6 = 0 - is written in one of the above forms
with 'x' being the subject, they are said to be in an iterative form. That means, when the a value is substituted
for 'x' on the right hand side the value of 'x' on the left can be obtained.
Then the latter is put back in the equation to generate the other value. This
goes on until, x **approaches** a **constant** value. This
value is taken as a solution. Therefore, the actual iterative formula takes the following form, depending on the
rearrangement.

- x
_{n+1}= √(6 + x_{n}) - x
_{n+1}= x_{n2}- 6 - x
_{n+1}= 1 + 6/x_{n}

The first value of x - x_{0} - is taken from a range of possibilities - guesses. Now let's solve one of the
above equations using iteration.

**x _{n+1} = √(6 + x_{n})**

First, guess a range where a solution could exist. Press the button and it will provide you with one.

Now fill in the value of 'x_{0}' from one of the value you get and press the iterate button to find the solution:

x_{0}=

Have you noticed the way 'x' values approach the solution?; the longer you go the better.You can now see the beauty of iteration; it helps us find the root of an a function; since we have different forms of iteration, we can use some of them to find all the roots.

Have you noticed the
way 'x' values approach the solution? The longer you go the better. You can now see the
**beauty of iteration**; it helps us to find the solution of an equation; since we
have different forms of iteration, we can use each one of them to find some of the roots, if not all.

Of course, in this simple example, a quadratic function was used for illustration. Iteration is generally used for higher polynomials such as cubic functions and more complex functions.

**E.g.**

Find a root of the function, x^{3} + 4x - 3 by iteration.

f(x) = x^{3} + 4x - 3

f(0) = -3; f(1) = 2 => There is a change in sign between x = 0 and x = 1; therefore, a root could exist in the range.

Now, let's make the iterative formuala.

x^{3} + 4x - 3 = 0

x = (3 - x^{3})/4

x_{n+1} = (3 - x_{n}^{3})/4

Let x_{0}, the initial value = 0.

x_{1} = 0.5

x_{2} = 0.71875

x_{3} = 0.65717

x_{4} = 0.67904

x_{5} = 0.67172

x_{6} = 0.67422

x_{7} = 0.673377...

So, the root is approximately, x = 0.673 (3 d.p.).

### Iteration with Microsoft Excel

The following animation shows how to use Microsoft Excel in finding a root of a function by iteration.

**E.g.**

Find a root of the function, f(x) = x^{3} + 3x - 5 by iteration.

x_{n+1} = (5 - x_{n}^{3})/3

f(1) = -1 => -ve; f(2) = 9 => +ve;

So, there must be a root between x = 1 and x = 2. The iteration will find it.

Let x_{0} = 1.

As you can see, x = 1.67 is a root to 2 d.p.

**Practice is the key to mastering maths; please visit this page, for more worksheets.**

Please work out the following questions to complement what you have just learnt.

- Rearrange x
^{2}- 8x + 4 =0 in the form of x_{n+1}= 8 - 5/x_{n}and find the solution, correct to three significant figures - Rearrange x
^{3}- 5x^{2}- 18 = 0 in the form of x_{n+1}= 18 / x_{n2}+ 5 and find the solution, correct to three significant figures - Solve x
^{2}- 5x + 6 =0, using x = 2.5 as the initial value.

You can experiment with iteration here: change the value of **x _{0}** in

**x-nought**and the

**number of iterations**in

**no_iterations**and experiment with it.