# 二分法

二分法是一种求根算法：它反复对一段使连续函数变号的区间进行折半，最终收敛到方程 \( f(x) = 0 \) 的一个根。它取一段区间 [a, b]，使 f(a) 与 f(b) 异号，计算中点，保留仍含变号的那一半区间，如此重复；人们称它简单、稳健、直截了当。<sup>[1](https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/10RootFinding/bisection/complete.html)</sup> 收敛是有保证的，但只是线性的：每次迭代只获得固定量的精度，不像牛顿法那样加速。<sup>[2](https://pages.cs.wisc.edu/~sifakis/courses/cs412-s13/lecture_notes/CS412_5_Feb_2013.pdf)</sup>

| 关键事实 | 内容 |
|---|---|
| 产出什么 | 一列收敛到根的中点，根始终被括住<sup>[1](https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/10RootFinding/bisection/complete.html)</sup> |
| 保证 | 对连续函数 f，若 \( f(a) \cdot f(b) < 0 \)，介值定理保证 (a, b) 内有根<sup>[3](https://sites.math.rutgers.edu/~falk/math373/lecture2.pdf)</sup> |
| 误差界 | \( \|p_{n} - p\| \le (b-a)/2^{n} \)<sup>[4](https://web.stanford.edu/class/math114/lecture_notes/bisection_method_notes.pdf)</sup> |
| 收敛阶 | 线性：误差界每步减半，约每 10 次迭代增加 3 位正确有效数字<sup>[2](https://pages.cs.wisc.edu/~sifakis/courses/cs412-s13/lecture_notes/CS412_5_Feb_2013.pdf)</sup> |
| 达到容差所需迭代数 | 若经 n 次折半后中点误差至多为 \( E_{\mathrm{tol}} \)，则 \( n = \lceil \log_{2}((b-a)/E_{\mathrm{tol}}) \rceil - 1 \)（采用非严格停止判据），可事先确定<sup>[5](https://lemesurierb.people.charleston.edu/numerical-methods-and-analysis-python/main/root-finding-by-interval-halving-python.html)</sup> |
| 每次迭代代价 | 一次 f 的求值<sup>[6](https://www.allisone.co.jp/lib/sangi/theory/Roots-1d-bracketing_en.html)</sup> |
| 主要局限 | 无法定位偶重根，此时 f 不变号<sup>[4](https://web.stanford.edu/class/math114/lecture_notes/bisection_method_notes.pdf)</sup> |

## 工作原理

该方法建立在介值定理之上：若 f 在 \( [a, b] \) 上连续且 \( f(a) \cdot f(b) < 0 \)，则至少有一个数 s 满足 \( a < s < b \) 且 \( f(s) = 0 \)。<sup>[3](https://sites.math.rutgers.edu/~falk/math373/lecture2.pdf)</sup> 由于变号必落在两个半区间之一，每一步都产生一个更小的、仍含根的括号，这些区间嵌套收缩到一点。

这种嵌套论证是经典的证明手法：变号定理正是通过折半区间来证明的，其依据是——一列一个套一个的闭区间必定至少含有一个属于每个区间的点。<sup>[7](https://link.springer.com/article/10.1007/s44007-025-00182-w)</sup> 于是该算法既证明了介值定理，又提供了求根的实用方法。<sup>[8](https://www.drkhamsi.com/sosmath/calculus/limcon/limcon07/limcon07.html)</sup>

收敛是线性的。若 h 为当前区间长度，根可能任意靠近任一端点，故最大误差为 h，而每一步将其减半；该技术在每次迭代中把误差缩减为 O(h)。<sup>[9](https://ece.uwaterloo.ca/~dwharder/nm/Lecture_materials/pdfs/6.2.2%20Bisection%20method.pdf)</sup> 由于 \( 0.5^{10} \approx 0.001 \)，该方法每 10 次迭代约增加 3 位正确有效数字。<sup>[2](https://pages.cs.wisc.edu/~sifakis/courses/cs412-s13/lecture_notes/CS412_5_Feb_2013.pdf)</sup>

## 具体做法

标准伪代码接受端点 a、b、容差 TOL 和最大迭代次数 \( N_{0} \)。每一步计算中点 \( p = a + (b-a)/2 \)，并求值 \( \mathrm{FP} = f(p) \)。当 \( \mathrm{FP} = 0 \) 或 \( (b-a)/2 < \mathrm{TOL} \) 时，该步成功停止；否则，若 \( f(a) \cdot f(p) > 0 \)，根在右半，故令 a = p，否则令 b = p。经 \( N_{0} \) 次迭代后报告失败。<sup>[10](https://math.gsu.edu/xye/course/na_handout/slides/bisec.pdf)</sup> 一种等价的紧凑写法在 \( c = (a+b)/2 \) 处计算 \( d = f(c) \cdot f(a) \)：若 \( d < 0 \) 则令 \( b = c \)，若 \( d > 0 \) 则令 \( a = c \)，若 \( d = 0 \) 则 c 即为解。<sup>[11](https://people.clas.ufl.edu/kees/files/Bisection.pdf)</sup>

**停止判据。** 除区间长度判据外，常见判据还有 \( \|p_{N} - p_{N-1}\| < \epsilon \) 以及最大迭代次数上限；没有唯一最佳判据，选择取决于所求解的方程。<sup>[12](https://sites.millersville.edu/rbuchanan/math375/Bisection.pdf)</sup> 由于误差界可预测地减半，迭代次数可事先固定：若中点误差至多为 \( E_{\mathrm{tol}} \)，则 \( n = \lceil \log_{2}((b-a)/E_{\mathrm{tol}}) \rceil - 1 \)（采用非严格停止判据），因为当 \( (b-a) \) 恰为 \( E_{\mathrm{tol}} \) 的 2 的整数次幂倍时，严格判据可能提前一步停止。<sup>[5](https://lemesurierb.people.charleston.edu/numerical-methods-and-analysis-python/main/root-finding-by-interval-halving-python.html)</sup> 等价地，经 k 次折半后的先验估计为 \( \|c_{k} - r\| \le 2^{-(k+1)}(b-a) \)。<sup>[13](https://wiki.math.ntnu.no/_media/tma4125/2024v/nonlinearequations.pdf)</sup>

**浮点行为。** 即便是中点公式在有限精度下也有问题：\( a + b \) 可能溢出，且在某些舍入模式下，算出的中点未必落在 [a, b] 内。<sup>[14](https://www.math.csi.cuny.edu/~verzani/Classes/Old/F2015/MTH335/Notes/Chapter3/bisection.html)</sup> 机器数中点只有有限多个，因此像 \( \sqrt{2} \) 这样的值无法精确表示，精确算术下的收敛性不能直接照搬；此时改用基于阈值的停止判据。<sup>[14](https://www.math.csi.cuny.edu/~verzani/Classes/Old/F2015/MTH335/Notes/Chapter3/bisection.html)</sup> 《Numerical Recipes》建议把容差取为括号两端绝对值之和的一半乘以机器精度，且其例程无论如何在 40 次折半后退出。<sup>[15](https://iate.oac.uncor.edu/~mario/materia/nr/numrec/f9-2.pdf)</sup>

## 起源

二分算法没有单一的源出论文；它属于教科书和民间传承的材料。折半区间的证明确立了其标题所述的变号求根定理，而证明方法正对应史家所称的二分法。<sup>[7](https://link.springer.com/article/10.1007/s44007-025-00182-w)</sup> 有据可查的现代里程碑是以二分法作为兜底的混合算法：R. P. 布伦特（R. P. Brent）1971 年发表于《The Computer Journal》的论文《一种保证收敛的函数零点求解算法》。<sup>[16](https://doi.org/10.1093/comjnl/14.4.422)</sup>

## 变体

**试位法（regula falsi）** 用经过 (a, f(a)) 与 (b, f(b)) 的割线的 x 轴截距代替中点，该割线即 f 在括号上的仿射线性插值。<sup>[17](https://www2.math.uconn.edu/~leykekhman/courses/MATH3795/Lectures/Lecture_12_Nonlinear_root.pdf)</sup> 它始终括住根，但括号未必收缩：对 \( x^{2} - 2 \) 在 \( [0, 2] \) 上，所有迭代点都停在根的左侧，故含根的区间不收敛到零。<sup>[3](https://sites.math.rutgers.edu/~falk/math373/lecture2.pdf)</sup>

**伊利诺伊算法** 修正了这种端点粘滞的失效：当同一端点将被保留时，在下次插值前把它的函数值减半（以 \( f/2 \) 代替 f），从而加快收敛。按特劳布效率指数，其计算效率为 \( 3^{1/3} \approx 1.442 \)，而未修改的试位法为 1；测试对比显示，伊利诺伊算法需 9 至 11 次迭代，二分法需 64 次，试位法需 23 至 42 次。这一改进已进入计算技术的民间传承。<sup>[18](https://personal.math.ubc.ca/~loew/mech2/Dowell+Jarratt.pdf)</sup>

**德克–布伦特法与布伦特方法** 把二分法的括根能力与割线法更高的收敛速度结合起来，在保留括号的同时适时使用插值；该方法实现在 Matlab 的 fzero 中。<sup>[3](https://sites.math.rutgers.edu/~falk/math373/lecture2.pdf)</sup> 布伦特 1971 年的算法把线性插值、反二次插值与二分法结合；收敛通常是超线性的，且绝不比二分法慢太多，文中给出了 ALGOL 60 过程。<sup>[16](https://doi.org/10.1093/comjnl/14.4.422)</sup>

更广泛的括根族对比如下：<sup>[6](https://www.allisone.co.jp/lib/sangi/theory/Roots-1d-bracketing_en.html)</sup>

| 方法 | 每次迭代 f 求值数 | 阶 | 最坏情况 |
|---|---|---|---|
| 二分法 | 1 | 线性（1/2） | \( \log_{2}((b-a)/\epsilon) \) 次迭代，始终安全 |
| 试位法 | 1 | 不定 | 无界（端点粘滞） |
| 伊利诺伊、安德森–比约克 | 1 | 超线性 | 有界 |
| 里德斯 | 2 | \( \sqrt{2} \) | 有界 |
| 布伦特 | 1 | 1.6–1.8 | 二分法的数倍；事实标准 |
| TOMS 748 | 1 | \( \approx 1.84 \) | 优于布伦特 |
| ITP | 1 | 超线性 | 最坏情况 \( \le \) 二分法 |

## 应用

二分法既可作为独立的稳健求解器，也可作为混合求解器内部的安全网：计算器的方程求解器通常把二分法与牛顿–拉夫森法结合，<sup>[8](https://www.drkhamsi.com/sosmath/calculus/limcon/limcon07/limcon07.html)</sup> 而 Matlab 的 fzero 实现的是德克–布伦特混合法。<sup>[3](https://sites.math.rutgers.edu/~falk/math373/lecture2.pdf)</sup> 由于它非常稳健，且尽管只有线性收敛，却能在任意所需容差内逼近根，人们常用它来定位初值，再由牛顿法精化。<sup>[2](https://pages.cs.wisc.edu/~sifakis/courses/cs412-s13/lecture_notes/CS412_5_Feb_2013.pdf)</sup>

## 局限与替代方法

当前提不成立时，二分法失效。它无法定位偶重根，此时函数不变号，<sup>[4](https://web.stanford.edu/class/math114/lecture_notes/bisection_method_notes.pdf)</sup> 而且只有先找到函数值异号的起点 a 与 b 才能工作。然而在这一前提之内，它总是有效，而牛顿–拉夫森法在 f′(x) 为零或接近零处可能崩溃或变得不可靠。<sup>[8](https://www.drkhamsi.com/sosmath/calculus/limcon/limcon07/limcon07.html)</sup>

**速度比较。** 牛顿法二次收敛，当 \( \|e_{0}\| < 1/M \) 时 \( \|e_{k+1}\| \le M\|e_{k}\|^{2} \)，而二分法只是线性减半。<sup>[13](https://wiki.math.ntnu.no/_media/tma4125/2024v/nonlinearequations.pdf)</sup> 割线法以 \( d = (1 + \sqrt{5})/2 \approx 1.6 \) 的阶超线性收敛；实践中它可能比牛顿法多需约 50% 的迭代，但每次迭代更便宜，因为不计算导数；与牛顿法一样，当 f′(x) ≈ 0 时它有除以近零量的风险。<sup>[2](https://pages.cs.wisc.edu/~sifakis/courses/cs412-s13/lecture_notes/CS412_5_Feb_2013.pdf)</sup> 对在根附近光滑的函数，试位法和割线法通常比二分法收敛更快。<sup>[15](https://iate.oac.uncor.edu/~mario/materia/nr/numrec/f9-2.pdf)</sup> 二分法只对一般的变号函数类才是极小极大最优的，对更窄的函数类则不然——这正是德克算法与布伦特算法的动机。<sup>[19](https://maths-people.anu.edu.au/~brent/pub/pub011.html)</sup> 实践中，当有保证的括号比速度更重要时，或作为更快方法的定位阶段与兜底，人们更偏好二分法。<sup>[2](https://pages.cs.wisc.edu/~sifakis/courses/cs412-s13/lecture_notes/CS412_5_Feb_2013.pdf)</sup>

## References

1. [Topic 10.1: Bisection Method (University of Waterloo)](https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/10RootFinding/bisection/complete.html)
2. [CS412 lecture notes: The Bisection method and secant method (UW–Madison, Sifakis)](https://pages.cs.wisc.edu/~sifakis/courses/cs412-s13/lecture_notes/CS412_5_Feb_2013.pdf)
3. [Math 373 Lecture 2: False Position, Secant, Dekker-Brent, Newton (Rutgers)](https://sites.math.rutgers.edu/~falk/math373/lecture2.pdf)
4. [Bisection Method lecture notes (Stanford Math 114)](https://web.stanford.edu/class/math114/lecture_notes/bisection_method_notes.pdf)
5. [Root Finding by Interval Halving (Bisection), Numerical Methods and Analysis with Python](https://lemesurierb.people.charleston.edu/numerical-methods-and-analysis-python/main/root-finding-by-interval-halving-python.html)
6. [1D Root Finding: Bracketing Methods | sangi Algorithm Guide](https://www.allisone.co.jp/lib/sangi/theory/Roots-1d-bracketing_en.html)
7. [Bolzano and the Foundation of the Real Continuum (La Matematica, Springer)](https://link.springer.com/article/10.1007/s44007-025-00182-w)
8. [The Bisection Method (S.O.S. Mathematics)](https://www.drkhamsi.com/sosmath/calculus/limcon/limcon07/limcon07.html)
9. [Bisection method, ECE 6.2.2 lecture notes (University of Waterloo)](https://ece.uwaterloo.ca/~dwharder/nm/Lecture_materials/pdfs/6.2.2%20Bisection%20method.pdf)
10. [Section 2: Bisection (Burden & Faires-style pseudocode, GSU)](https://math.gsu.edu/xye/course/na_handout/slides/bisec.pdf)
11. [Bisection Method (University of Florida course notes)](https://people.clas.ufl.edu/kees/files/Bisection.pdf)
12. [Bisection Method, MATH 375 Numerical Analysis (Millersville)](https://sites.millersville.edu/rbuchanan/math375/Bisection.pdf)
13. [Numerical Solution of Nonlinear Equations (NTNU TMA4125)](https://wiki.math.ntnu.no/_media/tma4125/2024v/nonlinearequations.pdf)
14. [Bisection Method in floating point (CUNY MTH 335 notes)](https://www.math.csi.cuny.edu/~verzani/Classes/Old/F2015/MTH335/Notes/Chapter3/bisection.html)
15. [Numerical Recipes §9.2 (false position and secant vs bisection)](https://iate.oac.uncor.edu/~mario/materia/nr/numrec/f9-2.pdf)
16. [R. P. Brent (1971). An algorithm with guaranteed convergence for finding a zero of a function. The Computer Journal.](https://doi.org/10.1093/comjnl/14.4.422)
17. [MATH 3795 Lecture 12: Numerical Solution of Nonlinear Equations (Regula Falsi, UConn)](https://www2.math.uconn.edu/~leykekhman/courses/MATH3795/Lectures/Lecture_12_Nonlinear_root.pdf)
18. [A modified regula falsi method for computing the root of an equation (Dowell & Jarratt)](https://personal.math.ubc.ca/~loew/mech2/Dowell+Jarratt.pdf)
19. [Algorithms for Finding Zeros and Extrema of Functions Without Calculating Derivatives (Brent's Stanford PhD thesis)](https://maths-people.anu.edu.au/~brent/pub/pub011.html)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数学分析与数学模型 › Numerical analysis and computation

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/bisection-method

English original: https://www.edgepedia.org/bisection-method
