Numerics Chapter 3
Numerics Chapter 3
Roots of Equations
Zeros of a Function
Let f(x) be a real-valued function of a real variable.
A number r that satisfies an equation is called a
Any number r for which f(r)=0 is called a zero of
root of the equation.
the function.
The equation :x 4 3x3 7x 2 15x 18
has four roots: 2, 3, 3, and 1. Examples:
2 and 3 are zeros of the function f(x) = (x-2)(x-3).
i.e., x 4 3x 3 7x 2 15x 18 (x 2)(x 3)2 (x 1)
The equation has two simple roots(-1 and
-2) and a repeated root (3) with
multiplicity = 2.
Eyob. A 2021/22 13
3 Eyob. A 2021/22 14
4
2/7/2022
Eyob. A 2021/22 15
5 Eyob. A 2021/22 16
6
f (x) x 12
Eyob. A 2021/22 17
7 Eyob. A 2021/22 18
8
2/7/2022
Eyob. A 2021/22 19
11 Eyob. A 2021/22 10
Solve ex
b b 4ac
2
2 Root
roots x
2a xe x
1
Can you solve the roots the following The root[0,1]
equations? root 0.6
x e x 0 No analytical solution
1 2
zeros.
a b
a b
The function has three real
The function has no real zeros zeros
Example 2 Example 3
Can you use Bisection method to find a
zero of :
Can you use Bisection method to find a zero of :
Answer:
Answer:
f (x) is continuous on [0,1] and f(0)*
f (x) is continuous on [0,2] and
f(1) (1)(-1) 1 0
f(0)*f(2) (1)(3) 3 0
Assumptions are satisfied
Assumptions are not satisfied
Bisection method can be used
Bisection method can not be used
Eyob. A 2021/22 30
27 Eyob. A 2021/22 28
2/7/2022
Best Estimate and Error Level Best Estimate and Error Level
Bisection method obtains an interval that is The best estimate of the zero of the function
guaranteed to contain a zero of the function. f(x) after the first iteration of the Bisection
method is the mid point of the initial interval:
Questions:
• What is the best estimate of the zero of f(x)? b a
• What is the error level in the obtained estimate? Estimate of the zero: r
2
ba
Error
2
Example 4 Example 5
Bisection Method
Initial Interval
Eyob.
5/12/2016
A 2021/22 40
37 Eyob. A 2021/22 38
Summary Example 6
• Initial interval containing the root: [0.5,0.9] Find the root of:
B. Newton-Raphson Method
Derivation
Given an initial guess of the root x0, Newton-
Raphson method uses information about the • Newton’s method is the classic algorithm for
function and its derivative at that point to find finding roots of functions.
a better guess of the root.
• Two good derivations of Newton’s method:
Assumptions: – Geometric derivation
– f(x) is continuous and the first derivative is – Analytic derivation
known
– An initial guess x0 such that f’(x0)≠0 is given
Eyob. A 2021/22 51
47 Eyob. A 2021/22 52
48
2/7/2022
Example Example
Find a zero of the function f(x) x3 2x 2 x 3, x0 4 n (Iteration) xn f(xn) f’(xn) xn+1 |xn+1 –xn|
0 4 33 33 3 1
f '(x) 3x 2 4x1
f (x 0 ) 33
Iteration1: x1 x0 4 3 1 3 9 16 2.4375 0.5625
f '(x 0 ) 33
f (x1) 9
Iteration 2 : x2 x1 3 2.4375 2 2.4375 2.0369 9.0742 2.2130 0.2245
f '(x 1 ) 16
f (x 2 ) 2.0369 3 2.2130 0.2564 6.8404 2.1756 0.0384
Iteration 3 : x3 x2 2.4375 2.2130
f '(x 2 ) 9.0742
Iterate the until the difference between consecutive 4 2.1756 0.0065 6.4969 2.1746 0.0010
• 2 = 1.4142135623730950488016887242097
• Let x0 be one and apply Newton’smethod.
f(x)=x2-2 f (x) 2x
xi 2 2 1 2
xi1 xi xi
2xi 2 xi
x0 1
x1 1 1.5000000000
1 2 3
2 1 2
x2
1 3 4 17
1.4166666667
2 2 3 12
Eyob. A 2021/22 53 Eyob. A 2021/22 54
Eyob. A 2021/22 63
57 Eyob. A 2021/22 58
Initial value
Wrong predictions,
because the root is
positive
x0 x1=x3=x5
x0=x2=x4
Assumptions :
Two initial points xi and xi1 such that
f (x i ) f (xi1 )
New estimate(SecantMethod):
xi1 xi
f (xi )
xi f (xi )
(xi xi1 ) (xi xi1 )
f (xi ) f (xi1 ) f (xi ) f (xi1 ) xi1 xi f (xi )
(xi xi1 )
f (xi ) f (xi1 )
Example Example
50
x(i) f(x(i)) x(i+1) |x(i+1)-x(i)|
40 -1.0000 1.0000 -1.1000 0.1000
Find theroots of
30
: f (x) x5 x3 3 20
-1.1000 0.0585 -1.1062 0. 0062
Initial points 10
-1.1062 0.0102 -1.1052 0.0009
x0 1 and x1 1.1 0
-30
-40
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
x2 = 2y + 10 y = x2 + 3
Solutions Of Systems Of 3x – y = 9 x2 + y 2 = 9
Non-Linear Equations
Solution
Steps 3 and 4 Add equations and solve for the remaining variable.
4x 2 y2 13 Solution
Add.
-x 2 - y 2 -10
3x 2 3 Step 6 Check. The solution set of the given system is
x2 1
{(1, 3), (1, -3), (-1, 3), (-1, -3)}.
x 1
Step 5 Back-substitute and find the values for the other variables. We
must back-substitute each value of x into either one of the original equations.
7
Let's use x2 + y2 = 10, Equation 2. If x =1, 6 4x2 + y2 = 13
- 5 -4 -3 - 2 - 1
(1, 3) and (1, -3) are solutions. If x = -1, -1
-2
1 2 34 5 67
Solution
Add.
x2 + y2 = 9
y + y = 12
2
This is Equation 2.
Add the equations. -4 = x2 + 3 Subtract 3 from both sides.
-7 = x2
Exercises
Solution
Because the square of a real number cannot be negative, the equation x 2 y 0 y x2 5
x2 = -7 does not have real-number solutions. Thus, we move on to our Solve: 1. 3. 2
x 1 y 1 5
2 2
other value for y, 3, and substitute this value into Equation 1. x y 25
2
y = x2 +3 This is Equation 1. 7
6
3 = x2 +3 Back-substitute 3 for y.
3x2 2 y2 35
5
4
y = x2 + 3
0 = x2 Subtract 3 from both sides. (0, 3)