0% found this document useful (0 votes)
40 views

Solutions of Equations in One Variable The Bisection Method

Uploaded by

Nashit Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Solutions of Equations in One Variable The Bisection Method

Uploaded by

Nashit Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Solutions of Equations in One Variable

The Bisection Method

Book
Numerical Analysis (8th Edition)
R L Burden & J D Faires

Instructor: Shoaib Ahmed


ME-12 – B & C
2020 Entry
Spring 2022
Context Bisection Method Example

Outline

1 Context: The Root-Finding Problem

2 Introducing the Bisection Method

3 Applying the Bisection Method

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 2 / 17


Context Bisection Method Example

The Root-Finding Problem

A Zero of function f (x )
We now consider one of the most basic problems of numerical
approximation, namely the root-finding problem.
This process involves finding a root, or solution, of an equation of
the form
𝑓 (𝑥 ) = 0
for a given function 𝑓 .
A root of this equation is also called a zero of the function 𝑓 .

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 3 / 17


Context Bisection Method Example

Outline

1 Context: The Root-Finding Problem

2 Introducing the Bisection Method

3 Applying the Bisection Method

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 4 / 17


Context Bisection Method Example

The Bisection Method

Overview
We first consider the Bisection (Binary search) Method which is
based on the Intermediate Value Theorem (IVT).
Suppose a continuous function 𝑓 , defined on [𝑎, 𝑏] is given with
𝑓 (𝑎) and 𝑓 (𝑏) of opposite sign.
By the IVT, there exists a point 𝑝 ∈ (𝑎, 𝑏) for which 𝑓 (𝑝) = 0.
It will be assumed that the root in this interval is unique.

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 5 / 17


Context Bisection Method Example

Bisection Technique

Main Assumptions
Suppose 𝑓 is a continuous function defined on the interval [𝑎, 𝑏],
with 𝑓 (𝑎) and 𝑓 (𝑏) of opposite sign.
The Intermediate Value Theorem implies that a number 𝑝 exists in
(𝑎, 𝑏) with 𝑓 (𝑝) = 0.
Although the procedure will work when there is more than one
root in the interval (𝑎, 𝑏), we assume for simplicity that the root in
this interval is unique.
The method calls for a repeated halving (or bisecting) of
subintervals of [𝑎, 𝑏] and, at each step, locating the half containing
𝑝.

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 6 / 17


Context Bisection Method Example

Bisection Technique

Computational Steps
To begin, set a1 = a and b1 = b, and let p1 be the midpoint of [a, b];
that is,
a + b1
p1 = 1
2

If f (p1) = 0, then p = p1, and we are done.


If f (p 1) ≠ 0, then f (p 1) has the same sign as either f (a 1) or f (b 1).
¤ If f (p 1 ) and f (a 1 ) have the same sign, p ∈(p1, b1). Set a2 = p1 and
b2 = b1.
¤ If f (p 1 ) and f (a 1 ) have opposite signs, p ∈(a1, p1). Set a2 = a1 and
b2 = p1.
Then re-apply the process to the interval [a2, b2], etc.

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 7 / 17


Context Bisection Method Example

The Bisection Method to solve f (x ) = 0

Interval Halving to Bracket the Root


y

f (b)

y = f (x)

f ( p1) p3

a = a1 p2 pp b = b1 x
1
f ( p2)
f (a)
a1 p1 b1

a2 p2 b2

a3 p3 b3

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 8 / 17


Context Bisection Method Example

The Bisection Method to solve f (x ) = 0


Given the function f defined on [a,b] satisfying f (a)f (b) < 0.

1. a1 = a, b1 = b, p0 = a;
2. i = 1;
1
3. pi = 2(ai + bi );
4. If |pi − p i−1 | < 𝜀 or |f (pi )| < 𝜀 then go to step10;
5. If f (pi )f (ai ) > 0, then go to 6;
If f(pi )f (ai ) < 0, then go to 8;
6. ai+1 = pi , bi+1 = bi ;
7. i = i + 1; go to 3;
8. ai+1 = ai ; bi+1 = pi ;
9. i = i + 1; go to 3;
10. End of Procedure.
Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 9 / 17
Context Bisection Method Example

The Bisection Method

Comment on Stopping Criteria for the Algorithm


Other stopping procedures can be applied in Step 4.
For example, we can select a tolerance 𝜀 > 0 and generate
𝑝1, ...,𝑝𝑁 until one of the following conditions is met:

𝑝𝑁 − 𝑝𝑁−1 < 𝜀 (1)


𝑝𝑁 − 𝑝𝑁−1
<𝜀, 𝑝𝑁 ≠ 0 or
𝑝𝑁 (2)
|𝑓 (𝑝𝑁 )| < 𝜀 (3)

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 10 / 17


