Find where f(x) = 0 between two points by halving the interval: type the function, a, b and a tolerance to get the root, an error bound, every iteration and a warning when the sign change is a pole.
Bisection Method Calculator - Root of f(x) Step by Step
Find where f(x) = 0 between two points by halving the interval: type the function, a, b and a tolerance to get the root, an error bound, every iteration and a warning when the sign change is a pole.
Parameters
Enter data for calculations
Root of f(x) = 0 by repeated halving, with every step shown
Enter a function, two ends where it changes sign and a tolerance, and you get the root with an error bound and the full iteration table. The textbook case f(x) = x³ - x - 2 on [1, 2] with the default tolerance 0.0001 gives x ≈ 1.521423 after 14 steps, with an error of at most 0.00006103515625. The calculator also prints how many steps the formula n = ⌈log2((b - a)/ε)⌉ predicts, the unrounded midpoint, and a warning when the "root" is really a pole or a jump in the function, such as tan(x) at π/2 or abs(x)/x at 0.
Using the bisection method calculator in four steps
-
1
Function f(x) - the left side of f(x) = 0. To solve cos x = x, type cos(x) - x; if you type the whole equation cos(x) = x, it is rewritten as (cos(x)) - (x) for you. You can use ^ for powers, parentheses, pi, e and sin, cos, tan, cot, ln, log (base 10), log2, exp, sqrt, abs and the arc functions. Multiplication can be implied: 2x means 2*x.
-
2
Interval start a - a number or an expression such as -2.5 or pi/2. Use a period for decimals; a comma is rejected with a message.
-
3
Interval end b - f(b) must have the opposite sign to f(a). If you type the ends the wrong way round, they are swapped. If the signs match, you get a list of places where the sign does change on a 400-point scan.
-
4
Tolerance ε - how far from the true root the answer may be, for example 0.001. Scientific notation works: 1e-6 or 10^-6. Left empty, ε is 0.0001; the smallest allowed value is 10^-12.
Bisection, Newton, secant or false position?
Bisection is the slowest of the four classic root finders. Together with false position it is one of the two that cannot fail on a continuous function once the signs at the ends differ, and it is the only one whose number of steps is known before you start. The table compares them on the points that decide which one to use.
| Point | Bisection | Newton's method | Secant method | False position |
|---|---|---|---|---|
| What you start with | Two ends with opposite signs | One guess and the derivative f'(x) | Two guesses, no sign condition | Two ends with opposite signs |
| Always converges? | Yes, for a continuous f | No, can diverge or jump to another root | No | Yes, the root stays bracketed |
| Speed near the root | Error halves each step, about 3.32 steps per decimal digit | Quadratic: correct digits roughly double each step | Order about 1.618 | Usually faster than bisection, can stall when one end never moves |
| Steps known in advance | Yes, from ⌈log2((b - a)/ε)⌉ | No | No | No |
| Work per step | One value of f | f and f' | One value of f | One value of f |
| Verdict | Use bisection when you need a guaranteed answer with a known error, or to get close enough for a faster method to take over. Use Newton's method when the derivative is easy and the starting guess is already good. | |||
The bisection formula, worked on three equations
Each step takes the midpoint c = (a + b)/2 and evaluates f(c). If f(c) has the same sign as f(a), the root lies in [c, b], so c becomes the new a; otherwise c becomes the new b. The interval is halved every time, so the n-th midpoint is at most (b - a)/2n from the root. The calculator stops as soon as that bound is no more than ε.
Example 1: x³ - x - 2 = 0 on [1, 2]. f(1) = -2 and f(2) = 4, so a root is inside. Step 1: c = 1.5, f(1.5) = -0.125, negative like f(1), so the new interval is [1.5, 2]. Step 2: c = 1.75, f = 1.609375, positive, so [1.5, 1.75]. Step 3: c = 1.625, f = 0.666015625, so [1.5, 1.625]. Step 4: c = 1.5625, f = 0.2521972656. Step 5: c = 1.53125, f = 0.05911254883. After 14 steps with ε = 0.0001 the answer is 1.521423; with ε = 10-6 it takes 20 steps and the 15th midpoint is 1.521392822, the value in Wikipedia's iteration table.
Example 2: cos x = x. Type cos(x) - x on [0, 1] with ε = 0.000001. f(0) = 1 and f(1) is about -0.46, so the signs differ. After 20 steps: x ≈ 0.73908520, error at most 9.53674×10-7. This number has no closed form, which is exactly when a numerical method earns its place.
Example 3: the square root of 2. x² - 2 on [1, 2] with ε = 1e-10 takes 34 steps and gives x ≈ 1.414213562326, error at most 5.82077×10-11. The same idea with ln(x) - 1 on [2, 3] and ε = 1e-8 gives e ≈ 2.7182818279 after 27 steps.
How many iterations a tolerance costs
Because the width halves on schedule, the number of steps depends only on the interval width and ε, never on the function. Ten times the precision costs about 3.32 more steps; a ten times wider interval costs the same.
| Tolerance ε | Width 1, e.g. [1, 2] | Width 10 | Width 100 |
|---|---|---|---|
| 0.01 | 7 | 10 | 14 |
| 0.001 | 10 | 14 | 17 |
| 0.0001 (default) | 14 | 17 | 20 |
| 10-6 | 20 | 24 | 27 |
| 10-9 | 30 | 34 | 37 |
| 10-12 | 40 | 44 | 47 |
Where a bisection answer goes wrong
Bisection questions from numerical methods classes
Related tools
Polygon Area Calculator
Exact area of any polygon from its corner coordinates, with the shoelace steps - See the calculator
Derivative Calculator
f'(x) with the rules applied step by step, what Newton's method needs - See the calculator
Definite Integral Calculator
Numerical integral of the same kind of function, using the same notation - See the calculator
Polynomial Calculator
All real and complex roots of a polynomial at once, exact where possible - See the calculator
Quadratic Equation Calculator
Both roots of ax² + bx + c = 0 from the formula, no iteration needed - See the calculator
System of Equations Calculator
Linear systems with two or three unknowns, solved exactly - See the calculator
Linear Interpolation Calculator
A value between two points, the idea behind the false position method - See the calculator
Logarithm Calculator
log, ln and any base, for checking the step-count formula - See the calculator