1. 初等解法
对于如下二阶线性差分方程:
f
(
n
)
=
a
f
(
n
−
1
)
+
b
f
(
n
−
2
)
,
b
≠
0
(1-1)
f(n)=af(n-1)+bf(n-2), b\neq0\tag{1-1}
f(n)=af(n−1)+bf(n−2),b=0(1-1)
我们希望构造出含
f
(
n
)
f(n)
f(n)和
f
(
n
−
1
)
f(n-1)
f(n−1)的等比数列。
用待定系数法,两边同时减
k
f
(
n
−
1
)
kf(n-1)
kf(n−1):
f
(
n
)
−
k
f
(
n
−
1
)
=
(
a
−
k
)
f
(
n
−
1
)
+
b
f
(
n
−
2
)
(1-2)
f(n)-kf(n-1)=(a-k)f(n-1)+bf(n-2)\tag{1-2}
f(n)−kf(n−1)=(a−k)f(n−1)+bf(n−2)(1-2)
令
g
(
n
)
=
f
(
n
)
−
k
f
(
n
−
1
)
g(n)=f(n)-kf(n-1)
g(n)=f(n)−kf(n−1),我们希望构造出
g
(
n
)
=
(
a
−
k
)
g
(
n
−
1
)
=
(
a
−
k
)
(
f
(
n
−
1
)
−
k
f
(
n
−
2
)
)
\begin{align*} g(n)&=(a-k)g(n-1)\\ &=(a-k)(f(n-1)-kf(n-2))\\ \tag{1-3} \end{align*}
g(n)=(a−k)g(n−1)=(a−k)(f(n−1)−kf(n−2)),则有
−
k
(
a
−
k
)
=
b
-k(a-k)=b
−k(a−k)=b,进而有
k
2
−
a
k
−
b
=
0
(1-4)
k^2-ak-b=0\tag{1-4}
k2−ak−b=0(1-4)
该方程称为特征方程。
根据求根公式,得到两个解
k
1
=
a
+
a
2
+
4
b
2
,
k
2
=
a
−
a
2
+
4
b
2
k_1=\frac{a+\sqrt{a^2+4b}}{2},k_2=\frac{a-\sqrt{a^2+4b}}{2}
k1=2a+a2+4b,k2=2a−a2+4b
根据韦达定理:
k
1
+
k
2
=
a
k
1
k
2
=
−
b
\begin{align*} k_1+k_2&=a\\ k_1k_2&=-b\\ \tag{1-5} \end{align*}
k1+k2k1k2=a=−b
令
k
=
k
1
k=k_1
k=k1,则有
g
(
n
)
=
f
(
n
)
−
k
1
f
(
n
−
1
)
=
(
a
−
k
1
)
g
(
n
−
1
)
=
k
2
n
−
2
g
(
2
)
\begin{align*} g(n)&=f(n)-k_1f(n-1)\\ &=(a-k_1)g(n-1)\\ &=k_2^{n-2}g(2) \tag{1-6} \end{align*}
g(n)=f(n)−k1f(n−1)=(a−k1)g(n−1)=k2n−2g(2)(1-6)
也即有
f
(
n
)
=
k
1
f
(
n
−
1
)
+
k
2
n
−
2
g
(
2
)
(1-7)
f(n)=k_1f(n-1)+k_2^{n-2}g(2)\tag{1-7}
f(n)=k1f(n−1)+k2n−2g(2)(1-7)
对上式进行展开:
f
(
n
)
=
k
1
f
(
n
−
1
)
+
k
2
n
−
2
g
(
2
)
=
k
1
(
k
1
f
(
n
−
2
)
+
k
2
n
−
3
g
(
2
)
)
+
k
2
n
−
2
g
(
2
)
=
k
1
2
f
(
n
−
2
)
+
k
1
k
2
n
−
3
g
(
2
)
+
k
2
n
−
2
g
(
2
)
=
k
1
n
−
1
f
(
1
)
+
k
1
n
−
2
k
2
0
g
(
2
)
+
k
1
n
−
3
k
2
1
g
(
2
)
+
⋯
+
k
1
0
k
2
n
−
2
g
(
2
)
\begin{align*} f(n)&=k_1f(n-1)+k_2^{n-2}g(2)\\ &=k_1(k_1f(n-2)+k_2^{n-3}g(2))+k_2^{n-2}g(2)\\ &=k_1^2f(n-2)+k_1k_2^{n-3}g(2)+k_2^{n-2}g(2)\\ &=k_1^{n-1}f(1)+k_1^{n-2}k_2^{0}g(2)+k_1^{n-3}k_2^{1}g(2)+\cdots+k_1^{0}k_2^{n-2}g(2)\\ \tag{1-8} \end{align*}
f(n)=k1f(n−1)+k2n−2g(2)=k1(k1f(n−2)+k2n−3g(2))+k2n−2g(2)=k12f(n−2)+k1k2n−3g(2)+k2n−2g(2)=k1n−1f(1)+k1n−2k20g(2)+k1n−3k21g(2)+⋯+k10k2n−2g(2)
若
k
1
=
k
2
=
k
k_1=k_2=k
k1=k2=k,则
f
(
n
)
=
k
n
−
1
f
(
1
)
+
g
(
2
)
(
n
−
1
)
k
n
−
2
=
(
f
(
1
)
k
−
g
(
2
)
k
2
+
g
(
2
)
k
2
n
)
k
n
\begin{align*} f(n)&=k^{n-1}f(1)+g(2)(n-1)k^{n-2}\\ &=(\frac{f(1)}{k}-\frac{g(2)}{k^2}+\frac{g(2)}{k^2}n)k^n \tag{1-9} \end{align*}
f(n)=kn−1f(1)+g(2)(n−1)kn−2=(kf(1)−k2g(2)+k2g(2)n)kn(1-9)
令:
c
1
=
f
(
1
)
k
−
g
(
2
)
k
2
c
2
=
g
(
2
)
k
2
\begin{align*} c_1&=\frac{f(1)}{k}-\frac{g(2)}{k^2}\\ c_2&=\frac{g(2)}{k^2}\\ \tag{1-10} \end{align*}
c1c2=kf(1)−k2g(2)=k2g(2)
则:
f
(
n
)
=
c
1
k
1
n
+
c
2
k
2
n
(1-11)
f(n)=c_1k_1^n+c_2k_2^n\tag{1-11}
f(n)=c1k1n+c2k2n(1-11)
若
k
1
≠
k
2
k_1\neq k_2
k1=k2,则
f
(
n
)
=
f
(
1
)
k
1
n
−
1
+
g
(
2
)
k
1
n
−
1
−
k
2
n
−
1
k
1
−
k
2
=
1
k
1
(
f
(
1
)
+
g
(
2
)
k
1
−
k
2
)
k
1
n
+
1
k
2
(
−
g
(
2
)
k
1
−
k
2
)
k
2
n
\begin{align*} f(n)&=f(1)k_1^{n-1}+g(2)\frac{k_1^{n-1}-k_2^{n-1}}{k_1-k_2}\\ &=\frac{1}{k_1}(f(1)+\frac{g(2)}{k_1-k_2})k_1^n+\frac{1}{k_2}(-\frac{g(2)}{k_1-k_2})k_2^n\\ \tag{1-12} \end{align*}
f(n)=f(1)k1n−1+g(2)k1−k2k1n−1−k2n−1=k11(f(1)+k1−k2g(2))k1n+k21(−k1−k2g(2))k2n
令
c
1
=
1
k
1
(
f
(
1
)
+
g
(
2
)
k
1
−
k
2
)
c
2
=
1
k
2
(
−
g
(
2
)
k
1
−
k
2
)
\begin{align*} c_1&=\frac{1}{k_1}(f(1)+\frac{g(2)}{k_1-k_2})\\ c_2&=\frac{1}{k_2}(-\frac{g(2)}{k_1-k_2})\\ \tag{1-13} \end{align*}
c1c2=k11(f(1)+k1−k2g(2))=k21(−k1−k2g(2))
则
f
(
n
)
=
c
1
k
1
n
+
c
2
k
2
n
(1-14)
f(n)=c_1k_1^n+c_2k_2^n\tag{1-14}
f(n)=c1k1n+c2k2n(1-14)
1.1. 特例之Fibonacci数列
当
f
(
1
)
=
1
,
f
(
2
)
=
1
,
a
=
1
,
,
b
=
1
f(1)=1,\ f(2)=1,\ a=1,\ ,b=1
f(1)=1, f(2)=1, a=1, ,b=1时,就是大家熟知的Fibonacci数列的递推式。此时特征方程为:
k
2
−
k
−
1
=
0
(1-15)
k^2-k-1=0\tag{1-15}
k2−k−1=0(1-15)
两个解分别为:
k
1
=
1
+
5
2
,
k
2
=
1
−
5
2
k_1=\frac{1+\sqrt{5}}{2},\ k_2=\frac{1-\sqrt{5}}{2}
k1=21+5, k2=21−5, 辅助变量
g
(
2
)
=
1
−
k
g(2)=1-k
g(2)=1−k
代入(1-13)和(1-14)得通项公式为:
f
(
n
)
=
1
5
(
1
+
5
2
)
n
−
1
5
(
1
−
5
2
)
n
(1-16)
f(n)=\frac{1}{\sqrt{5}}\left(\frac{1+\sqrt{5}}{2}\right)^n-\frac{1}{\sqrt{5}}\left(\frac{1-\sqrt{5}}{2}\right)^n\tag{1-16}
f(n)=51(21+5)n−51(21−5)n(1-16)
2. 高等解法
(待补充)