\chapter{微分与Taylor定理} \section{微分的概念与应用} 考虑函数的逼近问题:设$f:I \to \realnum$,$x_0 \in I$($I$为区间)。考虑用一个多项式在$x_0$附近逼近$f(x)$,比如用0次多项式$P_0(x)$逼近: \[f(x_0 + \Delta x) \approx P_0(\delx) = a \quad \text{($\delx$比较小时)}\] 即我们希望 \[\tolim{\Delta x}{0} [f(x_0 + \Delta x) - P_0(\Delta x)] = 0\] 如果$f$在$x_0$处连续,那么上式导出$a = f(x_0)$,即$P_0(\Delta x) = f(x_0)$。 进一步,考虑用一次多项式$P_1(\Delta x) = a + bx$逼近$f(x)$: \[f(x + \Delta x) \approx P_1(\Delta x) \quad \text{($\delx$比较小时)}\] 即我们希望 \[\tolim{\Delta x}{0} [f(x_0 + \Delta x) - P_1(\Delta x)] = 0\] 和刚才一样,我们还能得到$a = f(x_0)$。那么$b$应满足什么要求? \begin{definition}[微分] 设$f$在$x_0$点附近有定义,如果存在实数$\lambda$使得 \begin{equation*}\label{微分定义}\tag{$\ast$} f(x_0 + \Delta x) = f(x_0) + \lambda \Delta x + o(\Delta x) \quad (\Delta x \to 0) \end{equation*} 则称$f$在$x_0$点可微,记$f$在$x_0$点的微分为$\dif f(x_0) = \lambda \Delta x$,$\lambda$称为$f$在$x_0$点的微分系数。 \end{definition} \begin{remark} 式\eqref{微分定义}说明$f$在$x_0$点附近有一次多项式近似 \[f(x_0 + \Delta x) \approx f(x_0) + \lambda \Delta x \quad \text{($\Delta x$很小)}\eqper\] \end{remark} 回忆记号$o(\Delta x)$的含义,\eqref{微分定义}实际上表示的是 \[\frac{f(x_0 + \Delta x) - f(x_0) - \lambda \Delta x}{\Delta x} = \frac{o(\Delta x)}{\Delta x} \to 0\] 即 \[\tolim{\Delta x}{0} \left[\frac{f(x_0 + \Delta x) - f(x_0)}{\Delta x} - \lambda\right] = 0\] 从此我们可以看到$\lambda = \deriv{f}(x_0)$,这也就是刚才的$b$。 \begin{corollary}[可微与可导的关系] 函数$f$在$x_0$点可微的充分必要条件是$f$在$x_0$点可导。这时微分系数$\lambda = \deriv{f}(x_0)$,即$\dif f(x_0) = \deriv{f}(x_0) \Delta x$。 \end{corollary} \begin{remark} 注意到$\dif x = \deriv{(x)}\Delta x = \Delta x$,因此我们可以将$\dif f(x) = \deriv{f}(x) \Delta x$改写成$\dif f(x) = \deriv{f}(x) \dif x$。 \end{remark} \begin{remark} 回忆Leibniz记号,对于函数$y = f(x)$ \[\frac{\dif y}{\dif x} = \deriv{f}(x)\] 即 \[\dif y = \frac{\dif y}{\dif x} \dif x\eqper\] \end{remark} \begin{theorem}[微分的四则运算] 关于函数四则运算运算的微分,有下列法则: \begin{enumerate} \item $\dif (f \pm g) = \dif f \pm \dif g$; \item $\dif (fg) = g \dif f + f \dif g$; \item $\dif \left(\dfrac{f}{g}\right) = \dfrac{g \dif f - f \dif g}{g^2}$,其中$g \neq 0$。 \end{enumerate} \end{theorem} \begin{theorem}[复合函数的微分] 设函数$x = \varphi(t)$在$t$点可微,函数$y = f(x)$在$x = \varphi(t)$点可微,则复合函数$y = (f \circ \varphi)(t) = f(\varphi(t))$在$t$点可微,且 \[\dif y = \deriv{(f \circ \varphi)}(t) \dif t = \deriv{f}(\varphi(t))\deriv{\varphi}(t) \dif t \eqper\] \end{theorem} \begin{proof} 利用微分与导数的关系及复合函数求导法则即得。 \end{proof} \begin{remark} 回忆Leibniz记号,对于函数$y = f(x), x = \varphi(t)$ \[\frac{\dif y}{\dif t} = \frac{\dif y}{\dif x} \cdot \frac{\dif x}{\dif t}\] 因此有 \[\dif y = \frac{\dif y}{\dif x} \cdot \frac{\dif x}{\dif t} \dif t\eqper\] \end{remark} \section{带Peano余项的Taylor公式} 受引入微分概念的启发,如果我们想更精确低用$n$次多项式逼近$f(x)$,即我们希望用 \[P_n(\Delta x) = a_0 + a_1 \Delta x + \cdots + a_n \Delta x^n\] 逼近$f(x)$,那么它应该满足 \[f(x_0 + \Delta x) = P_n(\Delta x) + o(\Delta x^n)\eqper\] 以二次多项式的逼近为例,令 \[P_2(\Delta x) = a + b \Delta x + c \Delta x^2\] 满足 \[f(x_0 + \Delta x) = P_2(\Delta x) + o(\Delta x^2)\] 即 \[f(x_0 + \Delta x) - a - b \Delta x - c \Delta x^2 = o(\Delta x^2)\] 考虑$\Delta x \to 0$,则有 \begin{equation*} \begin{aligned} f(x_0 + \Delta x) - a \to 0 & \Rightarrow a = f(x_0)\\ \frac{f(x_0 + \Delta x) - a}{\Delta x} - b \to 0 & \Rightarrow b = \deriv{f}(x_0)\\ \frac{f(x_0 + \Delta x) - a - b \Delta x}{\Delta x^2} - c \to 0 & \Rightarrow c = \frac{f^{\prime \prime}(x_0)}{2} \end{aligned} \end{equation*} 这说明只要$f^{\prime \prime}(x_0)$存在就有 \[f(x_0 + \Delta x) = f(x_0) + \deriv{f}(x_0)\Delta x + \frac{f^{\prime \prime}(x_0)}{2}\Delta x^2 + o(\Delta x^2)\eqper\] 将其推广,我们有 \begin{definition}[Taylor多项式与Maclaurin多项式] 设$f(x)$在$x_0$附近有定义,且$f^{(n)}(x_0)$存在,引入多项式 \[P_n(\Delta x) = f(x_0) + \frac{\deriv{f}(x_0)}{1!}\Delta x + \frac{f^{\prime \prime}(x_0)}{2!}\Delta x^2 + \cdots + \frac{f^{(n)}(x_0)}{n!}\Delta x^n\] 或 \[T_n(f, x_0;x) = f(x_0) + \frac{\deriv{f}(x_0)}{1!}(x-x_0) + \frac{f^{\prime \prime}(x_0)}{2!}(x-x_0)^2 + \cdots + \frac{f^{(n)}(x_0)}{n!}(x-x_0)^n\] 称为$f(x)$在$x_0$点的$n$次Taylor多项式。 特别地,在$x_0 = 0$时,Taylor多项式称为Maclaurin多项式: \[P_n = f(0) + \frac{\deriv{f}(0)}{1!}(x) + \frac{f^{\prime \prime}(0)}{2!}x^2 + \cdots + \frac{f^{(n)}(x)}{n!}x^n\eqper\] \end{definition} \begin{theorem}[Taylor公式] 设$f(x)$在$x_0$附近有定义,且$f^{(n)}(x_0)$存在,则 \[f(x_0 + \Delta x) = P_n(\Delta x) + o(\Delta x^n)\] 等价地 \[f(x) = P_n(x - x_0) + o((x-x_0)^n)\] 称为$f(x)$在$x_0$点(带Peano型余项)的$n$阶/$n$次Taylor多项式展开。其中$o(\Delta x^n)$项称为Peano型余项。 \end{theorem} \begin{proof} 注意到对$k = 1, 2, \cdots n$, \[P_n^{(k)}(\Delta x) = f^{(k)}(x_0) + \frac{f^{(k+1)}(x_0)}{1!} \Delta x + \cdots + \frac{f^{(n)}(x_0)}{(n-k)!}\Delta x^{n-k}\] 因此有$P_n^{(n-1)}(\Delta x) = f^{(n-1)}(x_0) + f^{(n)}(x_0)\Delta x$。 已知条件中已经隐含了$f$的$n$阶一下导数在$x_0$附近都存在,因此下面反复对``$\dfrac{0}{0}$型''极限运用L'Hospital法则: \begin{align*} \tolim{\Delta x}{0}\frac{f(x_0+\Delta x) - P_n(\Delta x)}{\Delta x^n} & = \tolim{\Delta x}{0} \frac{\deriv{f}(x_0 + \Delta x) - \deriv{P}_n(\Delta x)}{n\Delta x^{n-1}}\\ & = \cdots = \tolim{\Delta x}{0} \frac{f^{(n-1)}(x_0 + \Delta x) - P_n^{(n-1)}(\Delta x)}{n(n-1)\cdots 2\cdot \Delta x}\\ & = \tolim{\Delta x}{0} \frac{f^{(n-1)}(x_0 + \Delta x) - f^{(n-1)}(x_0) - f^{(n)}(x_0)\Delta x}{n!\Delta x}\\ & = \frac{1}{n!} \tolim{\Delta x}{0} \left[\frac{f^{(n-1)}(x_0 + \Delta x) - f^{(n-1)}(x_0)}{\Delta x} - f^{(n)}(x_0) \right]\\ & = 0 \eqper \qedhere \end{align*} \end{proof} \begin{example} 计算Maclaurin展开:$f(x) = e^x$。 \end{example} \begin{proof}[解] $f^{(k)}(x) = e^x$,$f^{(k)}(0) = 1$,$k = 1, 2, 3 \cdots$。因此 \[e^x = 1 + \frac{x}{1!} + \frac{x^2}{2!} + \cdots + \frac{x^n}{n!} + o(x^n)\eqper \qedhere\] \end{proof} \begin{example} 计算Maclaurin展开:$f(x) = \sin x$。 \end{example} \begin{proof}[解] $f^{(k)}(x) = \sin \left(x + \dfrac{k\pi}{2}\right)$,$f^{(k)}(0) = \sin \dfrac{k\pi}{2}$,$k = 0, 1, 2, \cdots$。因此 \begin{equation*} f^{(k)} = \begin{cases} 0, \quad k = 2m\\ (-1)^m, \quad k = 2m + 1 \end{cases} ,\quad m = 0, 1, 2\cdots \end{equation*} 所以 \[\sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots + (-1)^m \frac{x^{2m+1}}{(2m+1)!} + o(x^{2m+1})\eqper \qedhere\] \end{proof} \begin{example} 计算Maclaurin展开:$f(x) = \cos x$。 \end{example} \begin{proof}[解] 类似上面, \begin{equation*} f^{(k)} = \begin{cases} (-1)^m, \quad k = 2m\\ 0, \quad k = 2m + 1 \end{cases} ,\quad m = 0, 1, 2\cdots \end{equation*} 所以 \[\cos x = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots + (-1)^m\frac{x^{2m}}{(2m)!} + o(x^{2m})\eqper \qedhere\] \end{proof} \begin{example} 计算Maclaurin展开:$f(x) = \ln (1 + x)$。 \end{example} \begin{proof}[解] $f^{(k)}(x) = (-1)^{k-1}(k-1)!(1+x)^{k-1}$,因此$f^{(k)}(0) = (-1)^{k-1}(k-1)!$,$k = 1, 2, \cdots$。 所以 \[\ln (1 + x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots + (-1)^{n-1}\frac{x^n}{n} + o(x^n)\eqper\qedhere\] \end{proof} \begin{example} 计算Maclaurin展开:$f(x) = \arctan x$。 \end{example} \begin{proof} \begin{equation*} f^{(k)}(0) \begin{cases} 0, \quad k = 2m\\ (-1)^m(2m)!, \quad k = 2m + 1 \end{cases} m = 0, 1, 2, \cdots \end{equation*} 因此 \[\arctan x = x - \frac{x^3}{3} + \frac{x^5}{5} - \cdots + (-1)^m \frac{x^{2m+1}}{2m + 1} + o(x^{2m+1})\eqper \qedhere\] \end{proof} \begin{example} 计算Maclaurin展开:$f(x) = (1 + x)^\alpha$,$\alpha \in \realnum$。 \end{example} \begin{proof} $f^{(k)}(0) = \alpha (\alpha - 1)\cdots(\alpha - k + 1),\quad k = 1, 2, \cdots$,因此 \[(1 + x)^\alpha = 1 + \alpha x + \frac{\alpha (\alpha - 1)}{2!}x^2 + \cdots + \frac{\alpha (\alpha - 1) \cdots (\alpha - n + 1)}{n!}x^n + o(x^n)\eqper \qedhere\] \end{proof} \begin{remark} 上式的几个例子: \begin{align*} \frac{1}{1+x} = 1 - x + x^2 - x^3 + x^4 - \cdots + (-1)^n x^n + o(x^n) & \quad (\alpha = -1)\\ \sqrt{1 + x} 1 + \frac{1}{2}x - \frac{1}{8}x^2 + o(x^2) & \quad (\alpha = \frac{1}{2})\\ \frac{1}{\sqrt{1 + x}} = 1 - \frac{1}{2}x + \frac{3}{8}x^2 + o(x^2) & \quad (\alpha = -\frac{1}{2}) \end{align*} \end{remark} \section{带Lagrange余项的Taylor公式} \begin{theorem} 设$f$在$(a, b)$内$n+1$阶可导,$\forall x_0$,$x_0 + \theta x \in (a,b)$,$\exists \theta \in (0,1)$满足 \[f(x_0 + \Delta x) = P_n(\Delta x) + \frac{f^{(n+1)}(x_0 + \theta \Delta x)}{(n+1)!} \Delta x^{n+1}\] 其中 \[R_n(\Delta x) := \frac{f^{(n+1)}(x_0 + \theta \Delta x)}{(n+1)!} \Delta x^{n+1}\] 称为Lagrange余项。 \end{theorem} \begin{proof} 要证明的式子等价于证明$\exists \theta \in (0,1)$使得对于$\Delta \neq 0$有 \[\frac{f(x_0 + \Delta x) - P_n(\Delta x)}{\Delta x^{n+1}} = \frac{f^{(n+1)}(x_0 + \theta \Delta x)}{(n+1)!}\eqper\] 回忆Cauchy中值定理: 设$F(t), G(t) \in C[0,1]$且在$(0,1)$内可导,且$\deriv{G}(t) \neq 0$,则$\exists \theta \in (0,1)$满足 \[\dfrac{F(1) - F(0)}{G(1) - G(0)} = \dfrac{\deriv{F}(\theta)}{\deriv{G}(\theta)}\eqper\] 那么现在取$F(t) = f(x_0 + t\Delta x) - P_n(t\Delta x), G(t) = (t\Delta x)^{n+1} \in C^{n+1}[0,1]$那么$F(0) = G(0) = 0$且 \begin{align*} \deriv{F}(t) & = \Delta x(\deriv{f}(x_0 + t \Delta x) - \deriv{P_n}(t\Delta x))\\ \deriv{G}(t) & = \Delta x(n+1)(t\Delta x)^n \end{align*} 那么应用Cauchy中值定理得到$\exists \theta_1 \in (0,1)$满足 \[\frac{f(x_0 + \Delta x) - P_n(\Delta x)}{\Delta x^{n+1}} = \frac{\deriv{f}(x_0 + \theta_1 \Delta x) - \deriv{P_n}(\theta_1 \Delta x)}{(n+1)(\theta_1 \Delta x)^n}\] 再对上式左侧应用Cauchy中值定理可得$\exists \theta_2 \in (0,1)$满足 \[\frac{\deriv{f}(x_0 + \theta_1 \Delta x) - \deriv{P_n}(\theta_1 \Delta x)}{(n+1)(\theta_1 \Delta x)^n} = \frac{f^{\prime \prime}(x_0 + \theta_1 \theta_2 \Delta x) - P_n^{\prime \prime}(\theta_1 \theta_2 \Delta x)}{(n+1)n(\theta_1 \theta_2 \Delta x)^n}\] 重复此过程继续得到$\theta_3, \theta_4, \cdots, \theta_n, \theta_{n+1} \in (0,1)$使得 \begin{align*} \frac{f(x_0 + \Delta x) - P_n(\Delta x)}{\Delta x^{n+1}} & = \cdots = \frac{f^{(n)}(x_0 + \theta_1\cdots\theta_n\Delta x) - P_n^{(n)}(\theta_1\cdots\theta_n\Delta x)}{(n+1)!(\theta_1\cdots\theta_n\Delta x)}\\ & = \frac{f^{(n+1)}(x_0 + \theta_1\cdots\theta_n\theta_{n+1}\Delta x)}{(n+1)!}\eqper \qedhere \end{align*} \end{proof} \begin{remark} 带Lagrange余项的Taylor公式也常常写作:设$f$在$(a,b)$内$n+1$阶可导,$\forall x_0, x \in (a,b)$,$\exists \xi$在$x_0$与$x$之间满足 \[f(x) = P_n(x - x_0) + \frac{f^{(n+1)}(\xi)}{(n+1)!}\Delta x^{n+1}\eqper\] \end{remark}