🔍Nonlinear Equations
Bracketing Methods
The intermediate value theorem, bisection, false position, the Illinois fix and Brent's method
London, 1939
Water flowing through a pipe loses pressure to friction. How much depends on one dimensionless number, the Darcy friction factor , and every pump, pipeline, cooling loop and fuel feed line is sized from it.
In 1939 Cyril Colebrook, working with data from smooth and sand-roughened pipes, published the law that engineers still use for turbulent flow:
Look at where is. It sits on the left, and again on the right inside the logarithm. No algebra gets it out. There is no formula for .
Five years later Lewis Moody plotted the solutions as a chart — friction factor against Reynolds number, one curve per roughness — and for decades engineers solved Colebrook's equation by reading a graph with a ruler. The Moody diagram is still printed in every fluid mechanics textbook.
A computer cannot read a chart. It needs a procedure that turns an equation it cannot rearrange into a number — and ideally a guarantee that the procedure will work.
Every equation can be written as : move everything to one side. A value with is a root. For Colebrook,
and the friction factor is its root. The whole of this unit is about finding roots of functions we can evaluate but not invert.
💡The intermediate value theorem
If is continuous on and and have opposite signs, then has at least one root in .
An interval with a sign change is called a bracket. A bracket is a certificate: as long as you keep one, a root is trapped inside it, whatever else happens. The methods in this lesson never let go of their bracket — that is where their guarantee comes from.
Bisection is the simplest way to shrink a bracket. Evaluate at the midpoint . If and differ in sign, the root is in ; otherwise it is in . Keep that half and repeat.
Each step halves the bracket, whatever looks like. After steps the width is , so reaching a tolerance takes
Bisection's step count is known before you start. Each step buys exactly one binary digit, so about 3.3 steps per decimal digit.
Derivation
Counting bisection steps
Each step keeps exactly half of the bracket, whatever is. Starting from width , after steps the width is . We stop once it is below the tolerance :
One more decimal digit means dividing by 10, which adds steps. For Colebrook, ; the lab's loop stops on the half-width, one halving earlier, after 29 steps.
📐Colebrook by bisection
Take and . Friction factors for turbulent flow lie between about 0.008 and 0.1, and , : a bracket.
For a tolerance of the formula predicts halvings; the loop that stops when the half-width drops below takes 29. The result is .
For comparison, Haaland's explicit formula of 1983, designed precisely so that nobody has to iterate, gives 0.018265 — 1.3% low. Good enough to size a pump; not good enough to be the reference that a pipe-network solver converges to.
When do you stop? Three tests are common, and each can fool you on its own.
- Bracket width — the honest test for bisection, but use a relative width when the root may be large, or you will ask for more digits than a double holds.
- Residual — meaningless without units: can be scaled by any constant. A flat function has a tiny residual far from its root; a steep one has a large residual right next to it.
- Iteration cap — always have one. A bug or a function that is not continuous should end in an error message, not an infinite loop.
when you can measure what you are speaking about, and express it in numbers, you know something about it
False position (regula falsi) uses more information. Instead of the midpoint, it takes the point where the straight line through and crosses zero:
Near a root a smooth function is almost a straight line, so this should be much closer than the midpoint. Often it is. But on a function that is convex across the bracket, one end of the bracket never moves: every new point lands on the same side. The bracket does not shrink to zero, and convergence slows to a crawl. On over , false position takes over 100 steps to do what bisection does in 34.
Derivation
Where the false-position point comes from
The straight line through and has slope , so
Set and solve for :
Because and have opposite signs, the denominator is never zero and always lies strictly between and — the bracket is never lost. The secant method of the next lesson uses exactly this formula, but with the two most recent points instead of the two ends of a bracket.
💡The Illinois fix
When the same end of the bracket survives twice in a row, halve the function value stored at that end. The next secant line then lands on the other side of the root, and the stuck end finally moves.
The change is two lines of code. On it cuts the work from over 100 evaluations to 14, and the method keeps its bracket — so it keeps the guarantee. Dowell and Jarratt analysed it in 1971 and showed its order of convergence is about 1.44.
Brent's method (Richard Brent, 1973, building on Theodorus Dekker's 1969 algorithm) is the industrial answer. It keeps a bracket at all times, but at each step it tries a fast step — a secant step or inverse quadratic interpolation through the last three points — and accepts it only if it lands inside the bracket and shrinks it fast enough. Otherwise it falls back to bisection.
The result converges superlinearly on smooth functions and is never much slower than bisection on bad ones. It is
scipy.optimize.brentq, MATLAB's fzero, and the root finder inside most engineering codes. When you have a bracket, it is the default.⚠What a bracket cannot do
A sign change finds an odd number of roots; it says nothing about which. Double roots — at 0 — have no sign change at all and are invisible to bracketing. And a function with a pole, like across , changes sign without a root: bisection will happily converge to the pole. Plot first, or check that is small at the answer.
💡Where you will use this
Hydraulic Engineering: Colebrook inside every pipe-network solver. Geotechnical Engineering: the critical depth of a slip surface and the factor of safety at which a slope is just stable. Rocket Propulsion: the exit Mach number of a nozzle from its area ratio, where you must choose the subsonic or supersonic branch — a bracket chooses it for you. Orbital Mechanics: the time of flight in Lambert's problem as a monotonic function of one parameter.
📚Further reading
- Michael Heath, Scientific Computing: An Introductory Survey (2nd ed.; SIAM Classics 2018), chapter 5, 'Nonlinear Equations' — bisection, false position and safeguarded methods.
- Richard Brent, Algorithms for Minimization without Derivatives (Prentice-Hall, 1973; Dover reprint 2002), chapter 4 — Brent's own account of his zero finder, with the ALGOL code it was published in.
- Cyril Colebrook, 'Turbulent flow in pipes, with particular reference to the transition region between the smooth and rough pipe laws', Journal of the Institution of Civil Engineers 11, 133–156 (1939).
↓But there is a problem
Bisection is slow in a very precise sense: 29 steps for ten digits, 52 steps for all sixteen, whatever the function. It never uses the most obvious piece of information — which way the curve is heading.
In 1669 Isaac Newton wrote down a different idea. Replace the curve by its tangent line, find where the line hits zero, and repeat. His first example was a cubic. From a guess of 2 it gave the root to 10 digits in three steps.