# 比内公式

**比内公式**是第n个斐波那契数的闭式表达式，它直接由下标n算出结果，无需沿递推式逐项迭代：

\[ F_n = \frac{\varphi^{n} - \psi^{n}}{\sqrt{5}} \]

其中 \( \varphi = \tfrac{1+\sqrt{5}}{2} \)（黄金比）与 \( \psi = \tfrac{1-\sqrt{5}}{2} \) 是方程 \( x^2 - x - 1 = 0 \) 的两个根。<sup>[1](https://planetmath.org/derivationofbinetformula)</sup>法国数学家雅克·菲利普·马里·比内（Jacques Philippe Marie Binet，1786–1856）于1843年发现该公式，公式遂以他命名，尽管欧拉（Euler）早在1765年就已发表过它，而亚伯拉罕·棣莫弗（Abraham de Moivre）1730年的著作中也出现过一种形式。<sup>[2](https://mathshistory.st-andrews.ac.uk//Biographies/Binet/)</sup><sup> • </sup><sup>[3](https://r-knott.surrey.ac.uk/Fibonacci/fibFormula.html)</sup><sup> • </sup><sup>[4](https://cubbi.com/fibonacci.html)</sup>

| 关键事实 | 细节 |
|---|---|
| 公式 | \( F_n = (\varphi^n - \psi^n)/\sqrt{5} \)，其中 \( \varphi = (1+\sqrt{5})/2 \)，\( \psi = (1-\sqrt{5})/2 \)<sup>[1](https://planetmath.org/derivationofbinetformula)</sup> |
| 舍入形式 | 由于对所有n都有 \( |\psi^n/\sqrt{5}| < 1/2 \)，\( F_n \) 就等于 \( \varphi^n/\sqrt{5} \) 四舍五入到最近整数所得的结果<sup>[5](https://www.cs.toronto.edu/~shaharry/csc236-summer-2025/lectures/l5-b.html)</sup> |
| 归属 | 比内于1843年发表；欧拉1765年发表过该公式，棣莫弗1730年给出过一种形式<sup>[2](https://mathshistory.st-andrews.ac.uk//Biographies/Binet/)</sup><sup> • </sup><sup>[3](https://r-knott.surrey.ac.uk/Fibonacci/fibFormula.html)</sup><sup> • </sup><sup>[4](https://cubbi.com/fibonacci.html)</sup> |
| 实用极限 | 在IEEE-754双精度下，浮点舍入会使公式在大约 \( F(70) \) 之后出错<sup>[6](https://unseel.com/cs/matrix-exponentiation)</sup> |
| 模运算 | 该公式不能用来计算斐波那契数模m，因为它含有无理数 \( \sqrt{5} \)<sup>[6](https://unseel.com/cs/matrix-exponentiation)</sup> |
| 推广 | 对k阶广义斐波那契数（三重斐波那契数、四重斐波那契数等等）存在比内式公式，取最接近主项的整数即可生成整个数列<sup>[7](https://arxiv.org/abs/0905.0304)</sup> |

## 推导

斐波那契递推式 \( f_n = f_{n-1} + f_{n-2} \) 的特征多项式为 \( x^2 = x + 1 \)，其根为 \( \varphi = \tfrac{1+\sqrt{5}}{2} \) 与 \( \psi = \tfrac{1-\sqrt{5}}{2} \)。因此任何满足该递推式的数列都必是 \( f_n = u\varphi^n + v\psi^n \) 的形式，其中u、v为某两个实数。边界条件 \( f_0 = 0 \) 与 \( f_1 = 1 \) 给出方程组 \( u + v = 0 \) 和 \( u\varphi + v\psi = 1 \)。由第一式得 \( u = -v \)，代入第二式得 \( u\sqrt{5} = 1 \)，故 \( u = 1/\sqrt{5} \)、\( v = -1/\sqrt{5} \)，公式由此得出。<sup>[1](https://planetmath.org/derivationofbinetformula)</sup>

等价的路径来自线性代数。将递推式写成矩阵方程，取 \( A = \begin{pmatrix}1 & 1\\1 & 0\end{pmatrix} \)，则A的特征值恰为 \( \varphi \) 与 \( \psi \)；把A对角化，再将 \( A^n \) 作用于初始向量，化简即得 \( F_n = (\varphi^n - \psi^n)/\sqrt{5} \)。<sup>[8](https://webhome.auburn.edu/~mip0024/teaching/math2660/slides/28-diagonalization.html)</sup>

## 舍入形式

因为 \( 1 - \varphi \approx -0.618 \)，项 \( \psi^n = (1-\varphi)^n \) 随n增大迅速趋近于零。由于 \( |\psi^n/\sqrt{5}| \) 恒小于 \( 1/2 \)，\( \varphi^n/\sqrt{5} \) 与真实斐波那契数的距离不到半个整数，所以

\[ F_n = \operatorname{round}\left( \frac{\varphi^n}{\sqrt{5}} \right) \]

对每个 \( n \ge 0 \) 都给出精确答案。<sup>[5](https://www.cs.toronto.edu/~shaharry/csc236-summer-2025/lectures/l5-b.html)</sup><sup> • </sup><sup>[3](https://r-knott.surrey.ac.uk/Fibonacci/fibFormula.html)</sup>这是一个引人注目的性质：公式虽含有 \( \sqrt{5} \)、\( \varphi \)、\( \psi \) 这些无理数，却生成精确的整数。<sup>[3](https://r-knott.surrey.ac.uk/Fibonacci/fibFormula.html)</sup>

该公式还把斐波那契数推广到负下标。按“每个数是其左边两数之和”的规则反向延展数列，得 \( F(-1) = 1 \)、\( F(-2) = -1 \)、\( F(-3) = 2 \)，如此等等，符号交替，而比内公式对所有负整数n都与这些值相符。<sup>[3](https://r-knott.surrey.ac.uk/Fibonacci/fibFormula.html)</sup>

## 为什么在浮点下失效

在数学上该公式是精确的，但用有限精度算术去求值却不然。在IEEE-754双精度下，舍入误差会使计算值在大约 \( F(70) \) 之后出错，因此该公式被形容为一件有趣之物，而非精确计算的实用工具。<sup>[6](https://unseel.com/cs/matrix-exponentiation)</sup>它也不能用于计算斐波那契数模素数的常见任务，因为无理数 \( \sqrt{5} \) 在模算术中没有表示；完全以整数运作的矩阵幂与快速倍加法既能处理模运算情形，也能处理任意精度情形。<sup>[6](https://unseel.com/cs/matrix-exponentiation)</sup>

**更高的精度能恢复它。**使用诸如Python的mpmath这类任意精度库时，工作位数必须超过 \( F_n \) 的位数若干保护位（为吸收舍入误差而额外保留的位数）。只保留2个保护位计算 \( F(10{,}000) \)，结果的最后一位就是错的；\( F(1{,}000{,}000) \) 则需要5个保护位。由于所需位数随n线性增长，每次乘法的开销也随之增长，所以对精确结果而言，该公式并非真正的常数时间。<sup>[9](https://www.johndcook.com/blog/2026/02/08/computing-large-fibonacci-numbers/)</sup>在计时比较中，迭代法在 \( n = 1{,}000 \) 时更快，而采用mpmath的比内方法在 \( n = 10{,}000 \) 时更快，在 \( n = 1{,}000{,}000 \) 时明显更快（约2.07秒，迭代法则需11.17秒）。<sup>[9](https://www.johndcook.com/blog/2026/02/08/computing-large-fibonacci-numbers/)</sup>模检验提供了核对浮点结果的办法：斐波那契数的末几位以60为周期循环；更一般地，当m是5的幂时，该数列模m均匀分布，循环长度为4m。<sup>[9](https://www.johndcook.com/blog/2026/02/08/computing-large-fibonacci-numbers/)</sup>

## 推广

对任何特征根互异的线性递推式，都存在比内式的闭式解。对k阶广义斐波那契数（k = 3时为三重斐波那契数，k = 4时为四重斐波那契数，依此类推），其定义为前k项之和，方程 \( x^k - x^{k-1} - \cdots - 1 = 0 \) 恰有一个根 \( \alpha \) 满足 \( |\alpha| > 1 \)，其余各根都严格位于单位圆内。华盛顿与李大学（Washington and Lee University）的数学家格雷戈里·P·德累斯顿（Gregory P. Dresden）于2009年证明：取最接近简化比内式公式主项的整数，即可生成整个k阶广义数列，且该近似对所有 \( n \ge 2-k \) 都成立。<sup>[7](https://arxiv.org/abs/0905.0304)</sup>相关推广还涵盖特征值互异的递推矩阵的比内类公式<sup>[10](https://arminstraub.com/downloads/teaching/linearalgebra2-spring26/lectures-all.pdf)</sup>，以及把公式延拓到复平面上任意实参数而得到的比内-斐波那契曲线。<sup>[11](https://arxiv.org/abs/1707.09151)</sup>

## References

1. [Derivation of Binet formula, PlanetMath](https://planetmath.org/derivationofbinetformula)
2. [Jacques Binet (1786–1856), MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk//Biographies/Binet/)
3. [A Formula for the n-th Fibonacci number, Dr Ron Knott, University of Surrey](https://r-knott.surrey.ac.uk/Fibonacci/fibFormula.html)
4. [Fibonacci numbers in different programming languages, cubbi.com](https://cubbi.com/fibonacci.html)
5. [Lecture 05: Recurrences 1, CSC236, University of Toronto](https://www.cs.toronto.edu/~shaharry/csc236-summer-2025/lectures/l5-b.html)
6. [Matrix Exponentiation — Linear Recurrences in O(log n), Unseel](https://unseel.com/cs/matrix-exponentiation)
7. [Gregory P. Dresden (2009). A Simplified Binet Formula for k-Generalized Fibonacci Numbers. arXiv.](https://arxiv.org/abs/0905.0304)
8. [Diagonalization and applications, MATH 2660, Auburn University](https://webhome.auburn.edu/~mip0024/teaching/math2660/slides/28-diagonalization.html)
9. [Computing large Fibonacci numbers, John D. Cook blog](https://www.johndcook.com/blog/2026/02/08/computing-large-fibonacci-numbers/)
10. [Notes for Lecture 1, Linear Algebra, University of Houston (Armin Straub)](https://arminstraub.com/downloads/teaching/linearalgebra2-spring26/lectures-all.pdf)
11. [Generalized Fibonacci Sequences and Binet-Fibonacci Curves, arXiv](https://arxiv.org/abs/1707.09151)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Number theory

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/binets-formula

English original: https://www.edgepedia.org/binets-formula
