HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
Numerical Solution of Equations
  1. 1Locating roots and interval bisection
  2. 2Fixed-point iteration
  3. 3The Newton-Raphson method
  1. Mathematics
  2. /Numerical Solution of Equations
  3. /Locating roots and interval bisection

Course 34.2·Lesson 1 of 3

Locating roots and interval bisection

Most equations have no formula for their roots. A numerical method finds a root to any accuracy we want. The first step is to locate it: if a continuous function changes sign on an interval, a root lies inside. Bisection then halves the interval again and again, keeping the half with the sign change. Each halving gains one binary digit, and the number of steps can be worked out in advance.

about 30 min1 simulation2 practice questions
Lesson 1 of 3Show all lessonsHide
Numerical Solution of Equations
  1. 1Locating roots and interval bisection
  2. 2Fixed-point iteration
  3. 3The Newton-Raphson method

Try the code and the simulations beside the lesson.

What you will be able to do

  • locate a root by a change of sign, and say when this test misleads;
  • show that a root is correct to a given number of decimal places;
  • carry out bisection and work out how many steps it needs.

An equation with no formula

Try to solve x3+2x−5=0x^3 + 2x - 5 = 0x3+2x−5=0 by factorising. You will not succeed. A cubic does have a formula, but it is long. For x=cos⁡xx = \cos xx=cosx there is no formula at all, and in 1824 Abel proved that the general equation of degree five has no formula in roots either. Yet engineers need such roots every day. They use numerical methods: rules that give better and better approximations.

A change of sign

Let fff be continuous on [a,b][a, b][a,b], with f(a)f(a)f(a) and f(b)f(b)f(b) of opposite signs. Then the graph must cross the xxx-axis somewhere between aaa and bbb. So fff has at least one root in (a,b)(a, b)(a,b). This is the intermediate value theorem.

For f(x)=x3+2x−5f(x) = x^3 + 2x - 5f(x)=x3+2x−5: f(1)=−2f(1) = -2f(1)=−2 and f(2)=7f(2) = 7f(2)=7. So a root lies between 111 and 222.

When the test misleads.

  • A break in the graph. f(x)=1x−2f(x) = \dfrac{1}{x - 2}f(x)=x−21​ has f(1)=−1f(1) = -1f(1)=−1 and f(3)=1f(3) = 1f(3)=1, but no root. It is not continuous at x=2x = 2x=2.
  • A root that only touches. (x−1)2(x - 1)^2(x−1)2 has a root at 111, but no change of sign near it.
  • Two roots close together. If an interval holds two roots, the signs at its ends can agree.

So a change of sign proves a root only for a continuous function. No change of sign proves nothing.

Correct to two decimal places

To show that a root is 1.331.331.33 correct to two decimal places, check the signs at 1.3251.3251.325 and 1.3351.3351.335, the ends of the rounding interval. Here f(1.325)≈−0.024f(1.325) \approx -0.024f(1.325)≈−0.024 and f(1.335)≈0.049f(1.335) \approx 0.049f(1.335)≈0.049. The signs differ, so the root lies in (1.325,1.335)(1.325, 1.335)(1.325,1.335), and every such number rounds to 1.331.331.33.

Interval bisection

Bisection repeats one step. Take the midpoint m=12(a+b)m = \tfrac{1}{2}(a + b)m=21​(a+b). Work out f(m)f(m)f(m). Keep the half in which the sign changes. Here is the start for f(x)=x3+2x−5f(x) = x^3 + 2x - 5f(x)=x3+2x−5 on [1,2][1, 2][1,2]:

StepMidpointNew interval
11.51.51.5[1,1.5][1, 1.5][1,1.5]
21.251.251.25[1.25,1.5][1.25, 1.5][1.25,1.5]
31.3751.3751.375[1.25,1.375][1.25, 1.375][1.25,1.375]
41.31251.31251.3125[1.3125,1.375][1.3125, 1.375][1.3125,1.375]

