由微分的定义和介绍可得,如果 f ′ ( x 0 ) f'(x_0) f′(x0)存在,则当 x → x 0 x\rightarrow x_0 x→x0时,有
f ( x ) = f ( x 0 ) + f ′ ( x 0 ) ( x − x 0 ) + o ( x − x 0 ) f(x)=f(x_0)+f'(x_0)(x-x_0)+o(x-x_0) f(x)=f(x0)+f′(x0)(x−x0)+o(x−x0)
这表明在 x 0 x_0 x0点附近 f ( x ) f(x) f(x)可以用一个一阶多项式来逼近:
P 1 ( x ) = f ( x 0 ) + f ′ ( x 0 ) ( x − x 0 ) P_1(x)=f(x_0)+f'(x_0)(x-x_0) P1(x)=f(x0)+f′(x0)(x−x0)
误差为 o ( x − x 0 ) o(x-x_0) o(x−x0)。从几何上看,其实就是用曲线 y = f ( x ) y=f(x) y=f(x)过点 ( x 0 , f ( x 0 ) ) (x_0,f(x_0)) (x0,f(x0))的切线来逼近曲线。然而这样的逼近在许多情况下是不够的。为了提高精度,我们可以用一个多项式在 x 0 x_0 x0点附近来逼近 f ( x ) f(x) f(x),这就是泰勒公式。
若函数 f f f在点 x 0 x_0 x0处有 n n n阶导数时,我们可以用一个 n n n次多项式来逼近 f ( x ) f(x) f(x),那么我们可以设这个多项式为:
P n ( x ) = a 0 + a 1 ( x − x 0 ) + a 2 ( x − x 0 ) 2 + ⋯ + a n ( x − x 0 ) n P_n(x)=a_0+a_1(x-x_0)+a_2(x-x_0)^2+\dots+a_n(x-x_0)^n Pn(x)=a0+a1(x−x0)+a2(x−x0)2+⋯+an(x−x0)n
接下来我们要求 a 1 , a 2 , … , a n a_1,a_2,\dots,a_n a1,a2,…,an的值。
因为我们要用 P n ( x ) P_n(x) Pn(x)来逼近 f ( x ) f(x) f(x),所以在 x = x 0 x=x_0 x=x0时, P n ( x ) = f ( x 0 ) P_n(x)=f(x_0) Pn(x)=f(x0)。也就是说, a 0 = f ( x 0 ) a_0=f(x_0) a0=f(x0).
接下来我们来求 a 1 a_1 a1。因为要逼近 f ( x ) f(x) f(x),所以当 x = x 0 x=x_0 x=x0时, P n ′ ( x ) = f ′ ( x 0 ) P_n'(x)=f'(x_0) Pn′(x)=f′(x0),也就是 a 1 = f ′ ( x 0 ) a_1=f'(x_0) a1=f′(x0).
以此类推,对于 k = 1 , 2 , … , n k=1,2,\dots,n k=1,2,…,n, a k = f ( k ) ( x 0 ) k ! a_k=\dfrac{f^{(k)}(x_0)}{k!} ak=k!f(k)(x0)。于是,我们就可以得到 P n ( x ) P_n(x) Pn(x)了。
P n ( x ) = ∑ k = 0 n f ( k ) ( x 0 ) k ! ( x − x 0 ) k P_n(x)=\sum\limits_{k=0}^n\dfrac{f^{(k)}(x_0)}{k!}(x-x_0)^k Pn(x)=k=0∑nk!f(k)(x0)(x−x0)k
称上式为 f f f在 x 0 x_0 x0处的 n n n阶泰勒多项式。
以上是一种理解方法,但并不严谨,仅供参考。
设函数 f f f在 x 0 x_0 x0处有 n n n阶导数,则当 x → x 0 x\rightarrow x_0 x→x0时,
f ( x ) = ∑ k = 0 n f ( k ) ( x 0 ) k ! ( x − x 0 ) k + o ( ( x − x 0 ) n ) f(x)=\sum\limits_{k=0}^n\dfrac{f^{(k)}(x_0)}{k!}(x-x_0)^k+o((x-x_0)^n) f(x)=k=0∑nk!f(k)(x0)(x−x0)k+o((x−x0)n)
\qquad 令 R n ( x ) = f ( x ) − P n ( x ) R_n(x)=f(x)-P_n(x) Rn(x)=f(x)−Pn(x),由于 f f f在点 x 0 x_0 x0处有 n n n阶导数,所以 f ( x ) f(x) f(x)与 R n ( x ) R_n(x) Rn(x)在某个邻域内有 n − 1 n-1 n−1阶导数,并且
R n ( m ) ( x ) = f ( m ) ( x ) − ∑ k = m n f ( k ) ( x 0 ) ( k − m ) ! ( x − x 0 ) ( k − m ) ( m = 0 , 1 , 2 , … , n − 1 ) R_n^{(m)}(x)=f^{(m)}(x)-\sum\limits_{k=m}^n\dfrac{f^{(k)}(x_0)}{(k-m)!}(x-x_0)^{(k-m)} \qquad (m=0,1,2,\dots,n-1) Rn(m)(x)=f(m)(x)−k=m∑n(k−m)!f(k)(x0)(x−x0)(k−m)(m=0,1,2,…,n−1)
有上式可得 R n ( x 0 ) = R n ′ ( x 0 ) = ⋯ = R n ( n − 1 ) ( x 0 ) = 0 R_n(x_0)=R_n'(x_0)=\cdots=R_n^{(n-1)}(x_0)=0 Rn(x0)=Rn′(x0)=⋯=Rn(n−1)(x0)=0,于是我们使用 n − 1 n-1 n−1次洛必达法则可得
lim x → x 0 R n ( x ) ( x − x 0 ) n = lim x → x 0 R n ′ ( x ) n ( x − x 0 ) n − 1 = ⋯ = lim x → x 0 R n ( n − 1 ) ( x ) n ! ( x − x 0 ) \qquad \lim\limits_{x\rightarrow x_0}\dfrac{R_n(x)}{(x-x_0)^n}=\lim\limits_{x\rightarrow x_0}\dfrac{R_n'(x)}{n(x-x_0)^{n-1}}=\cdots=\lim\limits_{x\rightarrow x_0}\dfrac{R_n^{(n-1)}(x)}{n!(x-x_0)} x→x0lim(x−x0)nRn(x)=x→x0limn(x−x0)n−1Rn′(x)=⋯=x→x0limn!(x−x0)Rn(n−1)(x)
= lim x → x 0 f ( n − 1 ) ( x ) − f ( n − 1 ) ( x 0 ) − f ( n ) ( x 0 ) ( x − x 0 ) n ! ( x − x 0 ) \qquad \qquad \qquad \qquad \quad =\lim\limits_{x\rightarrow x_0}\dfrac{f^{(n-1)}(x)-f^{(n-1)}(x_0)-f^{(n)}(x_0)(x-x_0)}{n!(x-x_0)} =x→x0limn!(x−x0)f(n−1)(x)−f(n−1)(x0)−f(n)(x0)(x−x0)
= 1 n ! lim x → x 0 [ f ( n − 1 ) ( x ) − f ( n − 1 ) ( x 0 ) x − x 0 − f ( n ) ( x 0 ) ] \qquad \qquad \qquad \qquad \quad =\dfrac{1}{n!}\lim\limits_{x\rightarrow x_0}[\dfrac{f^{(n-1)}(x)-f^{(n-1)}(x_0)}{x-x_0}-f^{(n)}(x_0)] =n!1x→x0lim[x−x0f(n−1)(x)−f(n−1)(x0)−f(n)(x0)]
= 1 n ! lim x → x 0 [ f ( n ) ( x 0 ) − f ( n ) ( x 0 ) ] = 0 \qquad \qquad \qquad \qquad \quad =\dfrac{1}{n!}\lim\limits_{x\rightarrow x_0}[f^{(n)}(x_0)-f^{(n)}(x_0)]=0 =n!1x→x0lim[f(n)(x0)−f(n)(x0)]=0
所以当 x → x 0 x\rightarrow x_0 x→x0时, R n ( x ) = o ( ( x − x 0 ) n ) R_n(x)=o((x-x_0)^n) Rn(x)=o((x−x0)n),即可得
f ( x ) = ∑ k = 0 n f ( k ) ( x 0 ) k ! ( x − x 0 ) k + o ( ( x − x 0 ) n ) f(x)=\sum\limits_{k=0}^n\dfrac{f^{(k)}(x_0)}{k!}(x-x_0)^k+o((x-x_0)^n) f(x)=k=0∑nk!f(k)(x0)(x−x0)k+o((x−x0)n)
R n ( x ) R_n(x) Rn(x)称为余项,由 R n ( x ) = o ( ( x − x 0 ) n ) R_n(x)=o((x-x_0)^n) Rn(x)=o((x−x0)n)表达的余项称为皮亚诺余项。上式称为 f f f在 x 0 x_0 x0处带皮亚诺余项的 n n n阶泰勒公式。
设函数 f f f在区间 [ a , b ] [a,b] [a,b]上 n + 1 n+1 n+1阶可导, x x x和 x 0 x_0 x0为 [ a , b ] [a,b] [a,b]中任意两点, P n P_n Pn为 f f f在 x 0 x_0 x0处的 n n n阶泰勒多项式,则存在 ξ \xi ξ介于 x x x和 x 0 x_0 x0之间,使得
R n ( x ) = f ( x ) − P n ( x ) = f ( n + 1 ) ( ξ ) ( n + 1 ) ! ( x − x 0 ) n + 1 R_n(x)=f(x)-P_n(x)=\dfrac{f^{(n+1)}(\xi)}{(n+1)!}(x-x_0)^{n+1} Rn(x)=f(x)−Pn(x)=(n+1)!f(n+1)(ξ)(x−x0)n+1
由皮亚诺余项的证明,同理可得 R n ( x 0 ) = R n ′ ( x 0 ) = ⋯ = R n ( n ) ( x 0 ) = 0 R_n(x_0)=R_n'(x_0)=\cdots=R_n^{(n)}(x_0)=0 Rn(x0)=Rn′(x0)=⋯=Rn(n)(x0)=0.对 R n ( x ) R_n(x) Rn(x)和 g ( x ) = ( x − x 0 ) n + 1 g(x)=(x-x_0)^{n+1} g(x)=(x−x0)n+1在闭区间 [ x , x 0 ] [x,x_0] [x,x0](或 [ x 0 , x ] [x_0,x] [x0,x])上使用 n + 1 n+1 n+1次柯西中值定理可得
R n ( x ) ( x − x 0 ) n + 1 = 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 \qquad \dfrac{R_n(x)}{(x-x_0)^{n+1}}=\dfrac{R_n(x)-R_n(x_0)}{(x-x_0)^{n+1}-(x_0-x_0)^{n+1}}=\dfrac{R_n'(\xi_1)}{(n+1)(\xi_1-x_0)^n} (x−x0)n+1Rn(x)=(x−x0)n+1−(x0−x0)n+1Rn(x)−Rn(x0)=(n+1)(ξ1−x0)nRn′(ξ1)
= 1 n + 1 ⋅ R n ′ ( ξ 1 ) − R n ′ ( x 0 ) ( ξ 1 − x 0 ) n − ( x 0 − x 0 ) n = 1 n + 1 ⋅ R n ′ ′ ( ξ 2 ) n ( ξ 2 − x 0 ) n − 1 \qquad \qquad \qquad \qquad =\dfrac{1}{n+1}\cdot\dfrac{R_n'(\xi_1)-R_n'(x_0)}{(\xi_1-x_0)^n-(x_0-x_0)^n}=\dfrac{1}{n+1}\cdot\dfrac{R_n''(\xi_2)}{n(\xi_2-x_0)^{n-1}} =n+11⋅(ξ1−x0)n−(x0−x0)nRn′(ξ1)−Rn′(x0)=n+11⋅n(ξ2−x0)n−1Rn′′(ξ2)
= ⋯ = R n ( n ) ( ξ n ) ( n + 1 ) ! ( ξ n − x 0 ) \qquad \qquad \qquad \qquad =\cdots=\dfrac{R_n^{(n)}(\xi_n)}{(n+1)!(\xi_n-x_0)} =⋯=(n+1)!(ξn−x0)Rn(n)(ξn)
= f ( n ) ( ξ n ) − f ( n ) ( x 0 ) ( n + 1 ) ! ( ξ n − x 0 ) = f ( n + 1 ) ( ξ ) ( n + 1 ) ! \qquad \qquad \qquad \qquad =\dfrac{f^{(n)}(\xi_n)-f^{(n)}(x_0)}{(n+1)!(\xi_n-x_0)}=\dfrac{f^{(n+1)}(\xi)}{(n+1)!} =(n+1)!(ξn−x0)f(n)(ξn)−f(n)(x0)=(n+1)!f(n+1)(ξ)
其中 x < ξ 1 < ξ 2 < ⋯ < ξ n < ξ < x 0 x<\xi_1<\xi_2<\cdots<\xi_n<\xi
R n ( x ) = f ( x ) − P n ( x ) = f ( n + 1 ) ( ξ ) ( n + 1 ) ! ( x − x 0 ) n + 1 R_n(x)=f(x)-P_n(x)=\dfrac{f^{(n+1)}(\xi)}{(n+1)!}(x-x_0)^{n+1} Rn(x)=f(x)−Pn(x)=(n+1)!f(n+1)(ξ)(x−x0)n+1
上式称为拉格朗日余项,相应的泰勒公式称为 f f f在 x 0 x_0 x0处带拉格朗日余项的 n n n阶泰勒公式。
当 x 0 = 0 x_0=0 x0=0时, f f f在 x 0 = 0 x_0=0 x0=0点的 n n n阶泰勒公式也称为 f f f的 n n n阶麦克劳林公式。
设点 f f f在点 x 0 x_0 x0有 n n n阶导数,并且存在 n n n阶多项式 Q n ( x ) Q_n(x) Qn(x),使得
f ( x ) = Q n ( x ) + o ( ( x − x 0 ) n ) ( x → x 0 ) f(x)=Q_n(x)+o((x-x_0)^n) \qquad (x\rightarrow x_0) f(x)=Qn(x)+o((x−x0)n)(x→x0)
则 Q n ( x ) Q_n(x) Qn(x)即为 f f f在点 x 0 x_0 x0的 n n n阶泰勒多项式 P n ( x ) P_n(x) Pn(x).
由上文可得 f f f在点 x 0 x_0 x0处的
f ( x ) = P n ( x ) + o ( ( x − x 0 ) n ) ( x → x 0 ) f(x)=P_n(x)+o((x-x_0)^n) \qquad (x\rightarrow x_0) f(x)=Pn(x)+o((x−x0)n)(x→x0)
两式做差得
P n ( x ) − Q n ( x ) = o ( ( x − x 0 ) n ) ( x → x 0 ) P_n(x)-Q_n(x)=o((x-x_0)^n) \qquad (x\rightarrow x_0) Pn(x)−Qn(x)=o((x−x0)n)(x→x0)
由于 P n ( x ) − Q n ( x ) = a 0 + a 1 ( x − x 0 ) + ⋯ + a n ( x − x 0 ) n P_n(x)-Q_n(x)=a_0+a_1(x-x_0)+\cdots+a_n(x-x_0)^n Pn(x)−Qn(x)=a0+a1(x−x0)+⋯+an(x−x0)n是关于 x − x 0 x-x_0 x−x0的 n n n阶多项式,即
a 0 + a 1 ( x − x 0 ) + ⋯ + a n ( x − x 0 ) n = o ( ( x − x 0 ) n ) ( x → x 0 ) a_0+a_1(x-x_0)+\cdots+a_n(x-x_0)^n=o((x-x_0)^n) \qquad (x\rightarrow x_0) a0+a1(x−x0)+⋯+an(x−x0)n=o((x−x0)n)(x→x0)
由此可得 a 0 = 0 a_0=0 a0=0.再将上式两边同时除以 ( x − x 0 ) (x-x_0) (x−x0)可得
a 1 + a 2 ( x − x 0 ) + ⋯ + a n ( x − x 0 ) n − 1 = o ( ( x − x 0 ) n − 1 ) ( x → x 0 ) a_1+a_2(x-x_0)+\cdots+a_n(x-x_0)^{n-1}=o((x-x_0)^{n-1}) \qquad (x\rightarrow x_0) a1+a2(x−x0)+⋯+an(x−x0)n−1=o((x−x0)n−1)(x→x0)
可得 a 1 = 0 a_1=0 a1=0.以此类推,可以得到 a 0 = a 1 = ⋯ = a n = 0 a_0=a_1=\cdots=a_n=0 a0=a1=⋯=an=0,从而 Q n ( x ) ≡ P n ( x ) Q_n(x) \equiv P_n(x) Qn(x)≡Pn(x),即可得证。
题1: 写出 f ( x ) = ln ( 1 + x ) f(x)=\ln(1+x) f(x)=ln(1+x)的带皮亚诺余项的 n n n阶麦克劳林公式
解:
f ( k ) ( x ) = ( − 1 ) k − 1 ( k − 1 ) ! ( 1 + x ) − k \qquad f^{(k)}(x)=(-1)^{k-1}(k-1)!(1+x)^{-k} f(k)(x)=(−1)k−1(k−1)!(1+x)−k
\qquad 由此可得
ln ( 1 + x ) = x − x 2 2 + x 3 3 − ⋯ + ( − 1 ) n − 1 x n n + o ( x n ) \qquad \ln(1+x)=x-\dfrac{x^2}{2}+\dfrac{x^3}{3}-\cdots+(-1)^{n-1}\dfrac{x^n}{n}+o(x^n) ln(1+x)=x−2x2+3x3−⋯+(−1)n−1nxn+o(xn)
题2: 写出 f ( x ) = ( 1 + x ) a ( a ≠ 0 ) f(x)=(1+x)^a(a\neq 0) f(x)=(1+x)a(a=0)的带皮亚诺余项的 n n n阶麦克劳林公式
解:
f ( k ) ( x ) = a ( a − 1 ) ⋯ ( a − k + 1 ) ( 1 + x ) a − k \qquad f^{(k)}(x)=a(a-1)\cdots(a-k+1)(1+x)^{a-k} f(k)(x)=a(a−1)⋯(a−k+1)(1+x)a−k
\qquad 由此可得
( 1 + x ) a = 1 + a x + a ( a − 1 ) 2 ! x 2 + ⋯ + a ( a − 1 ) ⋯ ( a − n + 1 ) n ! x n + o ( x n ) \qquad (1+x)^a=1+ax+\dfrac{a(a-1)}{2!}x^2+\cdots+\dfrac{a(a-1)\cdots(a-n+1)}{n!}x^n+o(x^n) (1+x)a=1+ax+2!a(a−1)x2+⋯+n!a(a−1)⋯(a−n+1)xn+o(xn)
题3: 写出 f ( x ) = e sin 2 x f(x)=e^{\sin^2 x} f(x)=esin2x的带皮亚诺余项的 4 4 4阶麦克劳林公式
解:
\qquad 函数 sin x \sin x sinx和 e u 2 e^{u^2} eu2的带皮亚诺余项的麦克劳林公式分别为
sin x = x − x 3 3 ! + o ( x 3 ) ( x → 0 ) \qquad \sin x=x-\dfrac{x^3}{3!}+o(x^3) \qquad (x\rightarrow 0) sinx=x−3!x3+o(x3)(x→0)
e u 2 = 1 + u 2 + u 4 2 ! + o ( u 4 ) ( u → 0 ) \qquad e^{u^2}=1+u^2+\dfrac{u^4}{2!}+o(u^4) \qquad (u\rightarrow 0) eu2=1+u2+2!u4+o(u4)(u→0)
\qquad 因为当 x → 0 x\rightarrow0 x→0时, u = sin x ∼ x u=\sin x\sim x u=sinx∼x,所以
e sin 2 x = 1 + [ x − x 3 3 ! + o ( x 3 ) ] 2 + 1 2 ! [ x − x 3 3 ! + o ( x 3 ) ] 4 + o ( x 4 ) \qquad e^{\sin^2x}=1+[x-\dfrac{x^3}{3!}+o(x^3)]^2+\dfrac{1}{2!}[x-\dfrac{x^3}{3!}+o(x^3)]^4+o(x^4) esin2x=1+[x−3!x3+o(x3)]2+2!1[x−3!x3+o(x3)]4+o(x4)
= 1 + x 2 + 1 6 x 4 + o ( x 4 ) \qquad \qquad \quad =1+x^2+\dfrac 16x^4+o(x^4) =1+x2+61x4+o(x4)
题1: 写出 e x e^x ex的带拉格朗日余项的 n n n阶麦克劳林公式
解:
\qquad 令 f ( x ) = e x f(x)=e^x f(x)=ex,则 f ( k ) ( x ) = e x f^{(k)}(x)=e^x f(k)(x)=ex,在 0 0 0点的各阶导数都为 1 1 1
\qquad 由此可得
e x = 1 + x + x 2 2 ! + ⋯ + x n n ! + e ξ ( n + 1 ) ! x n + 1 ( ξ ∈ ( 0 , x ) ) \qquad e^x=1+x+\dfrac{x^2}{2!}+\cdots+\dfrac{x^n}{n!}+\dfrac{e^\xi}{(n+1)!}x^{n+1}\qquad(\xi\in{(0,x)}) ex=1+x+2!x2+⋯+n!xn+(n+1)!eξxn+1(ξ∈(0,x))
题2: 写出 sin x \sin x sinx和 cos x \cos x cosx的带拉格朗日余项的 2 n 2n 2n阶麦克劳林公式
解:
\qquad 令 f ( x ) = sin x f(x)=\sin x f(x)=sinx
∵ ( sin x ) ( n ) = sin ( x + n π 2 ) \qquad \because (\sin x)^{(n)}=\sin(x+\dfrac{n\pi}{2}) ∵(sinx)(n)=sin(x+2nπ)
∴ f ( 2 n ) ( 0 ) = 0 , f ( 2 n + 1 ) ( 0 ) = ( − 1 ) n ( n = 0 , 1 , 2 , … ) \qquad\therefore f^{(2n)}(0)=0,f^{(2n+1)}(0)=(-1)^n \qquad(n=0,1,2,\dots) ∴f(2n)(0)=0,f(2n+1)(0)=(−1)n(n=0,1,2,…)
\qquad 由此可得
sin x = x − x 3 3 ! + x 5 5 ! − ⋯ + ( − 1 ) n − 1 x 2 n − 1 ( 2 n − 1 ) ! + x 2 n + 1 ( 2 n + 1 ) ! sin ( ξ + 2 n + 1 2 π ) ( ξ ∈ ( 0 , x ) ) \qquad\sin x=x-\dfrac{x^3}{3!}+\dfrac{x^5}{5!}-\cdots+(-1)^{n-1}\dfrac{x^{2n-1}}{(2n-1)!}+\dfrac{x^{2n+1}}{(2n+1)!}\sin(\xi+\dfrac{2n+1}{2}\pi) \qquad (\xi\in(0,x)) sinx=x−3!x3+5!x5−⋯+(−1)n−1(2n−1)!x2n−1+(2n+1)!x2n+1sin(ξ+22n+1π)(ξ∈(0,x))
\qquad 同理可得
cos x = 1 − x 2 2 ! + x 4 4 ! − ⋯ + ( − 1 ) n x 2 n ( 2 n ) ! + x 2 n + 1 ( 2 n + 1 ) ! cos ( ξ + 2 n + 1 2 π ) ( ξ ∈ ( 0 , x ) ) \qquad \cos x=1-\dfrac{x^2}{2!}+\dfrac{x^4}{4!}-\cdots+(-1)^n\dfrac{x^{2n}}{(2n)!}+\dfrac{x^{2n+1}}{(2n+1)!}\cos(\xi+\dfrac{2n+1}{2}\pi) \qquad (\xi\in(0,x)) cosx=1−2!x2+4!x4−⋯+(−1)n(2n)!x2n+(2n+1)!x2n+1cos(ξ+22n+1π)(ξ∈(0,x))
泰勒公式是一样很好用的东西,不过需要深刻的理解,而且导数的基础知识也要十分牢固,才能很好地掌握。