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

    Left side of f(x) = 0

    Left end of the interval

    Right end of the interval

    Empty = 0.0001

    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. 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. 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. 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. 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.

    PointBisectionNewton's methodSecant methodFalse position
    What you start withTwo ends with opposite signsOne guess and the derivative f'(x)Two guesses, no sign conditionTwo ends with opposite signs
    Always converges?Yes, for a continuous fNo, can diverge or jump to another rootNoYes, the root stays bracketed
    Speed near the rootError halves each step, about 3.32 steps per decimal digitQuadratic: correct digits roughly double each stepOrder about 1.618Usually faster than bisection, can stall when one end never moves
    Steps known in advanceYes, from ⌈log2((b - a)/ε)⌉NoNoNo
    Work per stepOne value of ff and f'One value of fOne value of f
    VerdictUse 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 10Width 100
    0.0171014
    0.001101417
    0.0001 (default)141720
    10-6202427
    10-9303437
    10-12404447

    Where a bisection answer goes wrong

    Taking a sign change for a root. tan(x) on [1, 2] changes sign, but at π/2 it jumps from +∞ to -∞ rather than crossing zero. Bisection still homes in on 1.570740, and f(c) there is about 17,673.87, nowhere near 0. The calculator flags this when |f(c)| keeps growing or ends up larger than at the ends.
    An interval with two roots. x² - 1 on [-2, 2] has roots at -1 and 1, but f(-2) and f(2) are both 3, so the method cannot start. Narrow the interval to one root, for example [0, 3], which gives x ≈ 1.000031. With three roots inside, the method finds one of them and gives no hint about the others.
    Reading a tiny f(c) as a precise root. ε bounds the distance in x, not the value of f. For (x - 1)³ on [0, 3] with ε = 0.001 the last f(c) is only -1.45519×10-11, yet x ≈ 0.99976 is still about 0.00024 from the root 1. Flat functions give small values well away from their roots.
    Using log for the natural logarithm. Here log means base 10, as on a scientific calculator: log(x) - 1 = 0 on [1, 20] gives x ≈ 9.999966 (the root is 10). For the natural logarithm type ln, for base 2 log2, and for any other base b write ln(x)/ln(b). The calculator reminds you whenever the function contains log.

    Bisection questions from numerical methods classes

    Why is it called the interval halving method?
    Each step cuts the interval that contains the root in half and keeps the half where the sign still changes. Other names are the binary search method and the dichotomy method. It rests on the intermediate value theorem: a continuous function that is negative at one end and positive at the other must cross zero in between.
    How do I pick a and b?
    Evaluate f at a few round numbers and look for a sign change, or sketch the graph. If you guess and the signs match, the calculator scans 400 points between your ends and lists every subinterval where the sign changes, so you can copy one of them back into the boxes.
    Why did it take fewer steps than the formula says?
    If a midpoint lands exactly on the root, f(c) is 0 and the calculator stops at once. x - 1.5 on [1, 2] finishes after 1 step, while the formula predicts 14. The "Steps taken" tile shows the reason for stopping.
    Can I ask for 15 correct decimals?
    The limit is ε = 10-12, and even that is not always reachable: floating-point numbers near 100,000,000 are spaced about 1.5×10-8 apart. When the interval cannot shrink further, the calculator stops and says the requested ε was not reached.
    What is the error bound after n steps?
    (b - a)/2n: the n-th midpoint sits in the middle of an interval of width (b - a)/2n-1, so it is at most half that width from the root. For [1, 2] after 14 steps that is 1/16,384 = 0.00006103515625, the bound the calculator prints. One more step would halve it to 0.000030517578125.
    Does it work for equations like Kepler's x - 0.5 sin x = 1?
    Yes, any continuous function you can type. x - 0.5*sin(x) - 1 on [0, 3] with ε = 1e-6 gives x ≈ 1.49870181 after 22 steps.

    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

    Similar calculators from this section