裴波那契数列:1,1,2,3,5,8,13,.
裴波那契数列递推公式:F(n+2) = F(n+1) + F(n)
F(1)=F(2)=1.
它的通项求解如下:
F(n+2) = F(n+1) + F(n) => F(n+2) - F(n+1) - F(n) = 0
令 F(n+2) - aF(n+1) = b(F(n+1) - aF(n))
展开 F(n+2) - (a+b)F(n+1) + abF(n) = 0
显然 a+b=1 ab=-1
由韦达定理知 a、b为二次方程 x^2 - x - 1 = 0 的两个根
解得 a = (1 + √5)/2,b = (1 -√5)/2 或 a = (1 -√5)/2,b = (1 + √5)/2
令G(n) = F(n+1) - aF(n),则G(n+1) = bG(n),且G(1) = F(2) - aF(1) = 1 - a = b,因此G(n)为等比数列,G(n) = b^n ,即
F(n+1) - aF(n) = G(n) = b^n --------(1)
在(1)式中分别将上述 a b的两组解代入,由于对称性不妨设x = (1 + √5)/2,y = (1 -√5)/2,得到:
F(n+1) - xF(n) = y^n
F(n+1) - yF(n) = x^n
以上两式相减得:
(x-y)F(n) = x^n - y^n
F(n) = (x^n - y^n)/(x-y) = {[(1+√5)/2]^n-[(1-√5)/2]^n}/√5