At step 111, f(1.5)=1.375>0f(1.5) = 1.375 > 0f(1.5)=1.375>0, so the sign change is on the left. At step 222, f(1.25)<0f(1.25) < 0f(1.25)<0, so it is on the right.

The curve y = x cubed + 2x - 5 for x from 0.8 to 2.1, crossing the x-axis near 1.33. Below the axis, four nested horizontal bars show the intervals kept by bisection: from 1 to 2, from 1 to 1.5, from 1.25 to 1.5 and from 1.25 to 1.375, each half as long as the one before, all containing the root.

How many steps?

After nnn halvings the width is b−a2n\dfrac{b - a}{2^n}2nb−a​. To make it less than ε\varepsilonε, we need

2n>b−aε.\displaystyle 2^n > \dfrac{b - a}{\varepsilon}.2n>εb−a​.

The midpoint of the last interval is within half the width of the root. For [1,2][1, 2][1,2] and a width below 10−610^{-6}10−6, 2n>1062^n > 10^62n>106 gives n=20n = 20n=20. Each step gains one binary digit, so each decimal place costs about 3.33.33.3 steps. The method is slow, but it never fails once a sign change is found.

Practise with new numbers

Try it in Python

The program runs bisection on x3+2x−5=0x^3 + 2x - 5 = 0x3+2x−5=0 until the interval is narrow enough, and counts the steps.

Read it first. Then run it. How many steps did it take?

1. Change tolerance to 1e-8. Predict the number of steps first.

2. Start with a, b = 2, 3. What does the program say, and why?

Common mistakes

  • Trusting a sign change across a break. Check that fff is continuous on the interval.
  • Missing a touching root. (x−1)2(x - 1)^2(x−1)2 never changes sign.
  • The wrong rounding interval. For 1.331.331.33 to two places, test 1.3251.3251.325 and 1.3351.3351.335, not 1.321.321.32 and 1.341.341.34.
  • Counting steps loosely. Solve 2n>b−aε2^n > \tfrac{b - a}{\varepsilon}2n>εb−a​ and take the least whole nnn.

Remember these

  • A continuous fff with f(a)f(b)<0f(a)f(b) < 0f(a)f(b)<0 has a root in (a,b)(a, b)(a,b).
  • Bisection: keep the half with the sign change.
  • Width after nnn steps: b−a2n\dfrac{b - a}{2^n}2nb−a​.
  • Slow but sure: one binary digit per step.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. Show that x3−4x+1=0x^3 - 4x + 1 = 0x3−4x+1=0 has a root between 000 and 111.
  1. A student says that tan⁡x\tan xtanx has a root between 111 and 222, because tan⁡1>0\tan 1 > 0tan1>0 and tan⁡2<0\tan 2 < 0tan2<0. Is this right?
  1. Which two values would you test to show that a root is 2.72.72.7 correct to one decimal place?
  1. Bisection starts on [0,1][0, 1][0,1]. What is the width after 101010 steps?
  1. Why can bisection not find the root of (x−3)2=0(x - 3)^2 = 0(x−3)2=0?

References

  • R. L. Burden and J. D. Faires, Numerical Analysis, Chapter 2, Solutions of Equations in One Variable.

Enroll free in Numerical Solution of Equations

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (3)

A designer needs the points where the curve y = x³ - 6x + 2 crosses the x-axis…Hard · High School (11–12) · by StemPy Lab
A student runs a bisection program on two functions without looking at their graphs…Advanced · High School (11–12) · by StemPy Lab
The equation e⁻ˣ = x has one root, near 0.57…Hard · High School (11–12) · by StemPy Lab
Next: lesson 2Fixed-point iteration
← Numerical Solution of Equations
← PreviousFixed-point iteration →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
5 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.

Python Labs (1)

A bisection solverPython Lab · by StemPy Lab