Section 6.8 Power Series and Polynomial Approximation
¶In this chapter we have a closer look at so-called power series, which arise in the study of analytic functions. A power series is basically an infinite degree polynomial that represents some function. Since we know a lot more about polynomial functions than arbitrary functions, this allows us to readily differentiate, integrate, and approximate some functions using power series.
Subsection 6.8.1 Power Series
¶Recall that the sum of a geometric series can be expressed using the simple formula:
if \(|x|\lt 1\text{,}\) and that the series diverges when \(|x|\ge 1\text{.}\) At the time, we thought of \(x\) as an unspecified constant, but we could just as well think of it as a variable, in which case the series
is a function, namely, the function \(k/(1-x)\text{,}\) as long as \(|x|\lt 1\text{:}\) Looking at this from the opposite perspective, this means that the function \(k/(1-x)\) can be represented as the sum of an infinite series. Why would this be useful? While \(k/(1-x)\) is a reasonably easy function to deal with, the more complicated representation \(\sum kx^n\) does have some advantages: it appears to be an infinite version of one of the simplest function types — a polynomial. Later on we will investigate some of the ways we can take advantage of this ‘infinite polynomial’ representation, but first we should ask if other functions can even be represented this way.
The geometric series has a special feature that makes it unlike a typical polynomial—the coefficients of the powers of \(x\) are all the same, namely \(k\text{.}\) We will need to allow more general coefficients if we are to get anything other than the geometric series.
Definition 6.63. Power Series Centred Around Zero.
A power series is a series of the form
where the coefficients \(a_n\) are real numbers.
Note:
As we did in the section on sequences, we can think of the \(a_n\) as being a function \(a(n)\) defined on the non-negative integers.
It is important to remember that the \(a_n\) do not depend on \(x\text{.}\)
Example 6.64. Power Series Convergence.
Determine the values of \(x\) for which the power series \(\ds\sum_{n=1}^\infty {x^n\over n}\) converges.
We can investigate convergence using the Ratio Test:
Thus when \(|x|\lt 1\) the series converges and when \(|x|>1\) it diverges, leaving only two values in doubt. When \(x=1\) the series is the harmonic series and diverges; when \(x=-1\) it is the alternating harmonic series (actually the negative of the usual alternating harmonic series) and converges. Thus, we may think of \(\ds\sum_{n=1}^\infty {x^n\over n}\) as a function from the interval \([-1,1)\) to the real numbers.
A bit of thought reveals that the Ratio Test applied to a power series will always have the same nice form. In general, we will compute
assuming that \(\ds \lim |a_{n+1}|/|a_n|\) exists:
-
If \(L \in (0,\infty)\text{:}\)
Then the series converges if \(L|x|\lt 1\text{,}\) that is, if \(|x|\lt 1/L\text{,}\) and diverges if \(|x|>1/L\text{.}\)
Only the two values \(x=\pm1/L\) require further investigation.
The value \(1/L\) is called the radius of convergence .
Thus the series will always define a function on the interval \((-1/L,1/L)\text{,}\) that perhaps will extend to one or both endpoints as well.
This interval is referred to as the interval of convergence.
This interval is essentially the domain of the power series .
-
If \(L=0\text{:}\)
Then no matter what value \(x\) takes the limit is \(0\text{.}\)
The series converges for all \(x\) and the function is defined for all real numbers.
-
If \(L=\infty\text{:}\)
Then no matter what value \(x\) takes the limit is infinite.
The series converges only when \(x=0\text{.}\)
We can make these ideas a bit more general. Consider the series
This looks a lot like a power series, but with \((x+2)^n\) instead of \(x^n\text{.}\) Let's try to determine the values of \(x\) for which it converges. This is just a geometric series, so it converges when
So the interval of convergence for this series is \((-5,1)\text{.}\) The centre of this interval is at \(-2\text{,}\) which is at distance 3 from the endpoints, so the radius of convergence is 3, and we say that the series is centred at \(-2\text{.}\)
Interestingly, if we compute the sum of the series we get
Multiplying both sides by 1/3 we obtain
which we recognize as being equal to
so we have two series with the same sum but different intervals of convergence.
This leads to the following definition:
Definition 6.65. Power Series Centred Around \(a\).
A power series centred at \(a\) has the form
where the centre \(a\) and coefficients \(a_n\) are real numbers.
Note: The power series centred at zero given in ٱھԾپDz6.63 is a special case of the above definition when \(a=0\text{.}\)
Convergence of a Power Series.
Given a power series \(\sum a_n(x-a)^n\) and its radius of convergence \(R\text{,}\) the series behaves in one of three ways:
-
The series converges absolutely for \(x\) with \(|x-a| \lt R\text{,}\) it diverges for \(x\) with \(|x-a| > R\text{,}\) and at \(x=a-R\) and \(x=a+R\) further investigation is needed.
-
When \(R=\infty\text{,}\) the series converges absolutely for every \(x\text{.}\)
-
When \(R=0\text{,}\) the series converges at \(x=a\) and diverges everywhere else.
Example 6.66. Interval of Convergence.
Given the power series
determine the following:
radius of convergence
interval of convergence
Obviously, the series converges for \(x=2\text{.}\) To determine all values of \(x\) for which the series converges, we begin by applying the Ratio Test:
By the Ratio Test, the radius of convergence is \(R=3\text{.}\)
-
We now determine the interval of convergence. By the Ratio Test, the series converges absolutely if \(L\lt 1\text{:}\)
\begin{equation*} \begin{split} \amp \frac{1}{3}|x-2| \lt 1 \\ \amp \implies |x-2| \lt 3 \\ \amp \implies -3 \lt x-2 \lt 3 \\ \amp \implies -1\lt x \lt 5 \end{split} \end{equation*}The series diverges if \(L > 1\text{,}\) i.e. \(x \lt -1\) and \(x > 5\text{.}\) Let us now look at the case when \(L=1\text{,}\) which means investigating the behaviour of the series at endpoints \(x=-1\) and \(x=5\text{:}\)
Case \(x=-1\text{:}\) Then the series becomes
\begin{equation*} \sum_{n=0}^{\infty} \frac{(-1)^n n(-1-2)^n}{3^n} = \sum_{n=0}^{\infty}(-1)^{2n} n = \sum_{n=0}^{\infty} n\text{.} \end{equation*}Since \(\lim\limits_{n\to\infty} n = \infty \neq 0\text{,}\) this series is divergent by the \(n\)-th Term Test (Divergence Test).
Case \(x=5\text{:}\) Then the series becomes
\begin{equation*} \sum_{n=0}^\infty \frac{(-1)^n n(5-2)^n}{3^n} = \sum_{n=0}^{\infty} (-1)^n n\text{.} \end{equation*}Since \(\lim\limits_{n\to\infty} (-1)^n n\) does not exist, this series is also divergent by the \(n\)-th Term Test (Divergence Test).
Thus, the interval of convergence for the given power series is \(x \in (-1,5)\text{.}\)
Example 6.67. Interval of Convergence.
Given the power series
determine the following:
radius of convergence
interval of convergence
Obviously, the series converges for \(x=-3\text{.}\) To determine all values of \(x\) for which the series converges, we begin by applying the Ratio Test:
provided that \(x\neq-3\text{.}\) Therefore, this series will only converge for \(x=3\text{.}\)
The radius of convergence is \(R=0\text{.}\)
The interval of convergence is \(x=-3\text{,}\) which is just one point.
Exercises for Section 6.8.1.
Exercise 6.8.1.
Find the radius and interval of convergence for each series. In part c), do not attempt to determine whether the endpoints are in the interval of convergence.
-
\(\ds\sum_{n=0}^\infty n x^n\)
AnswerSolution\(R=1\text{,}\) \(I=(-1,1)\)Applying the Ratio Test to the power series gives\begin{equation*} \begin{split} L \amp= \lim_{n\to\infty} \left\vert \frac{(n+1)x^{n+1}}{nx^n}\right\vert\\ \amp= \lim_{n\to\infty} \left\vert x \frac{n+1}{n}\right\vert\\ \amp= |x| \lim_{n\to\infty} \left\vert 1+ \frac{1}{n}\right\vert\\ \amp= |x|\end{split} \end{equation*}Hence, The radius of convergence is \(R=1\text{.}\) We now investigate what happens when \(x=-1\text{:}\) the series\begin{equation*} \sum_{n=0}^{\infty} (-1)^n n \end{equation*}is a divergent series, and similarly for\begin{equation*} \sum_{n=0}^{\infty} n. \end{equation*}Therefore, the endpoints \(x=\pm 1\) are not included in the interval of convergence. The interval of convergence is thus \(I=(-1,1)$\text{.}\) -
\(\ds\sum_{n=0}^\infty {x^n\over n!}\)
AnswerSolution\(R=\infty\text{,}\) \(I=(-\infty,\infty)\)Applying the Ratio Test to the power series gives
\begin{equation*} \begin{split} L \amp = \lim_{n\to\infty} \left\vert \frac{x^{n+1}}{(n+1)!} \frac{n!}{x^n}\right\vert \\ \amp = \lim_{n\to\infty} \left\vert \frac{x^{n+1}}{x^n} \frac{1}{n+1}\right\vert \\ \amp = \lim_{n\to\infty} \left\vert \frac{x}{n+1} \right\vert \\ \amp = |x| \lim_{n\to\infty} \frac{1}{n+1}= 0. \end{split} \end{equation*}And so the series
\begin{equation*} \sum_{n=0}^\infty \frac{x^n}{n!} \end{equation*}converges for all \(x\text{,}\) i.e., the radius of convergence is \(R=\infty\) and the interval of convergence is \((-\infty,\infty)\text{.}\)
-
\(\ds\sum_{n=1}^\infty {n!\over n^n}(x-2)^n\)
AnswerSolution\(R=e\text{,}\) \(I=(2-e,2+e)\)We apply the Ratio Test:\begin{equation*} \begin{split} L \amp= \lim_{n\to\infty} \left\vert \frac{(n+1)!n^n(x-2)^{n+1}}{n!n^n(x-2)^n}\right\vert\\ \amp= |x-2| \lim_{n\to\infty} \left\vert \frac{(n+1)n^n}{(n+1)^{n+1}}\right\vert\\ \amp= |x-2| \lim_{n\to\infty} \left\vert \frac{n^n}{(n+1)^n}\right\vert\\ \amp= |x-2|\lim_{n\to\infty} \left(\frac{1}{1+1/n}\right)^{1/n} = |x-2| \frac{1}{e}. \end{split} \end{equation*}Therefore, the radius of convergence is \(R= e\text{.}\) It turns out the endpoints are not included in the interval of convergence: \((2-e,2+e)\text{.}\) -
\(\ds\sum_{n=1}^\infty {(n!)^2\over n^n}(x-2)^n\)
AnswerSolution\(R=0\text{,}\) converges only when \(x=2\)We apply the Ratio Test:\begin{equation*} \begin{split} L \amp= |x-2| \lim_{n\to\infty} \left(\frac{(n+1)!^2}{(n+1)^{n+1}} \frac{n^n}{n!^2}\right)\\ \amp= |x-2|\lim_{n\to\infty} \left(\frac{n^n}{(n+1)^{n+1}} \frac{(n+1)!^2}{n!^2}\right)\\ \amp= |x-2|\lim_{n\to\infty} \left(\frac{n^n}{(n+1)^{n+1}} (n+1)^2\right)\\ \amp= |x-2|\lim_{n\to\infty} \left(\frac{n^n}{(n+1)^(n-1)}\right) \end{split} \end{equation*}Now take the logarithm of this limit:\begin{equation*} \log\left( \lim_{n\to\infty} \left(\frac{n^n}{(n+1)^{(n-1)}}\right)\right) = \lim_{n\to\infty} n\log n - (n-1)\log(n+1) = \infty. \end{equation*}Therefore, the series converges only if \(x=2\text{.}\) Therefore, the radius of convergence is \(R=0\) and the interval of convergence is \(I=2\text{.}\) -
\(\ds\sum_{n=1}^\infty {(x+5)^n\over n(n+1)}\)
AnswerSolution\(R=1\text{,}\) \(I=[-6,-4]\)We use the Ratio Test to determine the radius of convergence:
\begin{equation*} \begin{split} L \amp = \lim_{n\to\infty} \left\vert\frac{(x+5)^{n+1}}{(n+1)(n+2)} \frac{n(n+1)}{(x+5)^n} \right\vert\\ \amp = \lim_{n\to\infty} \left\vert \frac{(x+5) n}{n+2} \right\vert \\ \amp = |x+5| \lim_{n\to\infty} \frac{n}{n+2} \\ \amp = |x+5| \lim_{n\to\infty} \frac{1}{1+2/n} = |x+5| \end{split} \end{equation*}So the radius of convergence is \(R=1\text{,}\) and the power series diverges for all \(x \lt -6\) and \(x > -4\text{.}\) We now determine the convergence at the endpoints. For \(x=-6\text{,}\) the series becomes
\begin{equation*} \sum_{n=0}^{\infty} \frac{(-1)^{n+1}}{n(n+1)} \end{equation*}which converges by the Alternating Series Test. When \(x=-4\) the series becomes
\begin{equation*} \sum_{n=0}^{\infty} \frac{1}{n(n+1)}\text{.} \end{equation*}This series converges since
\begin{equation*} \frac{1}{n(n+1)} \lt \frac{1}{n^2}\text{.} \end{equation*}Therefore, the interval of convergence is \([-6,-4]\text{.}\)
-
\(\ds\sum_{n=1}^\infty {n!\over n^n}x^n\)
AnswerSolution\(R=e\text{,}\) \(I=(-e,e) \)We apply the Ratio Test:\begin{equation*} \begin{split} L \amp= |x| \lim_{n\to\infty} \left(\frac{n^n}{(n+1)^{n+1}} \frac{(n+1)!}{n!}\right)\\ \amp= |x| \lim_{n\to\infty} \left(\frac{n^n}{(n+1)^{n+1}} (n+1)\right)\\ \amp= |x| \lim_{n\to\infty} \left(\frac{n^n}{(n+1)^n}\right)\\ \amp= |x| \lim_{n\to\infty} \frac{1}{(1+\frac{1}{n})^n} = |x| \frac{1}{e}. \end{split} \end{equation*}Threfore, the radius of convergence is \(R=e \text{.}\) We now test whether or not the endpoints are included in the interval of convergence. Since neither\begin{equation*} \sum_{n=1}^{\infty} (x-e)^n \frac{n!}{n} \end{equation*}nor\begin{equation*} \sum_{n=1}^{\infty} (x+e)^n \frac{n!}{n} \end{equation*}converge, the interval of convergence is \(I=(-e,e) \text{.}\)
Subsection 6.8.2 Calculus with Power Series
¶We now know that some functions can be expressed as power series, which look like infinite polynomials. In fact, there are many extremely useful functions that cannot be represented using the usual elementary functions, but they can be represented using a power series. For example, the Bessel functions and hypergeometric functions which are important in such fields as engineering, physics and acoustics. Since it is easy to find derivatives and integrals of polynomials, we might hope that we can take derivatives and integrals of power series in an analogous way. In fact we can, as stated in the following theorem, which we will not prove here.
Theorem 6.68. Differentiation and Integration of a Power Series.
Suppose the power series \(f(x)=\ds\sum_{n=0}^\infty a_n(x-a)^n\) has radius of convergence \(R\text{.}\)
-
The derivative of \(f\) is the term by term differentiation of the power series:
\begin{equation*} f'(x)=\sum_{n=1}^\infty na_n(x-a)^{n-1} \end{equation*}with radius of convergence \(R\text{.}\)
-
The integral of \(f\) is the term by term integration of the power series:
\begin{equation*} \int f(x)\,dx = C+\sum_{n=0}^\infty {a_n\over n+1}(x-a)^{n+1} \end{equation*}with radius of convergence \(R\text{.}\)
Example 6.69. Power Series Representation.
Given \(f(x)=\ln|1-x|\text{:}\)
Find a power series representation of \(f\text{.}\)
Use the first seven terms of this series to approximate \(\ln(3/2)\text{.}\)
Approximate \(\ln(9/4)\text{.}\)
-
We recall that the derivative of \(\ln|1-x|\) is \(\frac{1}{1-x}\text{,}\) and so we start with the geometric series:
\begin{equation*} {1\over 1-x} = \sum_{n=0}^\infty x^n \end{equation*}when \(|x| \lt 1\text{.}\) Next, we integrate to obtain the function \(f\text{:}\)
\begin{equation*} \begin{split} \int{1\over 1-x}\,dx \amp = -\ln|1-x| = \sum_{n=0}^\infty {1\over n+1}x^{n+1}\\ f(x) \amp = \ln|1-x| = \sum_{n=0}^\infty -{1\over n+1}x^{n+1}, \end{split} \end{equation*}when \(|x|\lt 1\text{.}\) The series does not converge when \(x=1\text{,}\) since \(\sum_{n=0}^{\infty} -\frac{1}{n+1}(1)^{n+1}=-\sum_{n=1}^{\infty}\frac{1}{n}\) is the negative harmonic series. But the series does converge when \(x=-1\text{,}\) since \(\sum_{n=0}^{\infty} -\frac{1}{n+1}(-1)^{n+1}=\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}\) is the alternating harmonic series. Therefore, the interval of convergence is \([-1,1)\text{.}\)
-
We note that \(-1 \leq x \lt 1\) implies \(0 \lt 1-x \leq 2\text{,}\) and that \(0 \lt \frac{3}{2} \leq 2\text{,}\) so we need \(x=-\frac{1}{2}\text{.}\) Then
\begin{equation*} \ln(3/2)=\ln\left\vert-(-1/2)\right\vert=\sum_{n=0}^{\infty} - \frac{1}{n+1}\left(-\frac{1}{2}\right)^{n+1} = \sum_{n=0}^\infty \frac{(-1)^{n+1}}{(n+1)2^{n+1}}\text{.} \end{equation*}Now we use the first seven terms to approximate \(\ln(3/2)\text{:}\)
\begin{equation*} \ln(3/2)\approx {1\over 2}-{1\over 8}+{1\over 24}-{1\over 64} +{1\over 160}-{1\over 384}+{1\over 896} ={909\over 2240}\approx 0.406\text{.} \end{equation*}Because this is an alternating series with decreasing terms, we know that the true value is between \(909/2240\) and \(909/2240-1/2048=29053/71680\approx .4053\text{,}\) so \(0.4053\leq\ln(3/2)\leq 0.406\text{.}\)
-
With a bit of arithmetic, we can approximate values outside of the interval of convergence, such as \(9/4 > 2\text{.}\) We can use the approximation we just computed, plus some rules for logarithms:
\begin{equation*} \ln(9/4)=\ln((3/2)^2)=2\ln(3/2)\approx 0.812\text{,} \end{equation*}and using our bounds above,
\begin{equation*} 0.8106\leq \ln(9/4)\leq 0.812\text{.} \end{equation*}
Exercises for Section 6.8.2.
Exercise 6.8.2.
Find a series representation for
-
\(\ln 2\)
AnswerSolutionthe alternating harmonic seriesWe know that we can write\begin{equation*} \ln|1-x| = \sum_{n=0}^{\infty} \frac{-1}{n+1} x^{n+1}, \end{equation*}for \(x \in [-1,1)\text{.}\) Therefore,\begin{equation*} \ln(2) = \ln|1-(-1)| = \sum_{n=0}^{\infty} \frac{-1}{n+1} (-1)^{n+1} = \sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n}, \end{equation*}which is the alternating harmonic series. -
\(\ln (9/2)\)
AnswerSolution\(\ds\sum_{n=1}^{\infty} \frac{1}{n} \left(\frac{7}{9}\right)^{n}\)We know that we can write\begin{equation*} \ln|1-x| = \sum_{n=0}^{\infty} \frac{-1}{n+1} x^{n+1}, \end{equation*}for \(x \in [-1,1)\text{.}\) Therefore, let \(\ln(9/2) = -\ln(2/9)\text{.}\) Then\begin{equation*} \ln(2/9) = -\ln|1-(7/9)| = -\sum_{n=0}^{\infty} \frac{-1}{n+1} (7/9)^{n+1} = \sum_{n=1}^{\infty} \frac{1}{n} \left(\frac{7}{9}\right)^{n}. \end{equation*}
Exercise 6.8.3.
Find a power series representation for the following functions.
-
\(\ds 1/(1-x)^2\)
AnswerSolution\(\ds\sum_{n=0}^\infty (n+1)x^n\)We know that
\begin{equation*} \frac{1}{(1-x)^2} = \diff{}{x} \frac{1}{1-x}\text{,} \end{equation*}and that
\begin{equation*} \frac{1}{1-x} = \sum_{n=0}^{\infty} x^n \end{equation*}for \(|x| \lt 1\text{.}\) Combining this information, we find the following power series representation:
\begin{equation*} \frac{1}{(1-x)^2} = \diff{}{x} \sum_{n=0}^{\infty} x^n = \sum_{n=-1}^{\infty} nx^{n-1} = \sum_{n=0}^{\infty} (n+1)x^n\text{,} \end{equation*}for \(|x| \lt 1\text{.}\)
-
\(\ds 2/(1-x)^3\)
AnswerSolution\(\ds\sum_{n=0}^\infty (n+1)(n+2)x^n\)We have\begin{equation*} \frac{2}{(1-x)^3} = \diff{}{x} \frac{1}{(1-x)^2}. \end{equation*}Therefore,\begin{equation*} \frac{2}{(1-x)^3} = \diff{}{x} \sum_{n=0}^{\infty} (n+1) x^n = \sum_{n=-1}^{\infty} n(n+1)x^{n-1} = \sum_{n=0}^{\infty} (n+1)(n+2) x^n, \end{equation*}for \(|x| \lt 1\text{.}\) \(\ds 1/(1-x)^3\)
-
\(\ds\int\ln(1-x)\,dx\)
AnswerSolution\(\ds C+\sum_{n=0}^\infty {-1\over (n+1)(n+2)}x^{n+2}\)We know that\begin{equation*} \ln|1-x| = \sum_{n=1}^{\infty} \frac{-1}{n} x^n. \end{equation*}Therefore,\begin{equation*} \int \ln|1-x| \,dx = \int \sum_{n=1}^{\infty} \frac{-1}{n+1} x^{n+1}\,dx = C + \sum_{n=0}^{\infty} \frac{-1}{(n+1)(n+2)}x^{n+2}, \end{equation*}for \(|x| \lt 1\text{.}\)
Subsection 6.8.3 Maclaurin Series and Taylor Series
¶We have seen that some functions can be represented as series, which may give valuable information about the function. So far, we have seen only those examples that result from manipulation of our one fundamental example, the geometric series. We would like to start with a given function and produce a series to represent it, if possible.
Suppose that \(\ds f(x)=\sum_{n=0}^\infty a_nx^n\) on some interval of convergence centred at 0. Then we know that we can compute derivatives of \(f\) by taking derivatives of the terms of the series. Let's compute the first few derivatives and look for a pattern:
By examining these it's not hard to discern the general pattern. The \(k\)th derivative must be
We can express this more clearly by using factorial notation:
We can solve for \(a_k\) by substituting \(x=0\) in the formula for \(f^{(k)}(x)\text{:}\)
Note that the original series for \(f\) yields \(f(0)=a_0\text{.}\) So if a function \(f\) can be represented by a series, we can easily find such a series. This leads us to the definition of the so-called Maclaurin series .
Definition 6.70. Maclaurin Series.
Suppose a function \(f\) is defined at \(x=0\) and whose derivatives all exist at \(x=0\text{.}\) Then the Maclaurin series of \(f\) at \(x=0\) is given by
Note: A warning is in order here. Given a function \(f\) we may be able to compute the Maclaurin series, but that does not mean we have found a series representation for \(f\text{.}\) We still need to know where the series converges, and if, where it converges, it converges to \(f(x)\text{.}\) While for most commonly encountered functions the Maclaurin series does indeed converge to \(f\) on some interval, this is not true of all functions, so care is required.
Example 6.71. Maclaurin Series.
Find the Maclaurin series for \(f(x)=1/(1-x)\text{.}\)
We need to compute the derivatives of \(f\) and hope to spot a pattern.
So
and the Maclaurin series is
the geometric series with interval of convergence \(|x| \lt 1\text{.}\)
As a practical matter, if we are interested in using a series to approximate a function, we will need some finite number of terms of the series. Even for functions with messy derivatives we can compute these using computer software like Sage. If we want to describe a series completely, we would like to be able to write down a formula for a typical term in the series. Fortunately, a few of the most important functions are very easy.
Example 6.72. Maclaurin Series.
Find the Maclaurin series for \(f(x)=\sin x\text{.}\)
Computing the first few derivatives is simple: \(f'(x)=\cos x\text{,}\) \(f''(x)=-\sin x\text{,}\) \(f'''(x)=-\cos x\text{,}\) \(\ds f^{(4)}(x)=\sin x\text{,}\) and then the pattern repeats. The values of the derivative when \(x=0\) are: 1, 0, \(-1\text{,}\) 0, 1, 0, \(-1\text{,}\) 0,…, and so the Maclaurin series is
We should always determine the radius of convergence:
so the series converges for every \(x\text{.}\) Since it turns out that this series does indeed converge to \(\sin x\) everywhere, we have a series representation for \(\sin x\) for every \(x\text{.}\)
Sometimes the formula for the \(n\)-th derivative of a function \(f\) is difficult to discover, but a combination of a known Maclaurin series and some algebraic manipulation leads easily to the Maclaurin series for \(f\text{.}\)
Example 6.73. Maclaurin Series.
Find the Maclaurin series for \(f(x)= x\sin(-x)\text{.}\)
To get from \(\sin x\) to \(x\sin(-x)\) we substitute \(-x\) for \(x\) and then multiply by \(x\text{.}\) We can do the same thing to the series for \(\sin x\text{:}\)
As we have seen, a power series can be centred at a point other than zero, and the method that produces the Maclaurin series can also produce such series, which are referred to as Taylor series .
Definition 6.74. Taylor Series.
Suppose a function \(f\) is defined at \(x=a\) and whose derivatives all exist at \(x=a\text{.}\) Then the Taylor series of \(f\) centred at \(x=a\) is given by
Example 6.75. Taylor Series.
Find a Taylor series centred at \(-2\) for \(f(x)=1/(1-x)\text{.}\)
Method 1: We develop the series from scratch. Suppose \(f(x)=\ds\sum_{n=0}^{\infty}a_n(x+2)^n\text{.}\) We compute the \(k\)-th derivatives of \(f\) and the power series representation to solve for \(a_n\text{:}\)
Using our work in 油6.71, the \(k\)-th derivative of \(f(x)=\frac{1}{1-x}\) is given by
Based on our work at the beginning of this section, the \(k\)-th derivative of the power series representation is given by
Now we equate these two results to obtain the following equation:
and substituting \(x=-2\) we get \(\ds k!3^{-k-1}=k!a_k\) and \(\ds a_k=3^{-k-1}=1/3^{k+1}\text{,}\) so the series is
Method 2: We use the formula for the Taylor series representation of \(f\text{:}\)
Now we compute the first few derivatives and evaluate them at \(x=-2\) to deduce a pattern:
Hence, the \(n\)-th derivative evaluated at \(x=-2\) is
and so, as before, the series is
Example 6.76. Taylor Series.
Given \(f(x)=e^x\text{,}\) find the following:
The Taylor series of \(f\) centred at 3.
The interval of convergence for the series.
-
We use the formula for the Taylor series representation of \(f\text{:}\)
\begin{equation*} f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(3)}{n!}(x-3)^n \end{equation*}Since the derivative of \(f(x)=e^x\) is again \(e^x\text{,}\) we have that the \(n\)-th derivative evaluated at \(x=-3\) is
\begin{equation*} f^{(n)}(3)=e^3\text{,} \end{equation*}and so the series is
\begin{equation*} \sum_{n=0}^{\infty}\frac{f^{(n)}(3)}{n~}(x-3)^n = \sum_{n=0}^{\infty}\frac{e^3}{n!}(x-3)^n\text{.} \end{equation*} -
We use the Ratio Test to determine the radius of convergence:
\begin{equation*} \begin{split} L \amp =\lim_{n\to\infty} \left\vert \frac{a_{n+1}}{a_n}\right\vert\\ \amp =\lim_{n\to\infty} \left\vert\frac{e^3(x-3)^{n+1}}{(n+1)!}\frac{n!}{e^3(x-3)^n}\right\vert\\ \amp =\lim_{n\to\infty} \left\vert\frac{x-3}{n+1}\right\vert \\ \amp = |x-3|\lim_{n\to\infty}\frac{1}{n+1} \\ \amp = 0 \end{split} \end{equation*}Hence, the radius of convergence is infinity, and so the series converges absolutely for every \(x\text{,}\) i.e. the interval of convergence is \((-\infty,\infty)\text{.}\)
ղ6.5 is a list of the five most common Maclaurin series and their interval of convergence.
Exercises for Section 6.8.3.
Exercise 6.8.4.
For each function, find the Maclaurin series and the radius of convergence.
-
\(f(x)=\cos x\)
AnswerSolution\(\sum_{n=0}^{\infty} (-1)^n \frac{x^{2n}}{(2n)!}\text{,}\) \(R=\infty\text{.}\)We compute:\begin{equation*} \begin{split} f(0) \amp= \cos (0) = 1\\ f'(0) \amp= -\sin(0) = 0\\ f''(0) \amp= -\cos(0) = -1 \\ f'''(0) \amp= \sin(0) = 0\\ f^{(iv)}(0) \amp= \cos(0) = 1 \vdots \end{split} \end{equation*}Therefore, our Maclaurin series expansion is\begin{equation*} \cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^5}{5!} + \dots = \sum_{n=0}^{\infty} (-1)^n \frac{x^{2n}}{(2n)!}. \end{equation*}We now compute the radius of convegence using the Ratio Test:\begin{equation*} L = |x|^2 \lim_{n\to\infty} \left\vert \frac{1}{(2n+1)(2n+2)}\right\vert = 0. \end{equation*}Hence, \(R=\infty.\) -
\(f(x)=\ds e^x\)
AnswerSolution\(\ds\sum_{n=0}^{\infty} \frac{x^n}{n!}\text{,}\) \(R=\infty.\)We compute:\begin{equation*} \begin{split} f(0) \amp= e^{(0)} = 1\\ f'(0) \amp= e^{(0)} = 1\\ f''(0) \amp= e^{(0)} = 1 \\ \vdots \end{split} \end{equation*}Therefore, our Maclaurin series expansion is\begin{equation*} e^{x} = 1 + x+ \frac{x^2}{2!} + \frac{x^43}{3!} + \dots = \sum_{n=0}^{\infty} \frac{x^n}{n!}. \end{equation*}We now compute the radius of convegence using the Ratio Test:\begin{equation*} L = |x| \lim_{n\to\infty} \left\vert \frac{1}{n+1}\right\vert = 0. \end{equation*}Hence, \(R=\infty.\) -
\(f(x)=\dfrac{1}{1+x}\)
AnswerSolution\begin{equation*} \sum_{n=0}^{\infty} (-1)^nx^n \text{ for } |x| \lt 1 \end{equation*}The simplest method for determining the Maclaurin series for \(f(x) = \dfrac{1}{1+x}\) is to use a known series expansion. For example, we know that
\begin{equation*} \frac{1}{1-x} = \sum_{n=0}^{\infty} x^n \text{ for } |x| \lt 1\text{,} \end{equation*}and so if we make the substitution \(x=-x\text{,}\) we find
\begin{equation*} \frac{1}{1+x} = \sum_{n=0}^{\infty} (-1)^nx^n \text{ for } |x| \lt 1\text{.} \end{equation*}We could similarly use the fact that
\begin{equation*} \frac{1}{1+x} = \diff{}{x} \ln(1+x) = \diff{}{x}\left(\sum_{n=1}^{\infty} (-1)^{n-1}\frac{x^n}{n}\right)\text{,} \end{equation*}or we could develop the desired Maclaurin series from scratch: The Maclaurin series expansion of a function \(f\) is given by
\begin{equation*} f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!}x^n\text{,} \end{equation*}and so we calculate
\begin{equation*} \begin{split} f(x) \amp = \frac{1}{1+x} \\ f'(x) \amp = -\frac{1}{(1+x)^2} \\ f''(x) \amp = \frac{2}{(1+x)^3} \\ f'''(x) \amp = -\frac{6}{(1+x)^4} \\ \amp \vdots \\ f^{(n)}(x) \amp = \frac{(-1)^{n-1}n!}{(1+x)^{n+1}} \end{split} \end{equation*}Thus,
\begin{equation*} f(x) = \sum_{n=0}^{\infty} \frac{(-1)^n n!}{(1+0)^{n+1} n!}x^n =\sum_{n=0}^{\infty} (-1)^n x^n\text{.} \end{equation*}We compute the radius of convergence using the Ratio Test:
\begin{equation*} \begin{split} L \amp = \lim_{n\to\infty} \left\vert \frac{(-1)^{n+1}x^{n+1}}{(-1)^n x^n} \right\vert \\ \amp = \lim_{n\to\infty} \left\vert -x \right\vert = x, \end{split} \end{equation*}and so \(R=1\) as we found above.
-
\(f(x)=\sin(2x)\)
AnswerSolution\(\ds \sum_{n=0}^{\infty} (-1)^n \frac{2^{2n+1} x^{2n+1}}{(2n+1)!}\text{,}\) \(R=\infty.\)We use the fact that\begin{equation*} \sin(x) = \sum_{n=0}^{\infty} (-1)^n \frac{x^{2n+1}}{(2n+1)!}, \end{equation*}with \(R=\infty\text{.}\) Now let \(x=2y\text{.}\) Then,\begin{equation*} \sin(2y) = \sum_{n=0}^{\infty} (-1)^n \frac{2^{2n+1} y^{2n+1}}{(2n+1)!}, \end{equation*}with \(R=\infty\text{.}\)
Exercise 6.8.5.
For each function, find the Taylor series centred at \(a\) and the radius of convergence.
-
\(f(x) = \dfrac{1}{x}\text{,}\) \(a=5\)
AnswerSolution\(\ds\sum_{n=0}^\infty (-1)^n{(x-5)^n\over 5^{n+1}}\text{,}\) \(R=5\)Use the formula for the Taylor Series expansion of \(f\) about \(a=5\text{:}\)
\begin{equation*} f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(5)}{n!}(x-5)^n \end{equation*}Therefore, we compute
\begin{equation*} \begin{array}{ll} f(x) = \dfrac{1}{x} \amp f(5) = \dfrac{1}{5} \\[1.5ex] f'(x) = -\dfrac{1}{x^2} \amp f'(5) = -\dfrac{1}{25}\\[1.5ex] f''(x) = \dfrac{2}{x^3} \amp f''(5) = \dfrac{2}{125} \\[1.5ex] f'''(x) = -\dfrac{6}{x^4} \amp f'''(5) = -\dfrac{6}{625} \end{array} \end{equation*}and so
\begin{equation*} f^{(n)}(5) = \dfrac{(-1)^{n}n!}{5^{n+1}} \text{ for } n \geq 0\text{.} \end{equation*}Thus, the Taylor Series expansion for \(f(x)=\dfrac{1}{x}\) about \(a=5\) is
\begin{equation*} \frac{1}{x} = \sum_{n=0}^{\infty} \frac{(-1)^n}{5^{n+1}}(x-5)^n\text{.} \end{equation*}To determine the radius of convergence, we use the Ratio Test:
\begin{equation*} \begin{split} L \amp = \lim_{n\to\infty} \left\vert \frac{(-1)^{n+1}(x-5)^{n+1}}{5^{n+2}} \frac{5^{n+1}}{(-1)^n (x-5)^n} \right\vert \\ \amp = \lim_{n\to\infty} \left\vert \frac{-(x-5)}{5} \right\vert \\ \amp = \frac{1}{5} (x-5) \end{split} \end{equation*}Therefore, \(R=5\text{.}\)
-
\(f(x)=\ln x\text{,}\) \(a=1\)
AnswerSolution\(\ds\sum_{n=1}^\infty (-1)^{n-1}{(x-1)^n\over n}\text{,}\) \(R=1\)Use the formula for the Taylor Series expansion of \(f\) about \(a=1\text{,}\)
\begin{equation*} f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(1)}{n!}(x-1)^n \end{equation*}Notice that \(f(1) = \ln(1) = 0\text{,}\) and so we have
\begin{equation*} f(x) = 0 + \sum_{n=1}^{\infty} \frac{f^{(n)}(1)}{n!}(x-1)^n\text{.} \end{equation*}We compute the first few derivatives evaluated at \(1\) to discern a pattern:
\begin{equation*} \begin{array}{ll} f'(x) = \dfrac{1}{x} \amp f'(1) = 1\\[1.5ex] f''(x) = -\dfrac{1}{x^2} \amp f''(1) = -1 \\[1.5ex] f'''(x) = \dfrac{2}{x^3} \amp f'''(1) = 2 \end{array} \end{equation*}and so
\begin{equation*} f^{(n)}(1) = (-1)^{n-1}(n-1)! \text{ for } n \geq 1\text{.} \end{equation*}Therefore, about \(a=1\) we have
\begin{equation*} \ln x = \sum_{n=1}^{\infty} \frac{(-1)^{n-1}}{n} (x-1)^n \end{equation*}with radius of convergence \(R=1\text{.}\)
-
\(f(x)=\ln x\text{,}\) \(a=2\)
AnswerSolution\(\ds\ln(2)+\sum_{n=1}^\infty (-1)^{n-1}{(x-2)^n\over n 2^n}\text{,}\) \(R=2\)Use the formula for the Taylor Series expansion of \(f\) about \(a=2\text{,}\)\begin{equation*} f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(2)}{n!}(x-2)^n. \end{equation*}We compute:\begin{equation*} \begin{array}{ll} f'(x) = \dfrac{1}{x} \amp f'(2) = \frac{1}{2}\\[1.5ex] f''(x) = -\dfrac{1}{x^2} \amp f''(2) = -\frac{1}{4} \\[1.5ex] f'''(x) = \dfrac{2}{x^3} \amp f'''(2) = \frac{1}{4}\\[1.5ex] f^{(iv)}(x) = \frac{-6}{x^4} \amp f^{(iv)}(2) = \frac{-3}{8} \end{array} \end{equation*}Therefore, we have\begin{equation*} f(x) = \ln(2) + \frac{x-2}{2} - \frac{1}{8} (x-2)^2 + \frac{1}{24} (x-2)^3 - \frac{1}{64} (x-2)^4 + \dots \end{equation*}Hence,\begin{equation*} \ln(x) = \ln(2) + \sum_{n=1}^{\infty} (-1)^{n-1} \frac{(x-2)^n}{n2^n} \end{equation*}with radius of convergence \(R=2\text{.}\) -
\(f(x)=\ds \dfrac{1}{x^2}\text{,}\) \(a=1\)
AnswerSolution\(\ds\sum_{n=0}^\infty (-1)^n(n+1)(x-1)^n\text{,}\) \(R=1\)Use the formula for the Taylor Series expansion of \(f\) about \(a=1\text{,}\)\begin{equation*} f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(1)}{n!}(x-1)^n. \end{equation*}We compute:\begin{equation*} \begin{array}{ll} f'(x) = \dfrac{-2}{x^3} \amp f'(1) = -2\\[1.5ex] f''(x) = -\dfrac{6}{x^4} \amp f''(1) = 6 \\[1.5ex] f'''(x) = \dfrac{-24}{x^5} \amp f'''(1) = -24 \end{array} \end{equation*}Therefore, we have\begin{equation*} f(x) = 1-2(x-1)+3(x-1)^2-4(x-1)^3 + \dots \end{equation*}Hence,\begin{equation*} \frac{1}{x^2} = \sum_{n=0}^{\infty} (-1)^{n}(n-1) (x-1)^n \end{equation*}with radius of convergence \(R=1\text{.}\)
Exercise 6.8.6.
Find the first four terms of the Maclaurin series for the following functions:
-
\(f(x) = \tan x\)
AnswerSolution\begin{equation*} \tan(x) = x + \frac{x^3}{3} +\frac{2 x^5}{15} + \frac{17 x^7}{215} + \dots \end{equation*}We differentiate until we get gour nonzero terms:\begin{equation*} \begin{array}{ll} f(x) = \tan(x) \amp f(0) = 0 \\[1.5ex] f'(x) = \sec^2(x) \amp f'(0) = 1\\[1.5ex] f''(x) = 2\tan(x)\sec^2(x) \amp f''(0) =0\\[1.5ex] f'''(x) = 2\sec^2(x) \bigl(2\tan^2(x) + \sec^2(x)\bigr) \amp f'''(0) = 2\\[1.5ex] f^{(iv)}(x) = 8\tan(x)\sec^2(x)\bigl(\tan^2(x) + 2\sec^2(x)\bigr) \amp f^{(iv)}(0) = 0 \\[1.5ex] f^{(v)}(x) = 8\sec^2(x)\bigl(2\tan^4(x) + 2\sec^4(x) + 11\tan^2(x)\sec^2(x)\bigr) \amp f^{(v)}(0) = 16\\[1.5ex] f^{(vi)}(x) = \dots \amp f^{(vi)}(0) = 0 \\[1.5ex] f^{(vii)}(x) =\dots \amp f^{(vii)}(0) = 272 \end{array} \end{equation*}Hence, the first four terms in the Maclaurin series are\begin{equation*} \begin{split} \tan(x)\amp = \frac{x}{1!} + 2\frac{x^3}{3!} + 16 \frac{x^5}{5!} + 272 \frac{x^7}{7!} + \dots\\ \amp = x + \frac{x^3}{3} +\frac{2 x^5}{15} + \frac{17 x^7}{215} + \dots \end{split} \end{equation*} -
\(\ds f(x)=x\cos (x^2)\)
AnswerSolution\begin{equation*} x\cos(x^2) = x - \frac{x^5}{2} + \frac{x^9}{24} - \frac{x^13}{720} + \dots \end{equation*}We differentiate until we get gour nonzero terms:\begin{equation*} \begin{array}{ll} f(x) = x\cos(x^2) \amp f(0) = 0\\[1.5ex] f'(x) = \cos(x^2) - 2 x^2 \sin(x^2) \amp f'(0) = 1\\[1.5ex] f''(x) = -6 x \sin(x^2) - 4 x^3 \cos(x^2) \amp f''(0) = 0 \\[1.5ex] f'''(x) = 2 (4 x^4 - 3) \sin(x^2) - 24 x^2 \cos(x^2)\amp f'''(0) = 0 \\[1.5ex] f^{(iv)}(x) = 4 (4 x^4 - 15) x \cos(x^2) + 80 x^3 \sin(x^2) \amp f^{(iv)}(0) = 0 \\[1.5ex] f^{(v)}(x) = 8 (45 - 4 x^4) x^2 \sin(x^2) + 60 (4 x^4 - 1) \cos(x^2) \amp f^{(v)}(0) = -60 \\[1.5ex] \end{array} \end{equation*}Eventually, we find that\begin{equation*} x\cos(x^2) = x - \frac{x^5}{2} + \frac{x^9}{24} - \frac{x^13}{720} + \dots \end{equation*} -
\(\ds f(x) = xe^{-x}\)
AnswerSolution\begin{equation*} \begin{split} xe^{-x} \amp= x - x^2 + \frac{x^3}{2} - \frac{x^4}{6} + \dots \end{split} \end{equation*}We differentiate until we get gour nonzero terms:\begin{equation*} \begin{array}{ll} f(x) = xe^{-x} \amp f(0) = 0 \\[1.5ex] f'(x) = e^{-x} (1 - x) \amp f'(0) = 1 \\[1.5ex] f''(x) = e^{-x} (x - 2) \amp f''(0) = -2\\[1.5ex] f'''(x) = -e^{-x} (x - 3)\amp f'''(0) = 3\\[1.5ex] f^{(iv)}(x) = e^{-x} (x - 4) \amp f^{(iv)}(0) = -4 \end{array} \end{equation*}Therefore, we have\begin{equation*} \begin{split} xe^{-x} \amp= \frac{x}{1!} - \frac{2x^2}{2!} + \frac{3x^3}{3!} - \frac{4x^4}{4!} + \dots\\ \amp= x - x^2 + \frac{x^3}{2} - \frac{x^4}{6} + \dots \end{split} \end{equation*}
Subsection 6.8.4 Taylor Polynomials
¶While the Taylor series can be thought of as an infinite degree polynomial, its partial sum \(s_n\) is a polynomial of degree \(n\) and referred to as Taylor polynomial.
Interactive Demonstration. Investigate the Taylor Polynomial \(T_n \) of \(f \) centred at \(x = 0\text{.}\) What happens as \(n \) increases?
Definition 6.77. Taylor Polynomial.
Suppose a function \(f\) is defined at \(x=a\text{.}\) Then the Taylor polynomial of \(f\) centred at \(x=a\) with degree \(n\) is given by
In fact, Taylor polynomials can be thought of as approximations of the function \(f\text{.}\) Let us explore this concept visually. In 油6.72, we developed the Taylor series of \(f(x)=sin(x)\) centred at zero
with interval of convergence \((-\infty,\infty)\text{.}\) A linear approximation of sine is given by
and shown below. Only at values close around zero is this linear approximation good enough to represent sine values.
When we calculate \(T_2\text{,}\)
we notice that this is again \(T_1\text{,}\) since \(-\sin(0) = 0\text{.}\) In fact, \(T_{2n} = T_{2n-1}\) for \(n \geq 1\text{,}\) since all even derivatives of the sine function will be positive or negative sine, and sine evaluated at zero is zero. This means that there is no quadratic Taylor polynomial approximation for sine using this series.
Let us compute \(T_3\text{:}\)
which yields a cubic approximation for sine as shown below. Notice that this cubic is already a better fit to sine than the linear one.
We compute one last Taylor polynomial, \(T_5\text{:}\)
The graph below shows this approximation, and we can readily believe that continuing this process, we get an even better fit to sine, and thus a better and better approximation of sine.
One question that naturally arises is, How accurately do the Taylor polynomials approximate the function? This question will be responded to in the next section.Here is an example.
Example 6.78. Approximate e using Taylor Polynomials.
Approximate \(e^x\) using Taylor polynomials at \(a=0\text{,}\) and use this to approximate \(e\text{.}\)
In this case we use the function \(f(x)=e^x\) at \(a=0\text{,}\) and therefore
Since all derivatives \(f^{(k)}(x)=e^x\text{,}\) we get:
Thus
and in general
Finally, we can approximate \(e=f(1)\) by simply calculating \(T_n(1)\text{.}\) A few values are:
We can continue this way for larger values of \(n\text{,}\) but \(T_{20}(1)\) is already a pretty good approximation of \(e\text{,}\) and we took only 20 terms!
Exercises for Section 6.8.4.
Exercise 6.8.7.
Find the 5th degree Taylor polynomial for \(f(x)=\sin x\) around \(a=0\text{.}\)
- Use this Taylor polynomial to approximate \(\sin (0.1)\text{.}\) Answer\(T_5(x)=x-\frac{x^3}{3!}+\frac{x^5}{5!}\text{,}\) so \(\sin (0.1)\approx T_5(0.1)\approx 0.10016675\)
- Use a calculator to find \(\sin (0.1)\text{.}\) How does this compare to our approximation in part (a)? Answer\(T_5(x)=x-\frac{x^3}{3!}+\frac{x^5}{5!}\text{,}\) so \(\sin (0.1)=0.0998334\ldots\) using a calculator. Our approximation is accurate to \(0.10016675-0.0998334\ldots =0.000\bar{3}\text{.}\)
Exercise 6.8.8.
Find the 3rd degree Taylor polynomial for \(f(x)=\frac{1}{1-x}-1\) around \(a=0\text{.}\) Explain why this approximation would not be useful for calculating \(f(5)\text{.}\) Answer
Exercise 6.8.9.
Consider \(f(x)=\ln x\) around \(a=1\text{.}\)
-
Find a general formula for \(f^{(n)}(x)\) for \(n\geq 1\text{.}\)
AnswerSolution\(f^{(n)}(x)=\frac{(-1)^{(n-1)}(n-1)!}{x^n}\)We compute the first few derivatives to discern a pattern:
\begin{equation*} \begin{split} f'(x) = \dfrac{1}{x}\\ f''(x) = -\dfrac{1}{x^2} \\ f'''(x) = \dfrac{2}{x^3} \end{split} \end{equation*}and so
\begin{equation*} f^{(n)}(x) = \frac{(-1)^{n-1}(n-1)!}{x^{n}} \text{ for } n \geq 1\text{.} \end{equation*} -
Find a general formula for the Taylor Polynomial, \(T_n(x)\text{.}\)
AnswerSolution\(T_n(x)=\ln (1)+\displaystyle\sum_{i=1}^{n} \frac{\big(\frac{(-1)^{(i-1)}(i-1)!}{1^n}\big)}{i!}(x-1)^i=\displaystyle\sum_{i=1}^{n} \bigg(\frac{(-1)^{(i-1)}(i-1)!}{i!}\bigg)(x-1)^i\) since \(\ln (1)=0\) and \(1^n=1\text{.}\)The general Taylor polynomial of \(f(x) = \ln x\) centred at \(a=1\) is
\begin{equation*} T_n(x) = f(1) + f'(1)(x-1) + \frac{f''(1)}{2!}(x-1)^2+\cdots + \frac{f^{(n)}(1)}{n!}(x-1)^n\text{.} \end{equation*}From part (a), we know that
\begin{equation*} f^{(n)}(1) = (-1)^{n-1}(n-1)! \end{equation*}and so
\begin{equation*} T_n(x) = \sum_{i=1}^n \frac{f^{(i)}(1)}{i!}(x-1)^i = \frac{(-1)^{i-1}(i-1)!}{i!}(x-1)^i\text{.} \end{equation*}
Exercise 6.8.10.
Approximate \(\ln(1.3)\) to accuracy of at least 0.0001. Answer
Subsection 6.8.5 Taylor's Theorem
¶One of the most important uses of infinite series is using an initial portion of the series for \(f\) to approximate \(f\text{.}\) We have seen, for example, that when we add up the first \(n\) terms of an alternating series with decreasing terms that the difference between this and the true value is at most the size of the next term. A similar result is true of many Taylor series, which is captured in Taylor's Theorem. This theorem is essentially a generalized version of the mean value theorem. It comes in a few different forms and we only state one form that is useful for this course.
Theorem 6.79. Taylor's Theorem.
Suppose that \(f\) is defined on some open interval \(I\) around \(a\) and suppose \(\ds f^{(N+1)}(x)\) exists on this interval. Then for each \(x\not=a\) in \(I\) there is a value \(z\) between \(x\) and \(a\) so that
Proof.
The proof requires some cleverness to set up, but then the details are quite elementary. We define a function \(F(t)\) as follows:
Here we have replaced \(a\) by \(t\) in the first \(N+1\) terms of the Taylor series, and added a carefully chosen term on the end, with \(B\) to be determined. Note that we are temporarily keeping \(x\) fixed, so the only variable in this equation is \(t\text{,}\) and we will be interested only in \(t\) between \(a\) and \(x\text{.}\) Now substitute \(t=a\text{:}\)
Set this equal to \(f(x)\text{:}\)
Since \(x\not=a\text{,}\) we can solve this for \(B\text{,}\) which is a “constant” —it depends on \(x\) and \(a\) but those are temporarily fixed. Now we have defined a function \(F(t)\) with the property that \(F(a)=f(x)\text{.}\) Also, all terms with a positive power of \((x-t)\) become zero when we substitute \(x\) for \(t\text{,}\) so \(\ds F(x)=f^{(0)}(x)/0!=f(x)\text{.}\) So \(F(a)=F(x)\text{.}\) By Rolle's Theorem (from Differential Calculus), we know that there is a value \(z\in(a,x)\) such that \(F'(z)=0\text{.}\) But what is \(F'\text{?}\) Each term in \(F(t)\text{,}\) except the first term and the extra term involving \(B\text{,}\) is a product, so to take the derivative we use the Product Rule on each of these terms.
So the derivative is
The second term in each parenthesis cancel with the first term in the next one, leaving just
At some \(z\text{,}\) \(F'(z)=0\) so
Now we can write
Recalling that \(F(a)=f(x)\) we get
which is what we wanted to show.
Note:
-
In essence, Taylor's Theorem says that
\begin{equation*} f(x) = T_n(x) + R_n(x)\text{,} \end{equation*}where \(T_n\) is the \(n\)-th degree Taylor polynomial and \(R_n\) is the so-called remainder term.
-
We often estimate the remainder
\begin{equation*} R_n(x) = \frac{f^{(n+1)}(z)(x-a)^{n+1}}{(n+1)!} \end{equation*}without knowing the value of \(z\) as will be seen in 油6.80.
-
An important consequence of Taylor's Theorem is that if \(\lim\limits_{n\to\infty} R_n(x)=0\) for all \(x\) in the open interval \(I\text{,}\) then
\begin{equation*} f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n\text{,} \end{equation*}i.e. the Taylor series centred at \(a\) of \(f\) converges to \(f\) on \(I\text{.}\)
Example 6.80. Approximating Sine.
Find a polynomial approximation for \(\sin x\) accurate to \(\pm 0.005\) for values of \(x\) in \([-\pi/2,\pi/2]\text{.}\)
From Taylor's Theorem with \(a=0\text{:}\)
What can we say about the size of the term
Every derivative of \(\sin x\) is \(\pm\sin x\) or \(\pm\cos x\text{,}\) so \(\ds |f^{(N+1)}(z)|\le 1\text{.}\)
So we need to pick \(N\) so that
Since we have limited \(x\) to \([-\pi/2,\pi/2]\text{,}\)
The quantity on the right decreases with increasing \(N\text{,}\) so all we need to do is find an \(N\) so that
A little trial and error shows that \(N=8\) works, and in fact \(\ds 2^{9}/9!\lt 0.0015\text{,}\) so
The graphs of \(\sin x\) and and the approximation are shown below. As \(x\) gets larger, the approximation heads to negative infinity very quickly, since it is essentially acting like \(\ds -x^7\text{.}\)
Note: We can now approximate the value of \(\sin(x)\) to within 0.005 by using simple trigonometric identities to translate \(x\) into the interval \([-\pi/2,\pi/2]\text{.}\)
We can extract a bit more information from this example.
Example 6.81. Convergence of Power Series Representation of Sine.
Show that
by showing that \(\lim\limits_{n\to\infty}R_n(x) = 0\text{.}\)
If we do not limit the value of \(x\text{,}\) we still have
so that \(\sin x\) is represented by
If we can show that
for each \(x\) then
that is, the sine function is actually equal to its Maclaurin series for all \(x\text{.}\) How can we prove that the limit is zero? Suppose that \(N\) is larger than \(|x|\text{,}\) and let \(M\) be the largest integer less than \(|x|\) (if \(M=0\) the following is even easier). Then
The quantity \(|x|^M/ M!\) is a constant, so
and by the Squeeze ճǰ6.7
as desired.
Essentially the same argument works for \(\cos x\) and \(\ds e^x\text{.}\) Unfortunately, it is more difficult to show that most functions are equal to their Maclaurin series.
Example 6.82. Approximating \(e\).
Find a polynomial approximation for \(\ds e^x\) near \(x=2\) accurate to \(\pm 0.005\text{.}\)
From Taylor's Theorem:
since \(\ds f^{(n)}(x)=e^x\) for all \(n\text{.}\) We are interested in \(x\) near 2, and we need to keep \(\ds |(x-2)^{N+1}|\) in check, so we may as well specify that \(|x-2|\le 1\text{,}\) so \(x\in[1,3]\text{.}\) Also
so we need to find an \(N\) that makes \(\ds e^3/(N+1)!\le 0.005\text{.}\) This time \(N=6\) makes \(\ds e^3/(N+1)!\lt 0.004\text{,}\) so the approximating polynomial is
Note that our approximation requires that we already have a very accurate approximation of the value \(e^2\text{,}\) which we shouldn't assume we have in the context of trying to approximate \(e^x\text{.}\) For this reason we typically try to centre our series on values for which the derivative of the function is easy to evaluate (e.g. \(a=0\)).
Note well that in these examples we found polynomials of a certain accuracy only on a small interval, even though the series for \(\sin x\) and \(\ds e^x\) converge for all \(x\text{.}\) This is typical. To get the same accuracy on a larger interval would require more terms.
Exercises for Section 6.8.5.
Exercise 6.8.11.
Find a polynomial approximation for each of the functions on the given interval within the stated error.
-
\(f(x) = \cos x\text{,}\) \([0,\pi]\text{,}\) \(\ds \pm 10^{-3}\)
SolutionWe wish to approximate \(f(x) = \cos x\) on the interval \(I=[0,\pi]\text{.}\) By Taylor's Theorem,
\begin{equation*} \cos x = \sum_{n=0}^N \frac{f^{n}(\pi/2)}{n!}(x-\pi/2)^n + \frac{f^{N+1}(z)}{(N+1)!}(x-\pi/2)^{N+1}\text{,} \end{equation*}where we took \(a=\pi/2\text{.}\) We need to determine the number of terms \(N\) required. By Taylor's Theorem, the remainder term is of the form
\begin{equation*} R_n = \frac{f^{(N+1)}(z)}{(N+1)!} (x-\pi/2)^{N+1} \end{equation*}for some \(z\) between \(x\) and \(\pi/2\text{.}\) Therefore, we require
\begin{equation*} |R_n| = \left\vert \frac{f^{(N+1)}(z)}{(N+1)!} \left(x-\frac{\pi}{2}\right)^{N+1}\right\vert \leq 0.01 \end{equation*}We know that \(|f^{(N+1)}(z)| \leq 1\) for all \(z\text{,}\) and that for all \(x \in I\) we have that \(|(x-\pi/2)^{N+1}| \leq (\pi/2)^{N+1}\text{.}\) Thus, we have
\begin{equation*} |R_n| \leq \left\vert \frac{(\pi/2)^{N+1}}{(N+1)!} \right\vert \leq 0.01\text{.} \end{equation*}We find that \(R_6 \approx 0.005 \lt 0.01\text{,}\) and so
\begin{equation*} \begin{split} \cos x \amp= \sum_{n=0}^{6} \frac{f^{(n)}(\pi/2)}{n!} \left(x-\frac{\pi}{2}\right)^n \pm 0.01\\ \amp= -\left(x-\frac{\pi}{2}\right)+\frac{\left(x-\frac{\pi}{2}\right)^3}{3!}-\frac{\left(x-\frac{\pi}{2}\right)^5}{5!} \pm 0.01. \end{split} \end{equation*}We verify the result with the graph below.
\(f(x) = \ln x\text{,}\) \([1/2,3/2]\text{,}\) \(\ds 10^{-3}\) Answer
SolutionWe need 1000 terms.We wish to approximate \(f(x) = \ln x\) on the interval \(I=[1/2,3/2]\text{.}\) By Taylor's Theorem,\begin{equation*} \ln x = \sum_{n=0}^N \frac{f^{n}(1)}{n!}(x-1)^n + \frac{f^{N+1}(z)}{(N+1)!}(x-1)^{N+1}, \end{equation*}where we took \(a=1\) (the midpoint of \(I\)). We know that the derivatives of \(\ln(x)\) evaluated at 1 take the form\begin{equation*} \left\vert f^{(N)}(x) \right\vert = \left\vert \frac{(N-1)!}{x^N}\right\vert \implies \left\vert f^{(N+1)}(z) \right\vert \leq 2^{N+1} N! \end{equation*}for all \(z \in I\text{.}\)Therefore,\begin{equation*} \begin{split} |R_N| \amp \leq \left\vert \frac{2^{N+1} N!}{(N+1)!} (x-1)^{N+1} \right\vert\\ \amp = \frac{2^{N+1}}{N+1} \left\vert(x-1)^{N+1}\right\vert \\ \amp \leq \frac{2^{N+1}}{N+1} \left(\frac{1}{2^{N+1}}\right)\\ \amp = \frac{1}{N+1} \end{split} \end{equation*}for all \(x \in I \text{.}\) Hence,\begin{equation*} |R_N| \leq \frac{1}{N+1}. \end{equation*}Thus, if we need an accuracy of at least \(10^{-3}\text{,}\) this means we need at least 1000 terms in the Taylor Series approximation.\(f(x) = \ln x\text{,}\) \([1,3/2]\text{,}\) \(\ds 10^{-3}\) Answer
SolutionWe need at least 8 terms.We wish to approximate \(f(x) = \ln x\) on the interval \(I=[1,3/2]\text{.}\) By Taylor's theorem,\begin{equation*} \ln x = \sum_{n=0}^N \frac{f^{n}(1)}{n!}(x-1)^n + \frac{f^{N+1}(z)}{(N+1)!}(x-1)^{N+1}, \end{equation*}where we took \(a=1\text{.}\) We know that the derivatives of \(\ln(x)\) evaluated at 1 take the form\begin{equation*} \left\vert f^{(N)}(x) \right\vert = \left\vert \frac{(N-1)!}{x^N}\right\vert \implies \left\vert f^{(N+1)}(z) \right\vert \leq N! \end{equation*}for all \(z \in I\text{.}\) Therefore,\begin{equation*} \begin{split} |R_N| \amp \leq \left\vert \frac{N!}{(N+1)!} (x-1)^{N+1}\right\vert\\ \amp= \frac{1}{N+1} \left\vert(x-1)^{N+1}\right\vert \\ \amp \leq \frac{2^{N+1}}{N+1} \left(\frac{1}{2^{N+1}}\right)\\ \amp = \frac{1}{(N+1) 2^{N+1}} \end{split} \end{equation*}for all \(x \in I\text{.}\) Thus, if we need an accuracy of at least \(10^{-3}\text{,}\) this means we need at least 8 terms in the Taylor Series approximation.
Exercise 6.8.12.
Show that each function is equal to its Taylor series for all \(x\) by showing that \(\lim\limits_{n\to\infty}R_n(x) = 0\text{.}\)
\(f(x) = \cos x\) Solution
We compute\begin{equation*} |R_N| = \left\vert \frac{f^{(N+1)}(z)}{(N+1)!} (x-a)^N\right\vert. \end{equation*}Now, since\begin{equation*} \left\vert f^{(N+1)}(z) \right\vert \leq 1 \end{equation*}for all \(z\text{,}\) we must have\begin{equation*} 0 \leq |R_N| \leq \left\vert \frac{(x-a)^N}{(N+1)!}\right\vert. \end{equation*}Now, since\begin{equation*} \lim_{N\to\infty} \left\vert\frac{(x-a)^N}{(N+1)!}\right\vert = 0, \end{equation*}by the Squeeze Theorem, we must have that\begin{equation*} \lim_{N\to\infty} |R_N| = 0. \end{equation*}\(f(x) = e^x\) Solution
We compute\begin{equation*} |R_N| = \left\vert \frac{f^{(N+1)}(z)}{(N+1)!} (x-a)^N\right\vert = \left\vert \frac{e^z}{(N+1)!} (x-a)^N\right\vert . \end{equation*}Therefore,\begin{equation*} \lim_{N\to\infty} |R_N| = e^z \lim_{N\to\infty} \frac{(x-a)^N}{(N+1)!} = 0. \end{equation*}