如何理解泰勒公式?

  泰勒公式得名于英国数学家鲁克·泰勒,可以大致描述为:如果函数足够平滑,并且在已知函数在某一点的各阶导数值的情况下,函数在一个点的邻域内的值可以用函数在该点的值及各阶导数值组成的无穷级数表示出来。如果用一句话描述,就是用多项式去逼近光滑函数。
  泰勒公式最直接的应用就是近似计算,一阶泰勒展开式经常应用于机器学习的最优化算法,比如常见的梯度下降法。

泰勒公式的定义

  若函数 f ( x ) f(x) f(x)在包含 x 0 x_0 x0的区间[a,b]上具有n阶导数,并且在开区间(a,b)上n+1次可导,那么对于闭区间[a,b]上的任意x都有: f ( x ) = f ( x 0 ) 0 ! + f ′ ( x 0 ) 1 ! ( x − x 0 ) + … + f ( n ) ( x 0 ) n ! ( x − x 0 ) n + R n ( x ) = ∑ n = 0 N f ( n ) ( x 0 ) n ! ( x − x 0 ) n + R n ( x ) \begin{aligned} f(x)&=\frac{f(x_0)}{0!}+\frac{f^{\prime}(x_0)}{1!}(x-x_0)+\ldots+\frac{f^{(n)}(x_0)}{n!}(x-x_0)^n+R_n(x) \\ &=\sum_{n=0}^N\frac{f^{(n)}(x_0)}{n!}(x-x_0)^n+R_n(x) \end{aligned} f(x)=0!f(x0)+1!f(x0)(xx0)++n!f(n)(x0)(xx0)n+Rn(x)=n=0Nn!f(n)(x0)(xx0)n+Rn(x)其中, f ( n ) ( x 0 ) f^{(n)}(x_0) f(n)(x0)表示 f ( x ) f(x) f(x)的n阶导数。等号后的多项式称为函数 f ( x ) f(x) f(x) x 0 x_0 x0处的泰勒展开式,剩余的 R n ( x ) R_n(x) Rn(x)叫做泰勒公式的余项,是 ( x − x 0 ) n (x-x_0)^n (xx0)n的高阶无穷小。
  常见的泰勒公式余项是拉格朗日余项,公式如下:
R n ( x ) = f ( n + 1 ) ( ξ ) ( n + 1 ) ! ( x − x 0 ) n + 1   ,   x 0 < ξ < x R_n(x)=\frac{f^{(n+1)}(\xi)}{(n+1)!}(x-x_0)^{n+1}\ ,\ x_0<\xi<x Rn(x)=(n+1)!f(n+1)(ξ)(xx0)n+1 , x0<ξ<x

  如果令上面泰勒公式中 x 0 = 0 x_0=0 x0=0的话,就是麦克劳林公式,即: f ( x ) = f ( 0 ) 0 ! + f ′ ( 0 ) 1 ! x + … + f ( n ) ( 0 ) n ! x n + R n ( x ) = ∑ n = 0 N f ( n ) ( 0 ) n ! x n + R n ( x ) \begin{aligned} f(x)&=\frac{f(0)}{0!}+\frac{f^{\prime}(0)}{1!}x+\ldots+\frac{f^{(n)}(0)}{n!}x^n+R_n(x) \\ &=\sum_{n=0}^N\frac{f^{(n)}(0)}{n!}x^n+R_n(x) \end{aligned} f(x)=0!f(0)+1!f(0)x++n!f(n)(0)xn+Rn(x)=n=0Nn!f(n)(0)xn+Rn(x)

泰勒公式的推导

  我们知道,根据拉格朗日中值定理导出的有限增量定理有:
lim ⁡ Δ x → 0 ( f ( x 0 + Δ x ) − f ( x 0 ) ) = f ′ ( x 0 ) Δ x \lim_{\Delta x\rightarrow0}(f(x_0+\Delta x)-f(x_0))=f^{\prime}(x_0)\Delta x Δx0lim(f(x0+Δx)f(x0))=f(x0)Δx
  于是:
   f ( x ) = f ( x 0 ) + f ′ ( x 0 ) ( x − x 0 ) + α f(x)=f(x_0)+f^{\prime}(x_0)(x-x_0)+\alpha f(x)=f(x0)+f(x0)(xx0)+α

  其中误差 α \alpha α是在 Δ x → 0 \Delta x \rightarrow 0 Δx0的前提下才趋向于0,所以在近似计算中往往不够精确。于是我们需要一个能够足够精确的且能估计出误差的多项式: P ( x ) = A 0 + A 1 ( x − x 0 ) + A 2 ( x − x 0 ) 2 + … + A n ( x − x 0 ) n P(x)=A_0+A_1(x-x_0)+A_2(x-x_0)^2+\ldots+A_n(x-x_0)^n P(x)=A0+A1(xx0)+A2(xx0)2++An(xx0)n

