# A-level Mathematics/OCR/C3/Numerical Methods
## Finding Roots of an Equation

In this module we will explore approximating where an equation has a root. Below we have two graphs.

### Finding A Root Using a Graph

In the graph we have two functions. If we want to approximate where the roots are we have to look at where the function cross the x-axis. The lilac function crosses the x-axis somewhere between 2.05 and 2.25. The green function has roots around 1 and 3.5. If we want to know where the green function is equivalent to the lilac function we need to look at the graph. When the two graphs cross they are equivalent. This number will be the root. In this case it is around 1.75. We can also say that on this domain, the functions will only cross once.

### Finding A Root By Searching for A Sign Change

When a function has a root the value of the function will change from a positive value to a negative value or vice versa. If below is the table of values for the lilac function we can say that the root occurs between 2.05 and 2.10:
| x | f(x) |
| 2 | -1 |
| 2.05 | -.4849 |
| 2.1 | .061 |
| 2.15 | .63838 |
| 2.2 | 1.248 |
| 2.25 | 1.08906 |

## Iterative Formulae

An iterative formula is a formula that is composed of itself. That is the output of the function is the next input of the function. $x_{n+1}=F(n)$. These functions are a sequence of approximations that usually converge to the value of a function. You can tell if a function converges by the fact that the outputs become closer and closer to each other, if this does not happen then the function diverges and there is no value. The output of an iterative formula is written as:
    $x_{2}\,$
    $x_{3}\,$
    $x_{4}\,$
The first x is provided for you. The output of the iterative formula is written as the Greek letter alpha: α. α can be found to the required degree of accuracy when $x_{n}=x_{n+1}$ to the required number of decimal places. Given an iterative function you can find the root of an equation. Also you find the function from a given iterative function by setting x = iterative function, then solving so that you have a zero on one side. The aforementioned process can be done in reverse.

### Example

Given the sequence that is defined by the iterative formula $\left(2x+5\right)^{\frac {1}{3}}$ with $x_{1}=2$ converges to $\alpha$
* Find $\alpha$ correct to 4 decimal places.
* Find equation that has $\alpha$ as a root.
* Does the equation have any more roots?
With an iterative formula we have:
* We plug in $x_{1}$ to get $x_{2}$ and so on
** $x_{2}=\left(2\times (2)+5\right)^{\frac {1}{3}}=2.0801$
** $x_{3}=\left(2\times (2.0801)+5\right)^{\frac {1}{3}}=2.0924$
** $x_{4}=\left(2\times (2.0924)+5\right)^{\frac {1}{3}}=2.0942$
** $x_{5}=\left(2\times (2.0942)+5\right)^{\frac {1}{3}}=2.0945$
** $x_{6}=\left(2\times (2.0945)+5\right)^{\frac {1}{3}}=2.0945$
** $\alpha =2.0945\,$
* $x=\left(2x+5\right)^{\frac {1}{3}}$
** $x^{3}=2x+5\,$
** $x^{3}-2x-5=0\,$
* To determine if the function has any roots just graph the graph of the highest power of x and then the rest. The number of times they cross is the number of roots you have.
** If we plot $y=x^{3}$ and $y=2x+5$ we can see that they only cross once.
** The function only has one root.

## Simpson's Rule for Area

To find the area beneath a curve we have already learned the trapezium rule. The trapezium rule is not very accurate it takes a very large number of trapezoids to get an very accurate area. The Simpson rule is much more accurate to find the area underneath a curve. Simpson's Rule states:
$\int _{a}^{b}ydx\approx {\frac {1}{3}}h\left\{\left(y_{0}+y_{n}\right)+4\left(y_{1}+y_{3}+\ldots +y_{n-1}\right)+2\left(y_{2}+y_{4}+\ldots +y_{n-2}\right)\right\}$
where$h={\frac {b-a}{n}}$ and n is even

#### Example

Use Simpson's Rule to evaluate $\int _{1}^{5}x^{2}+2x\,dx$ with h = 1.
$\int _{1}^{5}x^{2}+2x\,dx\approx {\frac {1}{3}}\left[\left(1^{2}+2\times 1\right)+4\left(2^{2}+2\times 2\right)+2\left(3^{2}+2\times 3\right)+4\left(4^{2}+2\times 4\right)+\left(5^{2}+2\times 5\right)\right]$
$\int _{1}^{5}x^{2}+2x\,dx=65{\frac {1}{3}}$
The area under the curve $x^{2}+2x\,$is equal to $65{\frac {1}{3}}$.
This is the true value. If we compare it to the value of 66 that we trapezium rule and to the value of 65 that we got from the midpoint rule we can see that Simpson's rule is the most accurate.
This is part of the C3 (Core Mathematics 3) module of the A-level Mathematics text.
Algebraic Functions / Special Functions and Transformations / More Trigonometric Functions and Identities / Differentiation / Integration / Numerical Methods / Appendix A: Formulae