College of Engineering and Computer Science
Department of Computer Engineering/ IT
Lebanese French University
Numerical Analysis
Lesson #: 5
Title: Bi-section method
Fall Semester 2023 – 2024
Instructor: Dr. Mohammed Fadhil Hama
Bi-section method
• A method for solving non-linear functions and
systems of equations; helps find the roots
• Procedure to find roots by the bi-section
method:
1. Define the interval region: define two
variables as an input for your system.
2. For the two inputs “a” and “b”, one must give
a negative value F(a) and the other a positive
value F(b). Check: F(a) x F(b) < 0
3. Then define new input in the middle by
4. check; if F(a) x F(c) < 0, root is on the left
side
Check; if F(b) x F(c) < 0, root is on the right side
Choose one of the above only! Let c be new
‘a’ or ‘b’
Bi-section method: drawbacks
• Defining 2 initial ranges is not simple
• If there are more than one roots between the 2 initial
ranges, you will have a problem.
Example bi-section method
• Find the right most root of
the function using bi-section
method to an error level of
0.05.
2
( )
Solution 𝑓 𝑥 =4 𝑥 +3 𝑥 − 3
𝑎+𝑏
Choose initial values for ‘a’ and ‘b’, let a = 0 , c =
and b =
2 1
Error (b-
Iteration a f(a) b f(b) c f(c) f(a)xf(c) f(b)xf(c)
a)
1 0 1 0.5
6
Solution ( ) 2
𝑓 𝑥 =4 𝑥 +3 𝑥 − 3
Choose initial values for ‘a’ and ‘b’, let a = 0 , and b = 1
Since f(a) x f(b) < 0, we have at least one root between 0
and 1. a
Iteratio
f(a) b f(b) c f(c) f(a)xf(c)
f(b)xf(
Error (b-a)
n c)
1 0 -3 1 4 0.5 -0.5 + - 1-0=1
2 0.5 -0.5 1 4 0.75 1.5 - + 1-0.5=0.5
3 0.5 -0.5 0.75 1.5 0.625 0.4375 - + 0.75-0.5=0.25
0.562 0.625-
4 0.5 -0.5 0.625 0.4375 -0.0469 + -
5 0.5=0.125
0.562 - 0.593 0.625-
5 0.625 0.4375 0.1918 - +
5 0.0469 8 0.5625=0.063
0.562 - 0.593 0.578 0.5938-
6 0.1918 0.07148 - +
5 0.0469 8 2 0.5625=0.03
Therefore, x = 0.5782
Solution ( ) 2
𝑓 𝑥 =4 𝑥 +3 𝑥 − 3
Choose initial values for ‘a’ and ‘b’, let a = 0 , and b = 1
Since f(a) x f(b) < 0, we have at least one root between 0
and 1. a
Iteratio
f(a) b f(b) c f(c) f(a)xf(c)
f(b)xf(
Error (b-a)
n c)
1 0 -3 1 4 0.5 -0.5 + - 1-0=1
2 0.5 -0.5 1 4 0.75 1.5 - + 1-0.5=0.5
3 0.5 -0.5 0.75 1.5 0.625 0.4375 - + 0.75-0.5=0.25
0.562 0.625-
4 0.5 -0.5 0.625 0.4375 -0.0469 + -
5 0.5=0.125
0.562 - 0.593 0.625-
5 0.625 0.4375 0.1918 - +
5 0.0469 8 0.5625=0.063
0.562 - 0.593 0.578 0.5938-
6 0.1918 0.07148 - +
5 0.0469 8 2 0.5625=0.03
Therefore, x = 0.5782
Classwork
• Find the left most root of the function using bi-section
method to an error level of 0.05.
• let a= -2, b = 0
2
( )
Solution 𝑓 𝑥 =4 𝑥 +3 𝑥 − 3
𝑎+𝑏
Choose initial values for ‘a’ and ‘b’, let a = 0 , c=
and b =2 1
Error (b-
Iteration a f(a) b f(b) c f(c) f(a)xf(c) f(b)xf(c)
a)
1 -2 0 -1
7
Solution ( ) 2
𝑓 𝑥 =4 𝑥 +3 𝑥 − 3
𝑎+𝑏
Choose initial values for ‘a’ and ‘b’, let a = 0 , and
c=b =2 1
Error (b-
Iteration a f(a) b f(b) c f(c) f(a)xf(c) f(b)xf(c)
a)
1 -2 7 0 -3 -1 -2 - + 2
2 -2 7 -1 -2 -1.5 1.5 + - 1
3 -1.5 1.5 -1 -2 -1.25 -0.5 - + 0.5
4 -1.5 1.5 -1.25 -0.5 -1.375 0.4375 + - 0.25
-
5 -1.375 0.4375 -1.25 -0.5 -1.3125 - + 0.125
0.04688
- - 0.19140
6 -1.375 0.4375 -1.3125 + - -0.0625
0.04688 1.34375 6
-
- 0.19140 - 0.07128
7 -1.3125 1.32812 + - 0.03125
1.34375 6 0.04688 9
Therefore, x = -1.3281255
End of Class
Thank you, Any questions?