Algorithm Search⌘K

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 ff be continuous on [a0,b0][a_0, b_0] with f(a0)f(b0)<0f(a_0) f(b_0) < 0, let w=∣b0−a0∣w = |b_0 - a_0|, and let t=4u∣b∣+δ/2t = 4u|b| + \delta/2 be the floor of line L5 (in exact arithmetic take u=0u = 0). Write W=∣c−b∣W = |c - b| for the width of the bracket, and m=(c−b)/2m = (c - b)/2.

Theorem 1 (invariant). At each test of line L5: bb and cc lie in [a0,b0][a_0, b_0], f(b)f(b) and f(c)f(c) are nonzero with opposite signs, and ∣f(b)∣≤∣f(c)∣|f(b)| \le |f(c)|. So a root x∗x^* lies strictly between bb and cc, and a return at L5 with f(b)≠0f(b) \ne 0 gives ∣b−x∗∣<W≤2t=δ+8u∣b∣|b - x^*| < W \le 2t = \delta + 8u|b|.

Proof. At the first pass, c=a0c = a_0 and b=b0b = b_0 have values of opposite signs, and L4 swaps if needed. Suppose the claims hold at L5 and the pass does not return, so ∣m∣>t|m| > t. We show that the new bb lies strictly between the old bb and cc. If L9 accepts d=p/qd = p/q, then 0≤2p<3mq−∣tq∣0 \le 2p < 3mq - |tq|, so mq>0mq > 0: qq has the sign of mm, dd has the sign of mm or is 0, and ∣d∣<32∣m∣−t2<32∣m∣|d| < \frac32|m| - \frac t2 < \frac32 |m|, that is less than 34W\frac34 W. If ∣d∣>t|d| > t, the new point b+db + d is strictly between bb and cc. If ∣d∣≤t|d| \le t, or after a bisection, the new point is b+tsign⁡(m)b + t\operatorname{sign}(m) or b+mb + m, also strictly between bb and cc since t<∣m∣t < |m|. So the new bb is in [a0,b0][a_0, b_0]. If ff is zero there, L5 of the next pass returns a root. Otherwise L11 makes the old bb the point aa, and L3 of the next pass sets c←ac \leftarrow a when the new bb has the sign of cc; the old bb had the other sign. Either way f(b)f(b) and f(c)f(c) have opposite signs, and L4 restores ∣f(b)∣≤∣f(c)∣|f(b)| \le |f(c)| by a swap that keeps the pair. The intermediate value theorem gives the root, and W=2∣m∣≤2tW = 2|m| \le 2t at the return. □\square

Lemma 2 (the width falls). If a pass does not return, the new width satisfies W′≤W−tW' \le W - t. After a bisection, W′=W/2W' = W/2.

Proof. Let b′b' be the new point, strictly between bb and cc, with ∣b′−b∣≥t|b' - b| \ge t (L11). If the contrapoint stays, W′=∣c−b′∣=W−∣b′−b∣≤W−tW' = |c - b'| = W - |b' - b| \le W - t. If L3 sets the contrapoint to the old bb, then W′=∣b′−b∣W' = |b' - b|, which is less than 34W−t2\frac34 W - \frac t2 for an accepted step, equals tt for a minimum step, and equals W/2W/2 for a bisection; since W>2tW > 2t, each of these is at most W−tW - t. After a bisection b′=b+mb' = b + m is the midpoint, so W′=W/2W' = W/2 in both cases. The swap at L4 does not change WW. □\square

Theorem 3 (termination). For δ>0\delta > 0, BRENT returns within ⌈2w/δ⌉\lceil 2w/\delta \rceil passes. For any δ≥0\delta \ge 0 it ends within kmax⁡k_{\max} passes.

Proof. As for Dekker's method: t≥δ/2t \ge \delta/2, so by Lemma 2 after jj passes 0<W≤w−jδ/20 < W \le w - j\delta/2. □\square

Theorem 4 (the k2k^2 bound). Let δ>0\delta > 0 and k=⌈log⁡2(w/δ)⌉k = \lceil \log_2(w/\delta) \rceil. BRENT returns within 2(k+2)22(k + 2)^2 passes, that is with at most 2(k+2)2+22(k + 2)^2 + 2 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 d=e=b−ad = e = b - a, of size ww, and a bisection sets d=e=md = e = m, of size at most ww.

Bisections. By Lemma 2 the width never grows, and a bisection halves it. After jj bisections, W≤w2−jW \le w 2^{-j}. A pass that does not return has W>2t≥δW > 2t \ge \delta, so j<log⁡2(w/δ)≤kj < \log_2(w/\delta) \le k: there are at most kk bisections.

Runs of interpolation passes. A run is a maximal sequence of interpolation passes; it starts at the beginning or after a bisection, when ∣d∣,∣e∣≤w|d|, |e| \le w. We claim that after $ passes of a run, at the next test of L6, ∣d∣≤w2−⌈i/2⌉|d| \le w 2^{-\lceil i/2 \rceil} and ∣e∣≤w2−⌊i/2⌋|e| \le w 2^{-\lfloor i/2 \rfloor}. This holds for = 0.Anacceptedstephas∣p∣<∣eq∣. An accepted step has |p| < |eq|, so the new $ is less than ∣e∣/2≤w2−⌊i/2⌋−1=w2−⌈(i+1)/2⌉|e|/2 \le w 2^{-\lfloor i/2 \rfloor - 1} = w 2^{-\lceil (i+1)/2 \rceil}, and the new $ is the old ,atmost2−⌈i/2⌉=w2−⌊(i+1)/2⌋, at most 2^{-\lceil i/2 \rceil} = w 2^{-\lfloor (i+1)/2 \rfloor}. A reset at L3 sets = e = b - a$, the move just made. If that move was a step $ with ∣d∣>t|d| > t, the reset sets both to the stored ∣d∣|d| 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 ∣e∣≥t≥δ/2|e| \ge t \ge \delta/2 at L6, so 2^{-\lfloor i/2 \rfloor} \ge \delta/2$, which gives ⌊i/2⌋≤k+1\lfloor i/2 \rfloor \le k + 1 and \le 2k + 3.Soarunhasatmostk+4. So a run has at most k + 4 passes; after it, L6 fails or L9 rejects, and both are bisections.

Count. There are at most k+1k + 1 runs (one before each bisection and one after the last), each with at most 2k+42k + 4 passes, and at most kk bisections: in all at most (k+1)(2k+4)+k≤2(k+2)2(k + 1)(2k + 4) + k \le 2(k + 2)^2 passes. Each pass costs one evaluation, and the start costs two. □\square

The constant in Theorem 4 is not sharp; Brent (1973, Chapter 4) counts more carefully and obtains a bound of the same order k2k^2. The bound is far above what happens on smooth functions, where the method needs about log⁡log⁡(1/δ)\log\log(1/\delta) 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. ■\blacksquare

Back to Brent's method