来近似地表示函数 f ( x ) f(x) f(x)且要写出其误差 f ( x ) − P ( x ) f(x)-P(x) f(x)P(x)的具体表达式。
  首先假设在一点 x 0 x_0 x0处, P ( x ) P(x) P(x) f ( x ) f(x) f(x)的值是相等的,而且它们的相同阶导数值也是相等的,即函数 P ( x ) P(x) P(x)满足下列等式:
P ( x 0 ) = f ( x 0 ) P ′ ( x 0 ) = f ′ ( x 0 ) P ′ ′ ( x 0 ) = f ′ ′ ( x 0 ) … P ( n ) ( x 0 ) = f ( n ) ( x 0 ) \begin{aligned} P(x_0)&=f(x_0) \\ P^{\prime}(x_0)&=f^{\prime}(x_0) \\ P^{\prime\prime}(x_0)&=f^{\prime\prime}(x_0) \\ &\ldots \\ P^{(n)}(x_0)&=f^{(n)}(x_0) \\ \end{aligned} P(x0)P(x0)P(x0)P(n)(x0)=f(x0)=f(x0)=f(x0)=f(n)(x0)

  于是可以依次求出 A 0 、 A 1 、 A 2 、 … 、 A n A_0、A_1、A_2、\ldots 、A_n A0A1A2An,显然有:
P ( x 0 ) = A 0 , 所 以 A 0 = f ( x 0 ) P ′ ( x 0 ) = A 1 , 所 以 A 1 = f ′ ( x 0 ) P ′ ′ ( x 0 ) = 2 ! A 2 , 所 以 A 2 = f ′ ′ ( x 0 ) 2 ! ; … P ( n ) ( x 0 ) = n ! A n , 所 以 A n = f ( n ) ( x 0 ) n ! \begin{aligned} &P(x_0)=A_0 ,所以A_0=f(x_0) \\ &P^{\prime}(x_0)=A_1,所以A_1=f^{\prime}(x_0) \\ &P^{\prime\prime}(x_0)=2!A_2,所以A_2=\frac{f^{\prime\prime}(x_0)}{2!}; \\ &\ldots \\ &P^{(n)}(x_0)=n!A_n,所以 A_n=\frac{f^{(n)}(x_0)}{n!}\\ \end{aligned} P(x0)=A0A0=f(x0)P(x0)=A1A1=f(x0)P(x0)=2!A2A2=2!f(x0)P(n)(x0)=n!AnAn=n!f(n)(x0)

  至此,多项式的各项系数都已求出,得:
P ( x ) = f ( x 0 ) 0 ! + f ′ ( x 0 ) 1 ! ( x − x 0 ) + … + f ( n ) ( x 0 ) n ! ( x − x 0 ) n P(x)=\frac{f(x_0)}{0!}+\frac{f^{\prime}(x_0)}{1!}(x-x_0)+\ldots+\frac{f^{(n)}(x_0)}{n!}(x-x_0)^n P(x)=0!f(x0)+1!f(x0)(xx0)++n!f(n)(x0)(xx0)n

  以上就是函数的泰勒展开式。
  接下来就要求误差的具体表达式了,首先,令误差为: R n ( x ) = f ( x ) − P ( x ) R_n(x)=f(x)-P(x) Rn(x)=f(x)P(x)

  设 f ( x ) f(x) f(x)在定义域内n+1阶可导, R n ( x ) R_n(x) Rn(x) ( x − x 0 ) (x-x_0) (xx0)的n+1阶无穷小。若 x = x 0 x=x_0 x=x0,则:
R n ( x 0 ) = f ( x 0 ) − P ( x 0 ) = 0 R_n(x_0)=f(x_0)-P(x_0)=0 Rn(x0)=f(x0)P(x0)=0

  进而:
R n ( x 0 ) = R n ′ ( x 0 ) = R n ′ ′ ( x 0 ) = … = R n ( n ) ( x 0 ) = 0 R_n(x_0)=R^{\prime}_n(x_0)=R^{\prime\prime}_n(x_0)=\ldots=R^{(n)}_n(x_0)=0 Rn(x0)=Rn(x0)=Rn(x0)==Rn(n)(x0)=0

  根据柯西中值定理:
R n ( x ) ( x − x 0 ) n + 1 = R n ( x ) − 0 ( x − x 0 ) n + 1 − 0 = R n ( x ) − R n ( x 0 ) ( x − x 0 ) n + 1 − ( x 0 − x 0 ) n + 1 = R n ′ ( ξ 1 ) ( n + 1 ) ( ξ 1 − x 0 ) n \begin{aligned} \frac{R_n(x)}{(x-x_0)^{n+1}}&=\frac{R_n(x)-0}{(x-x_0)^{n+1}-0} \\ &=\frac{R_n(x)-R_n(x_0)}{(x-x_0)^{n+1}-(x_0-x_0)^{n+1}} \\ &=\frac{R^{\prime}_n(\xi_1)}{(n+1)(\xi_1-x_0)^{n}} \end{aligned} (xx0)n+1Rn(x)=(xx0)n+10Rn(x)0=(xx0)n+1(x0x0)n+1Rn(x)Rn(x0)=(n+1)(ξ1x0)nRn(ξ1)

  其中 ξ 1 ∈ ( x 0 , x ) \xi_1 \in (x_0,x) ξ1(x0,x),继续使用柯西中值定理得到:
R n ′ ( ξ 1 ) ( n + 1 ) ( ξ 1 − x 0 ) n = R n ′ ( ξ 1 ) − 0 ( n + 1 ) ( ξ 1 − x 0 ) n − 0 = R n ′ ( ξ 1 ) − R n ′ ( x 0 ) ( n + 1 ) ( ξ 1 − x 0 ) n − ( n + 1 ) ( x 0 − x 0 ) n = R n ′ ′ ( ξ 2 ) n ( n + 1 ) ( ξ 2 − x 0 ) n − 1 \begin{aligned} \frac{R^{\prime}_n(\xi_1)}{(n+1)(\xi_1-x_0)^{n}}&=\frac{R^{\prime}_n(\xi_1)-0}{(n+1)(\xi_1-x_0)^n-0} \\ &=\frac{R^{\prime}_n(\xi_1)-R^{\prime}_n(x_0)}{(n+1)(\xi_1-x_0)^n-(n+1)(x_0-x_0)^n} \\ &=\frac{R^{\prime\prime}_n(\xi_2)}{n(n+1)(\xi_2-x_0)^{n-1}} \end{aligned} (n+1)(ξ1x0)nRn(ξ1)=(n+1)(ξ1x0)n0Rn(ξ1)0=(n+1)(ξ1x0)n(n+1)(x0x0)nRn(ξ1)Rn(x0)=n(n+1)(ξ2x0)n1Rn(ξ2)

  其中 ξ 2 ∈ ( x 0 , ξ 1 ) \xi_2 \in (x_0,\xi_1) ξ2(x0,ξ1),继续使用n+1次柯西中值定理得到:
R n ( x ) ( x − x 0 ) n + 1 = R n ( n + 1 ) ( ξ ) ( n + 1 ) ! \frac{R_n(x)}{(x-x_0)^{n+1}}=\frac{R^{(n+1)}_n(\xi)}{(n+1)!} (xx0)n+1Rn(x)=(n+1)!Rn(n+1)(ξ)

  其中 ξ ∈ ( x 0 , ξ n ) \xi \in (x_0,\xi_n) ξ(x0,ξn),而 ξ n ∈ ( x 0 , x ) \xi_n \in (x_0,x) ξn(x0,x),同时:
R n ( n + 1 ) ( x ) = f ( n + 1 ) ( x ) − P ( n + 1 ) ( x ) R n ( n + 1 ) ( ξ ) = f ( n + 1 ) ( ξ ) − P ( n + 1 ) ( ξ ) \begin{aligned} R^{(n+1)}_n(x)=f^{(n+1)}(x)-P^{(n+1)}(x) \\ R^{(n+1)}_n(\xi)=f^{(n+1)}(\xi)-P^{(n+1)}(\xi) \end{aligned} Rn(n+1)(x)=f(n+1)(x)P(n+1)(x)Rn(n+1)(ξ)=f(n+1)(ξ)P(n+1)(ξ)

  而n次多项式 P ( x ) P(x) P(x)的n阶导数 P ( n ) ( x ) P^{(n)}(x) P(n)(x) = 常数,所以 P ( n + 1 ) ( ξ ) = 0 P^{(n+1)}(\xi) =0 P(n+1)(ξ)=0

  进而:
R n ( n + 1 ) ( ξ ) = f ( n + 1 ) ( ξ ) R^{(n+1)}_n(\xi)=f^{(n+1)}(\xi) Rn(n+1)(ξ)=f(n+1)(ξ)

  综上可得:
R n ( x ) = f ( n + 1 ) ( ξ ) ( n + 1 ) ! ( x − x 0 ) n + 1 R_n(x)=\frac{f^{(n+1)}(\xi)}{(n+1)!}(x-x_0)^{n+1} Rn(x)=(n+1)!f(n+1)(ξ)(xx0)n+1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值