Lecture 3
Lecture 3
Graphical method
Algebraic equation
Root at 𝑥 = −1 Root at 𝑥 = −1
Transcendental equation
The solutions to the equations are points where the two lines intersect.
Root finding (graphical method)
Bisection method
𝑥$ < 𝑥%
𝑥$ + 𝑥%
𝑥& =
2
If 𝑓(𝑥$ )𝑓(𝑥& ) < 0 then the root is between [𝑥$ , 𝑥& ] otherwise the root is in between [𝑥& , 𝑥% ].
One need to continue this process, of finding the midpoints, until the condition |𝑓(𝑥& )| ≤ 𝜖,
where 𝜖 is user specified tolerance.
Example:
First, we need to find the values of 𝑥$ and 𝑥% such that 𝑓(𝑥$ )𝑓(𝑥% ) < 0.
For the above function 𝑥$ = 1 and 𝑥% = 2 satisfy this criterion. 𝑓(1)𝑓(2) = −6 < 0
Since the above function is continuous, there must be a root within the interval [1, 2]
#' !
The midpoint is 𝑥& = !
= 1.5, and 𝑓(1.5)𝑓(2) < 0. So, the root is within the interval
[1.5, 2].
Let us say the function 𝑓(𝑥) has a root at 𝑥) . The Taylor expansion of the function is
𝑓(𝑥) 𝐴𝑥−𝐵 𝐵
∆≈ − =− = − C𝑥 − D
𝑓 (𝑥)
* 𝐴 𝐴
𝐵
𝑥+∆=
𝐴
𝑓(𝑥) = (𝑥 − 1)(𝑥 − 2)
"
To begin with, calculate ∆ at 𝑥 = +.
3
𝑓 E𝑥 = 4G 5/16
∆≈ − =
3 3/2
𝑓 * E𝑥 = G
4
5
∆≈ = 0.20833
24
However, the exact value 𝑥) = 1 (2 is also a root but focus on the first root which is 1)
"
So, ∆ = 𝑥) − 𝑥 = 1 − + = 0.25. The values 0.25 and 0.20833 are close but not the same!
Here, the idea is to start at some location 𝑥, and try to step towards the root using ∆ to guide
the choice of step size.
𝑓(𝑥# )
𝑥! = 𝑥# + J− K
𝑓 * (𝑥# )
In this step ∆ = 𝑥! − 𝑥#
𝑓(𝑥! )
𝑥" = 𝑥! −
𝑓 * (𝑥! )
After 𝑛 + 1 steps
𝑓(𝑥, )
𝑥,'# = 𝑥, −
𝑓 * (𝑥, )
We can terminate this iteration when the condition |𝑓(𝑥,'# )| < 𝜀, where 𝜀 is the user defined
tolerance.
Secant method
𝑓(𝑥, ) − 𝑓(𝑥, − ℎ)
𝑓 * (𝑥, ) = lim
-→) ℎ
𝑓(𝑥, ) − 𝑓(𝑥,/# )
𝑓 * (𝑥, ) ≈
𝑥, − 𝑥,/#
Thus, we get
𝑥, − 𝑥,/#
𝑥,'# = 𝑥, − P Q 𝑓(𝑥, )
𝑓(𝑥, ) − 𝑓(𝑥,/# )