Roots: Open Methods: Solving Equations Numerically
Roots: Open Methods: Solving Equations Numerically
The values calculated with Eq. (PT2.1) are called the “roots” of Eq. (PT2.2). They represent
the values of x that make Eq. (PT2.2) equal to zero. Thus, we can defi ne the root of an
4
y=3+4x -x
equation as the value of x that makes f ( x ) 5 0. For this reason, roots are sometimes
called the zeros of the equation. Although the quadratic formula is handy for solving Eq.
(PT2.2), there are many other functions for which the root cannot be determined so easily.
For these cases, the numerical methods described
1.5
0.5
x
1 2
Therefore there is a root (solution) to the equation 3 + 4 x − x 4 = 0 between x=1 and x=2.
If we want a better approximation we can narrow down the interval.
Let f ( x) = 3 + 4 x − x 4
then f (1) = 3 + 4 − 1 = 6 > 0
and f (2) = 3 + 8 − 16 = −5 < 0
therefore there is a root in the interval x=1 to x=2 y
0.6
0.4
0.2
x
1 1.5 2 2.5
-0.2
f (1.8) = - 0.2976 < 0 the root lies between 1.75 and 1.8
1.75 x 1.8
the root is 1.8 to 1 d.p
Example 2. Show that the equation ln(1 + x) − e − x − 1 = 0 has a root between x=1.5 and
x=2.5.
Find this root to 1 d.p.
Solution
Let f ( x) = ln(1 + x) − e − x − 1
f (1.5) = - 0.306 < 0
f (2.5) = 0.171 > 0 the root lies between 1.5 and
2.5
f (2.0) = - 0.0367 < 0 the root lies between 2.0 and
2.5
f ( 2.25) = 0.0732 > 0 the root lies between 2.0 and
2.25
f ( 2.1) = 0.009 > 0 the root lies between 2.0 and
2.1
f (2.05) = <0 the root lies between 2.05 and
2.1
2.05 x 2.1
the root is 2.1 to 1 d.p
Exercise
1. Show that x 3 = 14 has a root between 2 and 3. Find this root to 1dp.
2. Show that 2 x = 8 x has 2 roots, the first lying between 0 and 1 and the second
between 5 and 6. Find both of the roots to 1dp.
Answers
1. Let f ( x) = x 3 − 14
f (2) = 2 3 − 14 < 0
f (3) = 33 − 14 > 0 therefore root lies between 2 and 3
2.4 x 2.45
the root is 2.4 to 1 dp
2. Show that 2 x = 8 x has 2 roots, the first lying between 0 and 1 and the second
between 5 and 6. Find both of the roots to 1dp.
Let f ( x) = 2 x − 8 x
f (0) = 1 – 0 > 0
f(1) = 2 – 8 < 0 the root lies between 0 and 1
f(0.5) <0 the root lies between 0 and 0.5
f(0.25) <0 the root lies between 0 and0.25
f(0.1) > 0 the root lies between 0.1 and 0.25
f(0.2) < 0 the root lies between 0.1 and 0.2
f(0.15) <0 the root lies between 0 and 0.15
5.4 x 5.45
Example 1
Consider the equation x 2 − 5x + 2 = 0
y
15
10
y=x2 - 5x +2
5
x
-4 -2 2 4 6 8
-5
-10
Similarly
f(4) = 42 – 5(4) + 2 = -2 < 0
f(5) = 52 – 5(5) + 2 = 2 > 0
f(x) must be 0 between 4 and 5 and so the other solution lies between 4 and 5
we can now use this to get a sequence of solutions which get closer and closer to the root.
x = 4.56 to 2 dp
To find the other root, we need to re-arrange the equation x 2 − 5 x + 2 = 0 in a different way:
xn + 2
2
Let’s try x n +1 =
5
Let x0 = 4
then x1 =3.6
x2 =2.992
x3 = 2.1904128
x4 = 1.359581647
x5 = 0.76969245
x6 = 0.518485293
x7 = 0.4537654
x8 = 0.441180607
x9 = 0.438928065
x10 = 0.438531569
So how we arrange the equation and the starting value we choose can lead us to different
roots
x2 + 2
5x = x + 2
2
x = gives x = 0.44 (to 2 dp) ie the smaller root
5
2
Or x 2 = 5x − 2 x = 5− gives x = 4.56 to 2 dp
x
−2
Or x ( x − 5) = −2 x = gives x = 0.44 (to 2 dp) ie the smaller root
x−5
Some of the iteration formulae lead to the first root and some to the second root
Generally, when an equation has two or more roots, a single arrangement will not find them
all.
Each iteration formula may give only one root, so that for an equation with 3 roots, you may
need 3 iteration formulae, and so on.
Starting points for iteration
It saves time if you can use a starting point which is close to the root.
To do this, find an interval in which a root lies. That is find two values a and b such that
if f (a ) > 0 then f (b) < 0
The method converges for |g′(x)| < 1
Example 2
x n +1 = 2 + ln x n
x0 = 3
x1 = 3.098612289
x2 = 3.130954361
x3 = 3.141337866
x4 = 3.144648781
x5 = 3.145702209
x6 = 3.146037143
x7 = 3.146433611
x8 = 3.146177452
x9 = 3.146188209
x = 3.15 to 3 s.f.
http://www.youtube.com/watch?v=OLqdJMjzib8
Exercise
1. Show that the equation x 3 − x − 2 = 0 has a root between 1 and 2, and can be arranged in
the form x = 3 x + 2 .