今天考试有一道题居然需要用倍角公式的递推形式来帮助化简递推式从而构造矩阵进行快速幂。于是我就闲的蛋疼来yy一发证明。
前置技能:
Taylor展开(欧拉公式),组合数,二项式定理
倍角公式:
对于 ∀ K ∈ N ∗ , x ∈ R \forall K\in \mathbb{N_*},x\in \mathbb{R} ∀K∈N∗,x∈R,如下公式总是成立: sin ( K ∗ x ) = sin ( x ) cos ( ( K − 1 ) ∗ x ) + cos ( x ) sin ( ( K − 1 ) ∗ x ) \sin(K*x)=\sin(x)\cos((K-1)*x)+\cos(x)\sin((K-1)*x) sin(K∗x)=sin(x)cos((K−1)∗x)+cos(x)sin((K−1)∗x) cos ( K ∗ x ) = cos ( x ) cos ( ( K − 1 ) ∗ x ) − sin ( x ) sin ( ( K − 1 ) ∗ x ) \cos(K*x)=\cos(x)\cos((K-1)*x)-\sin(x)\sin((K-1)*x) cos(K∗x)=cos(x)cos((K−1)∗x)−sin(x)sin((K−1)∗x)
推导:
由于Taylor展开: cos ( x ) = ∑ i = 0 ∞ ( − 1 ) i x 2 i ( 2 i ) ! sin ( x ) = ∑ i = 0 ∞ ( − 1 ) i x 2 i + 1 ( 2 i + 1 ) ! exp ( x ) = ∑ i = 0 ∞ x i i ! \begin{aligned} \cos(x)=&\sum_{i=0}^\infty(-1)^i\frac{x^{2i}}{(2i)!}\\ \sin(x)=&\sum_{i=0}^\infty(-1)^i\frac{x^{2i+1}}{(2i+1)!}\\ \exp(x)=&\sum_{i=0}^\infty\frac{x^{i}}{i!} \end{aligned} cos(x)=sin(x)=exp(x)=i=0∑∞(−1)i(2i)!x2ii=0∑∞(−1)i(2i+1)!x2i+1i=0∑∞i!xi
我们有欧拉公式 e i θ = exp ( i θ ) = cos ( θ ) + i sin ( θ ) e^{i\theta}=\exp(i\theta)=\cos(\theta)+i\sin(\theta) eiθ=exp(iθ)=cos(θ)+isin(θ)
所以我们得到 cos ( n θ ) + i sin ( n θ ) = exp ( i n θ ) = e i n θ = ( e i θ ) n = ( cos ( θ ) + i sin ( θ ) ) n \begin{aligned} \cos(n\theta)+i\sin(n\theta)&=\exp(in\theta)\\ &=e^{in\theta}\\ &=(e^{i\theta})^n\\ &=(\cos(\theta)+i\sin(\theta))^n \end{aligned} cos(nθ)+isin(nθ)=exp(inθ)=einθ=(eiθ)n=(cos(θ)+isin(θ))n
考虑
n
n
n为正整数的时候。
将上面的式子由二项式定理展开得到:
cos
(
n
θ
)
+
i
sin
(
n
θ
)
=
∑
r
=
0
n
C
n
r
cos
n
−
r
(
θ
)
∗
i
r
sin
r
(
θ
)
=
(
C
n
0
cos
n
(
θ
)
+
C
n
2
cos
n
−
2
(
θ
)
sin
2
(
θ
)
+
.
.
.
)
+
i
(
C
n
1
sin
(
θ
)
cos
n
−
1
(
θ
)
+
C
n
3
sin
3
(
θ
)
cos
n
−
3
(
θ
)
+
.
.
.
)
\begin{aligned} \cos(n\theta)+i\sin(n\theta)=&\sum_{r=0}^{n}C_n^{r}\cos^{n-r}(\theta)*i^r\sin^r(\theta)\\ =&(C_n^0\cos^n(\theta)+C_n^2\cos^{n-2}(\theta)\sin^2(\theta)+...)\\&+i(C_n^1\sin(\theta)\cos^{n-1}(\theta)+C_n^3\sin^{3}(\theta)\cos^{n-3}(\theta)+...) \end{aligned}
cos(nθ)+isin(nθ)==r=0∑nCnrcosn−r(θ)∗irsinr(θ)(Cn0cosn(θ)+Cn2cosn−2(θ)sin2(θ)+...)+i(Cn1sin(θ)cosn−1(θ)+Cn3sin3(θ)cosn−3(θ)+...)
实部和虚部分别对应一下就能得到: cos ( n θ ) = ∑ i = 0 ⌊ n 2 ⌋ ( − 1 ) i C n 2 i cos n − 2 i ( θ ) sin 2 i ( θ ) sin ( n θ ) = ∑ i = 1 ⌊ n − 1 2 ⌋ ( − 1 ) i C n 2 i + 1 cos n − 2 i − 1 ( θ ) sin 2 i + 1 ( θ ) \begin{aligned} \cos(n\theta)=&\sum_{i=0}^{\lfloor\frac{n}2\rfloor}(-1)^iC_n^{2i}\cos^{n-2i}(\theta)\sin^{2i}(\theta)\\ \sin(n\theta)=&\sum_{i=1}^{\lfloor\frac{n-1}2\rfloor}(-1)^iC_n^{2i+1}\cos^{n-2i-1}(\theta)\sin^{2i+1}(\theta) \end{aligned} cos(nθ)=sin(nθ)=i=0∑⌊2n⌋(−1)iCn2icosn−2i(θ)sin2i(θ)i=1∑⌊2n−1⌋(−1)iCn2i+1cosn−2i−1(θ)sin2i+1(θ)
现在我们得到了 K K K倍角公式的封闭形式
接下来只对正弦的公式进行推导,余弦的公式读者可以类似处理
我们回到原来的式子:
sin
(
K
∗
x
)
=
cos
(
x
)
sin
(
(
K
−
1
)
∗
x
)
+
sin
(
x
)
cos
(
(
K
−
1
)
∗
x
)
=
c
o
s
(
x
)
(
∑
i
=
1
⌊
K
−
2
2
⌋
(
−
1
)
i
C
K
−
1
2
i
+
1
cos
K
−
2
i
−
2
(
x
)
sin
2
i
+
1
(
x
)
)
+
sin
(
x
)
(
∑
i
=
0
⌊
K
−
1
2
⌋
(
−
1
)
i
C
K
−
1
2
i
cos
K
−
2
i
−
1
(
x
)
sin
2
i
(
x
)
)
\begin{aligned} \sin(K*x)=&\cos(x)\sin((K-1)*x)+\sin(x)\cos((K-1)*x)&\\=&cos(x)(\sum_{i=1}^{\lfloor\frac{K-2}2\rfloor}(-1)^iC_{K-1}^{2i+1}\cos^{K-2i-2}(x)\sin^{2i+1}(x))\\+&\sin(x)(\sum_{i=0}^{\lfloor\frac{K-1}2\rfloor}(-1)^iC_{K-1}^{2i}\cos^{K-2i-1}(x)\sin^{2i}(x))\\ \end{aligned}
sin(K∗x)==+cos(x)sin((K−1)∗x)+sin(x)cos((K−1)∗x)cos(x)(i=1∑⌊2K−2⌋(−1)iCK−12i+1cosK−2i−2(x)sin2i+1(x))sin(x)(i=0∑⌊2K−1⌋(−1)iCK−12icosK−2i−1(x)sin2i(x))
接下来暴力将 Σ \Sigma Σ外面的两个函数乘进去: ∑ i = 1 ⌊ K − 2 2 ⌋ ( − 1 ) i C K − 1 2 i + 1 cos K − 2 i − 1 ( x ) sin 2 i + 1 ( x ) + ∑ i = 0 ⌊ K − 1 2 ⌋ ( − 1 ) i C K − 1 2 i cos K − 2 i − 1 ( x ) sin 2 i + 1 ( x ) \begin{aligned} &\sum_{i=1}^{\lfloor\frac{K-2}2\rfloor}(-1)^iC_{K-1}^{2i+1}\cos^{K-2i-1}(x)\sin^{2i+1}(x)\\+&\sum_{i=0}^{\lfloor\frac{K-1}2\rfloor}(-1)^iC_{K-1}^{2i}\cos^{K-2i-1}(x)\sin^{2i+1}(x) \end{aligned} +i=1∑⌊2K−2⌋(−1)iCK−12i+1cosK−2i−1(x)sin2i+1(x)i=0∑⌊2K−1⌋(−1)iCK−12icosK−2i−1(x)sin2i+1(x)
接下来暴力将 Σ \Sigma Σ部分转成一样的合并同类项直接得到: ∑ i = 0 ⌊ K − 1 2 ⌋ ( − 1 ) i C K 2 i + 1 cos K − 2 i − 1 ( x ) s i n 2 i + 1 ( x ) = sin ( K ∗ x ) \sum_{i=0}^{\lfloor\frac{K-1}{2}\rfloor}(-1)^iC_{K}^{2i+1}\cos^{K-2i-1}(x)sin^{2i+1}(x)=\sin(K*x) i=0∑⌊2K−1⌋(−1)iCK2i+1cosK−2i−1(x)sin2i+1(x)=sin(K∗x)
其余三角函数同理可以推导出类似的递推公式,此处不再一一列举,相信读者都有能力自己推导出来。