Proofs: Brent's method
These are the human proofs of Brent's method, at full length.
Correctness, termination and the k^2 bound of Brent's method full
This proof shows: correctness, termination, complexity.
Let be continuous on with , let , and let be the floor of line L5 (in exact arithmetic take ). Write for the width of the bracket, and .
Theorem 1 (invariant). At each test of line L5: and lie in , and are nonzero with opposite signs, and . So a root lies strictly between and , and a return at L5 with gives .
Proof. At the first pass, and have values of opposite signs, and L4 swaps if needed. Suppose the claims hold at L5 and the pass does not return, so . We show that the new lies strictly between the old and . If L9 accepts , then , so : has the sign of , has the sign of or is 0, and , that is less than . If , the new point is strictly between and . If , or after a bisection, the new point is or , also strictly between and since . So the new is in . If is zero there, L5 of the next pass returns a root. Otherwise L11 makes the old the point , and L3 of the next pass sets when the new has the sign of ; the old had the other sign. Either way and have opposite signs, and L4 restores by a swap that keeps the pair. The intermediate value theorem gives the root, and at the return.
Lemma 2 (the width falls). If a pass does not return, the new width satisfies . After a bisection, .
Proof. Let be the new point, strictly between and , with (L11). If the contrapoint stays, . If L3 sets the contrapoint to the old , then , which is less than for an accepted step, equals for a minimum step, and equals for a bisection; since , each of these is at most . After a bisection is the midpoint, so in both cases. The swap at L4 does not change .
Theorem 3 (termination). For , BRENT returns within passes. For any it ends within passes.
Proof. As for Dekker's method: , so by Lemma 2 after passes .
Theorem 4 (the bound). Let and . BRENT returns within passes, that is with at most evaluations.
Proof. Call a pass a bisection if it ends in L9's else branch or L10, and an interpolation pass if L9 accepts. Line L1 sets , of size , and a bisection sets , of size at most .
Bisections. By Lemma 2 the width never grows, and a bisection halves it. After bisections, . A pass that does not return has , so : there are at most bisections.
Runs of interpolation passes. A run is a maximal sequence of interpolation passes; it starts at the beginning or after a bisection, when . We claim that after $ passes of a run, at the next test of L6, and . This holds for = 0, so the new $ is less than , and the new $ is the old . A reset at L3 sets = e = b - a$, the move just made. If that move was a step $ with , the reset sets both to the stored and the claim still holds. If it was a minimum step of size $, the reset makes the old $ the contrapoint, so = t \le 2t$, and L5 returns at once. This proves the claim. An interpolation pass needs at L6, so 2^{-\lfloor i/2 \rfloor} \ge \delta/2$, which gives and \le 2k + 3 passes; after it, L6 fails or L9 rejects, and both are bisections.
Count. There are at most runs (one before each bisection and one after the last), each with at most passes, and at most bisections: in all at most passes. Each pass costs one evaluation, and the start costs two.
The constant in Theorem 4 is not sharp; Brent (1973, Chapter 4) counts more carefully and obtains a bound of the same order . The bound is far above what happens on smooth functions, where the method needs about passes once it is close to a simple root; that local behavior is the order of the secant method and of inverse quadratic interpolation, proved on their pages, and it is observed in the example.