Context Bisection Method Example

The Bisection Method

Comment on Stopping Criteria for the Algorithm


• Unfortunately, difficulties can arise using any of these stopping
criteria. For example, sequences pn n 0 with the property that the

differences 𝑝𝑛 − 𝑝𝑛 − 1 can converge to zero while the sequence


itself diverges.
• It is also possible for 𝑓(𝑝𝑛) to be close to zero while 𝑝𝑛 differs
significantly from 𝑝.
• Without additional knowledge about 𝑓 or 𝑝, Inequality (2) is the
best stopping criterion to apply because it comes closest to testing
relative error.

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 11 / 17


Context Bisection Method Example

Outline

1 Context: The Root-Finding Problem

2 Introducing the Bisection Method

3 Applying the Bisection Method

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 12 / 17


Context Bisection Method Example

Solving 𝑓 (𝑥 ) = 𝑥 3 + 4𝑥 2 − 10 = 0

Example: The Bisction Method


Show that 𝑓 (𝑥 ) = 𝑥 3 + 4𝑥 2 − 10 = 0 has a root in [1, 2] and use
the Bisection method to determine an approximation to the root
that is accurate to at least within 10 -4.

Relative Approximated Error


Note that, for this example, the iteration will be terminated when a
bound for the relative error is less than 10 −4, implemented in the form:

|pn − p n−1 |
< 10−4.
|p n|

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 13 / 17


Context Bisection Method Example

Bisection Method applied to 𝑓 (𝑥 ) = 𝑥 3 + 4𝑥 2 − 10

Solution
Because 𝑓 (1) = −5 and 𝑓 (2) = 14 the Intermediate Value
Theorem ensures that this continuous function has a root in [1, 2].

For the first iteration of the Bisection method we use the fact that
at the midpoint of [1, 2] we have f (1.5) = 2.375 > .0
This indicates that we should select the interval [1, 1.5] for our
second iteration.
Then we find that f (1.25) = −1.796875 so our new interval
becomes [1.25, 1.5], whose midpoint is .1.375
Continuing in this manner gives the values shown in the following
table.

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 14 / 17


Context Bisection Method Example

Bisection Method applied to 𝑓 (𝑥 ) = 𝑥 3 + 4𝑥 2 − 10

Iter 𝑎𝑛 𝑏𝑛 𝑝𝑛 𝑓 (𝑎𝑛 ) 𝑓 (𝑝𝑛 ) RelErr


1 1.000000 2.000000 1.500000 -5.000 2.375 0.33333
2 1.000000 1.500000 1.250000 -5.000 -1.797 0.20000
3 1.250000 1.500000 1.375000 -1.797 0.162 0.09091
4 1.250000 1.375000 1.312500 -1.797 -0.848 0.04762
5 1.312500 1.375000 1.343750 -0.848 -0.351 0.02326
6 1.343750 1.375000 1.359375 -0.351 -0.096 0.01149
7 1.359375 1.375000 1.367188 -0.096 0.032 0.00571
8 1.359375 1.367188 1.363281 -0.096 -0.032 0.00287
9 1.363281 1.367188 1.365234 -0.032 0.000 0.00143
10 1.363281 1.365234 1.364258 -0.032 -0.016 0.00072
11 1.364258 1.365234 1.364746 -0.016 -0.008 0.00036
12 1.364746 1.365234 1.364990 -0.008 -0.004 0.00018
13 1.364990 1.365234 1.365112 -0.004 -0.002 0.00009

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 15 / 17


Context Bisection Method Example

Bisection Method applied to f (x ) = x 3 + 4x 2 − 10

Solution (Cont’d)
After 13 iterations, p13 = 1.365112305 approximates the root p
with an error

|𝑝 − 𝑝13| < |𝑏14 − 𝑎14| = |1.3652344 − 1.3651123| = 0.0001221

Since |a14| < |p|, we have

p  p13 b14  a14


  9.0  10 5
p a14
so the approximation is correct to at least within 10 −4 .
The correct value of p to nine decimal places is p = 1.365230013

Numerical Analysis (Chapter (2 The Bisection Method R L Burden & J D Faires 16 / 17


Context Bisection Method Example

The Bisection Method

Final Remarks
The Bisection Method has a number of significant drawbacks.
Firstly it is very slow to converge in that N may become quite large
before 𝑝 − 𝑝𝑁 becomes sufficiently small.
Also it is possible that a good intermediate approximation may be
inadvertently discarded.
It will always converge to a solution however and, for this reason,
is often used to provide a good initial approximation for a more
efficient procedure.

Numerical Analysis (Chapter 2) The Bisection Method R L Burden & J D Faires 17 / 17

You might also like