Bisection Method Algorithm with Examples
Smart Summary
Bisection Method is a reliable numerical technique that finds a root of a continuous function by repeatedly halving an interval where the function changes sign. It is simple, guaranteed to converge, and widely used in engineering, scientific computing, and beginner numerical analysis courses.

What is the Bisection Method?
The Bisection Method is one of the most fundamental numerical techniques for finding the root of a polynomial or transcendental equation. It works by bracketing the interval that contains the root and then subdividing that interval into halves on each iteration until the root is located within an acceptable tolerance. Because of this bracketing behavior, the Bisection Method is also referred to as the bracketing method.
Since its working mechanism resembles binary search, the Bisection Method is also known as the binary search method, halving method, or dichotomy method. It rests on a strong theoretical foundation: the Intermediate Value Theorem, which guarantees that a continuous function changing sign over an interval must cross zero somewhere inside that interval.
With the basic definition in place, let us explore why finding roots of equations matters and how the Bisection Method fits into that broader picture.
Finding Roots of Equations
In this discussion, we focus only on equations with one independent variable. Such equations may be linear or nonlinear. Linear equations describe the graph of a straight line, while nonlinear equations describe curves and more complex shapes.
The root of an equation is the value of the independent variable that satisfies the equation. For example, the root of the equation f(x) = 4 – x2 = 0 is 2, because f(2) = 4 – 22 = 0.
Let us consider f(x) as a real continuous function. According to the Intermediate Value Theorem, the equation f(x) = 0 has at least one root between a and b whenever f(a)f(b) < 0. In other words, the function f(x) has a root, “c,” somewhere between a and b.
This sign-change property is exactly what the Bisection Method exploits. The next section shows how this idea looks graphically.
Graphical Representation of the Bisection Method
The following graph represents the working mechanism of the Bisection Method. From the graph, we can see that the actual root of the equation is marked in red.
The procedure can be summarized as follows:
- We first choose two initial guesses, a1 and b1, for which f(a1)f(b1) < 0. According to the Intermediate Value Theorem, the root must lie in [a1, b1].
- We then compute the midpoint of a1 and b1, which is b2. The initial interval is now reduced to [a1, b2] because f(a1)f(b2) < 0.
- In the same manner, the interval is halved again and again until an approximate solution is found within the desired tolerance.
With the geometric intuition clear, we can now formalize the procedure as a step-by-step algorithm.
Bisection Method Algorithm
The steps for applying the Bisection Method algorithm to find the root of the equation f(x) = 0 are as follows.
Step 1) Choose initial guesses a, b, and a tolerance rate e.
Step 2) If f(a)f(b) >= 0, then the root does not lie in this interval. In that case, there is no solution within [a, b].
Step 3) Find the midpoint, c = (a + b)/2.
(i) If the function value at the midpoint f(c) = 0, then c is the root. Go to step 5.
(ii) If f(a)f(c) < 0, the root lies between a and c. Then set a = a, b = c.
(iii) Otherwise, set a = c, b = b.
Step 4) If the absolute error is higher than the tolerance rate, that is (b – a) > e, go back to step 3.
Step 5) Display c as the approximate root.
Let us see an example of the Bisection Method algorithm in action. We will find the root of the following continuous function using the Bisection Method formula.
f(x) = x3 – x2 + 2
Bisection Method Example
Step 1) Let us assume,
a = -10,
b = 10, and
e = 1% or 0.01.
Step 2) Now, we will check whether f(a)f(b) >= 0 or not.
f(a) = f(-10) = (-10)3 – (-10)2 + 2 = -1098
f(b) = f(10) = (10)3 – (10)2 + 2 = 902
f(a)f(b) = f(-10)f(10) = (-1098)(902) < 0
Hence, the root of the above function lies in the interval [-10, 10].
Step 3) Next, the midpoint c is calculated.
Now the following conditions need to be checked:
(i) Whether f(c) = 0:
f(c) = f(0) = (0)3 – (0)2 + 2 = 2, which is not equal to 0.
(ii) Whether f(a)f(c) < 0:
f(c)f(a) = 2 * (-1098) < 0
The condition is fulfilled. For the next iteration, the values will be:
a = a = -10
b = c = 0
Step 4) As (b – a) = (0 – (-10)) = 10 > 0.01, the process is repeated. The next iterations are shown in the table below.
| Iteration | a | b | c | b-a | f(c) |
|---|---|---|---|---|---|
| 1 | -10 | 0 | 0 | 10 | 2 |
| 2 | -5 | 0 | -5 | 5 | -148 |
| 3 | -2.5 | 0 | -2.5 | 2.5 | -19.875 |
| 4 | -1.25 | 0 | -1.25 | 1.25 | -1.52562 |
| 5 | -1.25 | -0.625 | -0.625 | 0.625 | 1.36523 |
| 6 | -1.25 | -0.9375 | -0.9375 | 0.3125 | 0.297119 |
| 7 | -1.09375 | -0.9375 | -1.09375 | 0.15625 | -0.50473 |
| 8 | -1.01562 | -0.9375 | -1.01562 | 0.078125 | -0.0791054 |
| 9 | -1.01562 | -0.976562 | -0.976562 | 0.0390625 | 0.115003 |
| 10 | -1.01562 | -0.996094 | -0.996094 | 0.0195312 | 0.0194703 |
| 11 | -1.00586 | -0.996094 | -1.00586 | 0.00976562 | -0.0294344 |
Step 5) In the 11th iteration, the condition in step 4 becomes false. Thus, the approximate root of this equation is -1.00586.
With a numerical example complete, the next section presents the logical diagram that captures the full control flow.
Bisection Method Logical Diagram
The flowchart below summarizes the decision logic of the Bisection Method, including the bracket check, midpoint update, and tolerance test.
Pseudo-Code
The pseudo-code below mirrors the algorithm and serves as a blueprint for implementing the Bisection Method in any programming language.
Start Set a, b, e if f(a)*f(b) >= 0 Output("Root does not exist in this interval") Stop while (b-a) > e do c ← (a + b)/2 if f(c) = 0 break end if if f(c)*f(a) < 0 then b ← c else a ← c end while Output(c) Stop
Bisection Method Example in C/C++
The following C/C++ program implements the Bisection Method to find the root of f(x) = x3 – x2 + 2 within the interval [-10, 10].
Input:
#include <bits/stdc++.h> using namespace std; #define Error 0.01 double value(double x) { return x*x*x - x*x + 2; } void bisection_method(double a, double b) { if (value(a) * value(b) >= 0) { cout << "The root does not lie in this interval\n"; return; } double c = a; while ((b-a) >= Error) { c = (a+b)/2; if (value(c) == 0.0) break; else if (value(c)*value(a) < 0) b = c; else a = c; } cout << "The root is :" << c; } int main() { double a = -10, b = 10; bisection_method(a, b); return 0; }
Output:
The root is :-1.00586
Bisection Method Example in Python
The Python version below produces the same approximate root using identical logic, which makes it ideal for quick experimentation and teaching.
Input:
def value(x): return x*x*x - x*x + 2 def bisection_method(a, b): if (value(a) * value(b) >= 0): return c = a while ((b-a) >= 0.01): c = (a+b)/2 if (value(c) == 0.0): break if (value(c)*value(a) < 0): b = c else: a = c print("The root is : ", "%.4f" % c) a = -10 b = 10 bisection_method(a, b)
Output:
The root is : -1.0059
Advantages and Limitations of the Bisection Method
Like every numerical technique, the Bisection Method has clear strengths and a few practical drawbacks. The table below summarizes the most important pros and cons.
| Pros | Cons |
|---|---|
| Easy and simple root-finding method to implement in any language. | Convergence is slow because the method simply halves the interval at each step. |
| It always converges when a valid bracket is provided, since it brackets the root throughout the process. | If one of the initial guesses is already close to the root, reaching the root will still take many iterations. |
| The error rate can be controlled directly by increasing or decreasing the number of iterations or by tightening the tolerance. | It cannot find complex roots or multiple roots of even multiplicity, since the function does not change sign at such roots. |
Applications of the Bisection Method
The Bisection Method is used in many practical and modern computing scenarios where a robust root-finding step is required.
- Engineering simulations: Solving nonlinear equations that appear in heat transfer, fluid dynamics, and structural analysis.
- Financial modeling: Computing yields, internal rates of return, and break-even points where closed-form solutions do not exist.
- Machine learning and AI: Locating thresholds, calibrating models, and tuning hyperparameters inside AI-driven numerical solvers.
- Computer graphics: Determining ray-surface intersections and parameter values along curves.
- Embedded systems: Approximating roots in low-resource controllers where simplicity and predictability are more valuable than speed.



