周次: 16 日期: June 9, 2022 节次: Extra1
In this lecture, we estimate the error of Taylor polynomial to the generating function. The result provides a criteria for the convergence of Taylor series. A lot of common functions can be expanded to Taylor series according to this result. And without the proof, we will see that more common functions can be represented by power series, and many of the applications will be discussed.
§ 11.9 Convergence of Taylor Series; Error Estimates
Two questions from the previous section:
- When does a Taylor series converge to its generating function?
- How accurately do a function’s Taylor polynomial approximate the function on a given interval?
Taylor’s Theorem
Theorem 22. Taylor’s Theorem and Taylor’s Formula
If $f$ and its first $n$ derivatives $f'$, $f''$, $\cdots$, $f^{(n)}$ are continuous on the closed interval between $a$ and $b$, and $f^{(n)}$ is differentiable on the open interval between $a$ and $b$, then for any $x\in[a,b]$, there exists a number $c$ between $a$ and $b$ such that
$$ \begin{equation}f(x)= f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots + \frac{f^{(n)}(a)}{n!}(x-a)^n + R_n(x)\end{equation} $$
where the remainder $R_n(x)$ is
$$ R_n(x) = \frac{f^{(n+1)}(c)}{(n+1)!}(x-a)^{n+1},\quad \text{for some $c$ between $a$ and $x$}. $$
For any value of $n$ we want, the equation gives both a polynomial approximation of $f$ of that order and a formula for the error involved in using that approximation over the interval $I$.
The equation (1) is called Taylor’s formula. The function $R_n(x)$ is called the remainder of order $n$ or the error term for the approximation of $f$ by $P_n(x)$ over $I.$
If the remainder $R_n(x)\to 0$ as $n\to \infty$ for all $x\in I$, we say that the Taylor series generated by $f$ at $x=a$ converges to $f$ on $I$, and we write
$$ f(x) = \sum_{k=0}^\infty \frac{f^{(k)}(a)}{k!}(x-a)^k. $$
Remark 1
When $n=0$, the Taylor’s formula becomes
$$ f(x) = f(a) + \frac{f'(c)}{1!}(x-a),\quad \text{for some $c$ between $a$ and $x$}. $$
which recovers the result from the Lagrange Mean Value Theorem.
Remark 2
Fixing $n$, the remainder approaches $0$ as $x\to a$. In fact, it approaches $0$ even faster than $(x-a)^n$, namely
$$ \lim_{x\to a} \frac{\frac{f^{(n+1)}(c)}{(n+1)!}(x-a)^{n+1} }{(x-a)^n} = 0. $$
So we may call the remainder a little “o” of $(x-a)^n$. That is,
$$ \begin{equation}\scriptsize f(x)= f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots + \frac{f^{(n)}(a)}{n!}(x-a)^n + o((x-a)^n),\quad \text{as $x\to a$}\end{equation} $$
This formula is also called the Taylor’s formula with Peano-type remainder.
Example 1. The Taylor Series for $e^x$ Revisited
The Taylor series generated by $f(x) = e^x$ at $x=0$ converges to $f(x)$ for every real value of $x$.
Solution. Writing down the Taylor’s formula for $e^x$ at $x=0$ we find
$$ e^x = 1 + x + \frac{x^2}{2!} + \cdots +\frac{x^n}{n!} + R_n(x) $$
where
$$ R_n(x) = \frac{e^c}{(n+1)!} x^{n+1}, \quad \text{for some $c$ between $0$ and $x$}. $$
An estimation shows
$$ |R_n(x)|\le \frac{e^{|x|} |x|^{n+1}}{(n+1)!} $$
Therefore, for any $x$, $\lim_{n\to\infty} R_n(x) = 0.$ Thus the series converges to $e^x$ for every $x$.
$$ e^x = \sum_{k=0}^\infty \frac{x^k}{k!}. $$
Example 2. The Taylor Series for $\sin(x)$ at $x=0$
The Taylor series for $\sin(x)$ at $x=0$ converges for all $x$.
Solution.
The $n$th order derivative for $\sin(x)$ can be written as
$$ \sin^{(n)}(x) = \sin(x+\frac{n\pi}{2}). $$
So
$$ \sin^{(n)}(0) = \begin{cases} 0, & \text{$n=2k$} \ (-1)^k, & \text{$n=2k+1$}\end{cases}. $$
The series has only odd-powered terms and, Taylor’s Theorem gives
$$ \sin(x) = x-\frac{x^3}{3!} + \frac{x^5}{5!} - \cdots + \frac{(-1)^k x^{2k+1}}{(2k+1)!} + R_{2k+1}(x), $$
where
$$ |R_{2k+1}(x)| = \left|\frac{\sin^{(2k+1)}(c)}{(2k+1)!}x^{2k+1}\right|\le \frac{x^{2k+1}}{(2k+1)!}\to 0 $$
Estimating the Remainder
Theorem 23. The Remainder Estimation Theorem
If there is a positive constant $M$ such that $|f^{(n+1)}(t)|\le M$ for all $t\in(x,a)$, then the remainder term $R_n(x)$ in Taylor’s Theorem satisfies the inequality
$$ |R_n(x)|\le M \frac{|x-a|^{n+1}}{(n+1)!}. $$
If this condition holds for every $n$ and the other conditions of Taylor’s Theorem are satisfied by $f$, then the series converges to $f(x)$.
Example 3. The Taylor Series for $\cos(x)$ at $x=0$ Revisited.
Show the Taylor Series for $\cos(x)$ at $x=0$ converges to $\cos(x)$ for every value of $x$.
Solution.
The $n$th derivative for $\cos(x)$ at $x=0$ is
$$ \cos^{(n)}(0) =\cos(0+\frac{n\pi}{2})= \begin{cases}(-1)^{k}& n=2k \ 0 & n=2k+1\end{cases}. $$
The Taylor’s formula shows that
$$ \cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots + \frac{(-1)^{k} x^{2k}}{(2k)!} + R_{2k}(x) $$
where $R_{2k}(x)= \frac{\cos^{(2k+1)}(c)}{(2k+1)!}x^{2k+1}$. Since $\cos(x)$ is bounded, the Remainder Esitmation Theorem with $M=1$ gives
$$ |R_{2k}(x)|\le \frac{|x|^{2k+1}}{(2k+1)!}. $$
For every value of $x$, $R_{2k}\to 0$. Therefore the series converges to $\cos(x)$ for every value of $x$.
$$ \cos(x) = \sum_{k=0}^\infty \frac{(-1)^k x^{2k}}{(2k)!} = 1-\frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \cdots $$
Various Ways to Find the Taylor Series
Example 4. Finding a Taylor Series by Substitution
Find the Taylor series for $\cos(2x)$ at $x=0.$
Solution. By substituting $2x$ for $x$ in the Taylor series for $\cos(x)$, we can find the Taylor series for $\cos(2x).$
$$ \cos(2x) = 1-\frac{(2x)^2}{2!} + \frac{(2x)^4}{4!} -\frac{(2x)^6}{6!} + \cdots= \sum_{k=0}^\infty (-1)^k \frac{2^{2k}x^{2k}}{(2k)!}. $$
This equality holds for $-\infty<2x<+\infty$, so the newly created series converges for all $x$.
Question. Why the series is in fact the Taylor series for $\cos(2x)$.
Example 5. Finding a Taylor Series by Multiplication
Find the Taylor series for $x\sin(x)$ at $x=0$.
Solution. By multiplying the Taylor series for $\sin(x)$ with $x$,
$$ x\sin(x) = x^2 - \frac{x^4}{3!} + \frac{x^6}{5!} - \frac{x^7}{6!} + \cdots. $$
Truncation Error
Example 6. Calculate $e$ with an error of less than $10^{-6}$
Solution.
According to the Taylor series,
$$ e = 1 + \frac1{1!} + \frac{1^2}{2!} + \frac{1^3}{3!} + \cdots $$
The first several terms on the right hand side will give a good approximation for $e$. So to estimate the approximation error, we use the Taylor’s formula
$$ e = 1 + 1 + \frac1{2!} + \frac1{3!} + \cdots + \frac1{n!} + R_n(1). $$
With $R_n(1) = e^c \frac{1}{(n+1)!}$, for some $c\in(0,1).$ Assuming we know that $e<3$, then the remainder is less than $3/(n+1)!$.
By experiment we find that $3/10! < 10^{-6}.$ Thus we should take $n$ to be at least $9$. With an error of less than $10^{-6}$.
$$ e= 1 + 1 + \frac12 + \frac1{3!} + \cdots + \frac1{9!} \approx 2.718282. $$
Example. How Accurate It Is to Take $\cos(10^\circ) \approx 1-\frac{(\pi/18)^2}{2!}=0.984769129$
Solution.
According to the Taylor’s formula
$$ \cos(x) = 1- \frac{x^2}{2!} + \frac{\cos^{(3)}(c) x^3}{3!} $$
The remainder has an absolute value less than $x^3/3!$. In the case of $x=\pi/18< 4/18 <1/4$. The error will be less than $\frac{1}{4^3 3!}\approx 0.0026.$
Example 7. For what values of $x$ can we replace $\sin(x)$ by $x-\frac{x^3}{3!}$ with an error of magnitude no greater than $3\times 10^{-4}$?
Solution.
Since the Taylor series for $\sin(x)$ is an alternating series, we can estimate the error in truncation by the Alternating Series Estimation Theorem
$$ \sin(x) = x - \frac{x^3}{3!} {\color{red}\bigg| } + \frac{x^5}{5!} - \cdots $$
After $x^3/3!$ the error is no greater than $|x|^5/120$. Therefore the error will be less than $3\times 10^{-4}$ if
$$ \frac{|x|^5}{120}< 3\times 10^{-4} \quad \text{or} \quad |x|< \sqrt[5]{360\times 10^{-4}} \approx 0.514. $$
Notice that the alternating property shows that the truncation $x-\frac{x^3}{3!}$ is an underestimation for $\sin(x)$ when $x>0$.
How the estimate given by the Remainder Estimation Theorem compares with the one just obtained from the Alternating Series Estimation Theorem?
$$ \sin(x) = x -\frac{x^3}{3!} + R_3(x) $$
The remainder $| R_3(x) |\le \frac{|x|^4}{4!} = \frac{|x|^4}{24}.$ It is not as good as obtained from the Alternating Series Estimation. But, if considered the $x^4$ term has the coefficient $0$, the remainder is actually of an order $4$, which is $|R_4(x)| = \frac{\cos^{(5)}(c)}{5!}|x^5|$, and it gives the same estimation as the Alternating Estimation Theorem.
Combining Taylor Series
If $f(x)$ and $g(x)$ both have convergent Taylor series on an interval $I$, then the sum $f(x)+g(x)$ has a Taylor series obtained by combining the Taylor series for $f(x)$ and $g(x)$. The Taylor series for $\sin(x) + \cos(x)$ is the term-by-term sum of the Taylor series for $\sin(x)$ and $\cos(x)$.
A glimpse to the Euler’s Identity
Definition.
For any real number $x$,
$$ e^{ix} = \cos x + i\sin x, \quad i=\sqrt{-1}. $$
Since
$$ e^{ix} = 1 + \frac{ix}{1!} + \frac{(ix)^2}{2!} + \frac{(ix)^3}{3!} + \frac{(ix)^4}{4!} + \frac{(ix)^5}{5!} + \frac{(ix)^6}{6!}\cdots \= \left(1-\frac{x^2}{2!} + \frac{x^4}{4!} -\cdots\right) + i\left(x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots\right)\ = \cos (x) + i\sin(x) $$
§ 11.10 Applications of Power Series
The Binomial Series for Powers and Roots
The Taylor series generates by $f(x) = (1+x)^a$, when $a$ is constant, is called the binomial series,
$$ 1+a x + \frac{a(a-1)}{2!} x^2 + \frac{a(a-1)(a-2)}{3!} x^3 + \cdots + \frac{a(a-1)(a-2) \cdots (a-k+1)}{k!} x^k + \cdots $$
This series, converges absolutely for $|x|<1$.
Derive the Binomial Series
To see why the function $f(x) = (1+x)^a$ generates the series above, we need to take derivatives. The function and derivatives are listed below
$$ \begin{align*}f(x) &= (1+x)^a \ f'(x) &= a(1+x)^{a-1} \ f''(x) &= a(a-1) (1+x)^{a-2} \ f'''(x) &= a(a-1)(a-2) (1+x)^{a-3} \ \vdots \ f^{(k)}(x) &= a(a-1)(a-2) \cdots (a-k+1)(1+x)^{a-k}\end{align*} $$
If $a$ is a non-negative integer, the series terminates after $a+1$ terms, otherwise the series is infinite.
Radius of Convergence
Apply the Ratio Test for absolute convergence we see that
$$ \left|\frac{u_{k+1}}{u_k}\right| = \left|\frac{a-k}{k+1}x\right|\to |x| $$
So for $|x|<1$, the binomial series converges, but we will not be able to show that it indeed converges to $(1+x)^a$.
The Binomial Series
For $-1<x<1$,
$$ (1+x)^a = \sum_{k=0}^\infty \binom{a}{k} x^k $$
where we define
$$ \binom{a}{0}=1,\quad \binom{a}{k} = \frac{a(a-1)\cdots (a-k+1)}{k!},\quad \text{for } k\ge 1. $$
Example 1. Using the Binomial Series
If $a=-1$,
$$ \binom{-1}{k} = (-1)^k. $$
So we get
$$ \frac1{1+x} = \sum_{k\ge 0}(-1)^k x^k $$
which is again a geometric series.
Example 2. Using the Binomial Series
If $a=\frac12$, we find
$$ (1+x)^{1/2} = \sum_{k\ge 0}\binom{1/2}{k} x^k = 1+\frac{x}{2} -\frac{x^2}{8} + \frac{x^3}{16} - \frac{5 x^4}{128} + \cdots. $$
Notice that the first two terms is a linear approximation for $(1+x)^{1/2}$, when $x$ is small.
Summary. The Maclaurin Series for Common Functions
- Power and Root functions
$$ (1+x)^a = \sum_{k=0}^\infty \binom{a}{k} x^k, \quad \text{converges absolutely when $|x|<1$} $$
- Exponential function
$$ e^x = 1 + \frac{x}{1!} + \frac{x^2}{2!} + \cdots = \sum_{k=0}^\infty \frac{x^k}{k!}, \quad \text{converges everywhere}. $$
- Logarithmic function
$$ \ln(1+x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4} + \cdots=\sum_{k=1}^\infty \frac{(-1)^{k-1}}{k}x^k, \quad\text{converges absolutely when $|x|<1$} $$
$$ \ln(1-x) = -x - \frac{x^2}{2} - \frac{x^3}{3} - \frac{x^4}{4} - \cdots=-\sum_{k=1}^\infty \frac{x^k}{k}, \quad\text{converges absolutely when $|x|<1$} $$
- Trigonometric functions
$$ \sin(x) = x-\frac{x^3}{3!} + \frac{x^5}{5!} - \cdots = \sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)!}x^{2k+1},\quad \text{converges everywhere}. $$
$$ \cos(x) = 1- \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots = \sum_{k=0}^\infty \frac{(-1)^k}{(2k)!}x^{2k},\quad \text{converges everywhere}. $$
- Inverse trigonometric functions
$$ \arctan(x) = x-\frac{x^3}{3} + \frac{x^5}{5} - \frac{x^7}{7} + \cdots = \sum_{k=0}^\infty \frac{(-1)^k}{k}x^{2k+1},\quad \text{converges absolutely when $|x|<1$} $$
Remark
The actual interval of convergence is $[-1,1]$. And from the Maclaurin series, we are able to find very interesting result for infinite series. The result will be shown later in this section.
With term-by-term integration, we can actually find the Maclaurin series for $\arcsin(x)$, since
$$ \arcsin(x) = \int_0^x \frac{1}{\sqrt{1-t^2}}dt = \int_0^x \sum_{k=0}^\infty \binom{-1/2}{k}t^k dt = \sum_{k=0}^\infty \frac{\binom{-1/2}{k}}{k+1}x^{k+1} $$
Again, the series converges absolutely for $|x|<1$.
Applications of Power Series
Evaluating Non-elementary Integrals
Example 5. Express $\int \sin x^2 dx$ as a power series, and estimate the definite integral $\int_0^1 \sin x^2 dx$ with an error of less than $0.001.$
Solution.
$$ \int \sin x^2 dx = C + \frac{x^3}{3} - \frac{x^7}{7\cdot 3!} + \frac{x^{11}}{11\cdot 5!} - \frac{x^{15}}{15\cdot 7!} + \frac{x^{10}}{19\cdot 9!} - \cdots $$
$$ \int_0^1 \sin x^2 dx \approx \frac{1}{3} - \frac1{42} \approx 0.310. $$
Evaluating Indeterminate Forms
Besides L’Hopital’s rule, we can use power series to evaluate indeterminate forms.
Example 7. Limits Using Power Series
Evaluate
$$ \lim_{x\to 1}\frac{\ln x}{x-1}. $$
Solution.
Write logarithmic function by Taylor’s formula at $x=1$
$$ \frac{\ln(x)}{x-1} = \frac{\ln(1) + \ln'(1)(x-1) + \frac{\ln''(c)}{2!} (x-1)^2 }{x-1} = \frac{(x-1) -\frac1{2 c^2}(x-1)^2 }{x-1}\to 1 $$
Note that it’s more convenient to use Taylor’s formula with remainder of Peano-type.
$$ \frac{\ln(x)}{x-1} = \frac{\ln(1) + \ln'(1)(x-1) + o( (x-1)) }{x-1} = \frac{(x-1) +o(x-1)}{x-1}\to 1 $$
Example 8. Limits Using Power Series
Evaluate
$$ \lim_{x\to 0}\frac{\sin(x) - \tan(x)}{x^3} $$
Solution.
We have
$$ \sin(x) - \tan(x) = \frac{\sin(x)}{\cos(x)} (\cos(x) - 1) = \frac{\sin(x)}{\cos(x)}\left(1-\frac{x^2}{2!} + o(x^2)-1\right) = \frac{\sin(x)}{\cos(x)}\left(-\frac{x^2}{2!} + o(x^2)\right) $$
Therefore a
$$ \lim_{x\to0}\frac{\sin(x) -\tan(x)}{x^3} = \lim_{x\to 0} \frac{\sin(x)}{x\cos(x)}\cdot\lim_{x\to 0}\frac{-\frac12 x^2 + o(x^2)}{x^2} = -\frac12. $$
Example 9. Approximation Formula for $\csc(x)$
Prove $\csc(x) \approx \frac1x + \frac{x}{6}.$