- Last updated
- Save as PDF
- Page ID
- 4673
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}}}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}}}\)
\( \newcommand{\vectorC}[1]{\textbf{#1}}\)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}}\)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}}\)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}}}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)
Consider a function \(y=f(x)\) and a point \(\left(c,f(c)\right)\). The derivative, \(f^\prime(c)\), gives the instantaneous rate of change of \(f\) at \(x=c\). Of all lines that pass through the point \(\left(c,f(c)\right)\), the line that best approximates \(f\) at this point is the tangent line; that is, the line whose slope (rate of change) is \(f^\prime(c)\).
In Figure \(\PageIndex{1}\), we see a function \(y=f(x)\) graphed. The table below the graph shows that \(f(0)=2\) and \(f^\prime(0) = 1\); therefore, the tangent line to \(f\) at \(x=0\) is \(p_1(x) = 1(x-0)+2 = x+2\). The tangent line is also given in the figure. Note that "near'' \(x=0\), \(p_1(x) \approx f(x)\); that is, the tangent line approximates \(f\) well.
One shortcoming of this approximation is that the tangent line only matches the slope of \(f\); it does not, for instance, match the concavity of \(f\). We can find a polynomial, \(p_2(x)\), that does match the concavity without much difficulty, though. The table in Figure 8.16 gives the following information:
\[f(0) = 2 \qquad f^\prime(0) = 1\qquad f^{\prime\prime}(0) = 2.\]
Therefore, we want our polynomial \(p_2(x)\) to have these same properties. That is, we need
\[p_2(0) = 2 \qquad p_2'(0) = 1 \qquad p_2''(0) = 2.\]
This is simply an initial-value problem. We can solve this using the techniques first described in Section 5.1. To keep \(p_2(x)\) as simple as possible, we'll assume that not only \(p_2''(0)=2\), but that \(p_2''(x)=2\). That is, the second derivative of \(p_2\) is constant.
If \(p_2''(x) = 2\), then \(p_2'(x) = 2x+C\) for some constant \(C\). Since we have determined that \(p_2'(0) = 1\), we find that \(C=1\) and so \(p_2'(x) = 2x+1\). Finally, we can compute \(p_2(x) = x^2+x+C\). Using our initial values, we know \(p_2(0) = 2\) so \(C=2.\) We conclude that \(p_2(x) = x^2+x+2.\) This function is plotted with \(f\) in Figure \(\PageIndex{2}\).
We can repeat this approximation process by creating polynomials of higher degree that match more of the derivatives of \(f\) at \(x=0\). In general, a polynomial of degree \(n\) can be created to match the first \(n\) derivatives of \(f\). Figure \(\PageIndex{2}\) also shows \(p_4(x)= -x^4/2-x^3/6+x^2+x+2\), whose first four derivatives at 0 match those of \(f\). (Using the table in Figure \(\PageIndex{1}\), start with \(p_4^{(4)}(x)=-12\) and solve the related initial-value problem.)
As we use more and more derivatives, our polynomial approximation to \(f\) gets better and better. In this example, the interval on which the approximation is "good'' gets bigger and bigger. Figure \(\PageIndex{3}\) shows \(p_{13}(x)\); we can visually affirm that this polynomial approximates \(f\) very well on \([-2,3]\).
The polynomial \(p_{13}(x)\) is not particularly "nice''. It is
\[ p_{13} = \dfrac{16901x^{13}}{6227020800}+\dfrac{13x^{12}}{1209600}-\dfrac{1321x^{11}}{39916800}-\dfrac{779x^{10}}{1814400}-\dfrac{359x^9}{362880}+\dfrac{x^8}{240}+\dfrac{139x^7}{5040}+\dfrac{11 x^6}{360}-\dfrac{19x^5}{120}-\dfrac{x^4}{2}-\dfrac{x^3}{6}+x^2+x+2.\]
The polynomials we have created are examples of Taylor polynomials, named after the British mathematician Brook Taylor who made important discoveries about such functions. While we created the above Taylor polynomials by solving initial-value problems, it can be shown that Taylor polynomials follow a general pattern that make their formation much more direct. This is described in the following definition.
Definition 38: Taylor Polynomials & Maclaurin PolynomiaLS
Let \(f\) be a function whose first \(n\) derivatives exist at \(x=c\).
- The Taylor polynomial of degree \(n\) of \(f\) at \(x=c\) is \[p_n(x) = f(c) + f^\prime(c)(x-c) + \dfrac{f^{\prime\prime}(c)}{2!}(x-c)^2+\dfrac{f^{\prime\prime\prime}(c)}{3!}(x-c)^3+\cdots+\dfrac{f\,^{(n)}(c)}{n!}(x-c)^n.\]
- A special case of the Taylor polynomial is the Maclaurin polynomial, where \(c=0\). That is, the Maclaurin polynomial of degree \(n\) of \(f\) is \[p_n(x) = f(0) + f^\prime(0)x + \dfrac{f^{\prime\prime}(0)}{2!}x^2+\dfrac{f^{\prime\prime\prime}(0)}{3!}x^3+\cdots+\dfrac{f\,^{(n)}(0)}{n!}x^n.\]
We will practice creating Taylor and Maclaurin polynomials in the following examples.
Example \(\PageIndex{1}\): Finding and using Maclaurin polynomials
- Find the \(n^\text{th}\) Maclaurin polynomial for \(f(x) = e^x\).
- Use \(p_5(x)\) to approximate the value of \(e\).
Solution
- We start with creating a table of the derivatives of \(e^x\) evaluated at \(x=0\). In this particular case, this is relatively simple, as shown in Figure 8.19.
By the definition of the Maclaurin series, we have \[\begin{align*}p_n(x) &= f(0) + f^\prime(0)x + \dfrac{f^{\prime\prime}(0)}{2!}x^2+\dfrac{f^{\prime\prime\prime}(0)}{3!}x^3+\cdots+\dfrac{f\,^n(0)}{n!}x^n\\&= 1+x+\dfrac{1}{2}x^2+\dfrac{1}{6}x^3 + \dfrac{1}{24}x^4 + \cdots + \dfrac{1}{n!}x^n.\end{align*}\]
- Using our answer from part 1, we have \[p_5 = 1+x+\dfrac{1}{2}x^2+\dfrac{1}{6}x^3 + \dfrac{1}{24}x^4 + \dfrac{1}{120}x^5.\] To approximate the value of \(e\), note that \(e = e^1 = f(1) \approx p_5(1).\) It is very straightforward to evaluate \(p_5(1)\): \[p_5(1) = 1+1+\dfrac12+\dfrac16+\dfrac1{24}+\dfrac1{120} = \dfrac{163}{60} \approx 2.71667.\]
A plot of \(f(x)=e^x\) and \(p_5(x)\) is given in Figure \(\PageIndex{5}\).
Example \(\PageIndex{2}\): Finding and using Taylor polynomials
- Find the \(n^\text{th}\) Taylor polynomial of \(y=\ln x\) at \(x=1\).
- Use \(p_6(x)\) to approximate the value of \(\ln 1.5\).
- Use \(p_6(x)\) to approximate the value of \(\ln 2\).
Solution
- We begin by creating a table of derivatives of \(\ln x\) evaluated at \(x=1\). While this is not as straightforward as it was in the previous example, a pattern does emerge, as shown in Figure \(\PageIndex{6}\).
Using Definition 38, we have \[\begin{align*}p_n(x) &= f(c) + f^\prime(c)(x-c) + \dfrac{f^{\prime\prime}(c)}{2!}(x-c)^2+\dfrac{f^{\prime\prime\prime}(c)}{3!}(x-c)^3+\cdots+\dfrac{f\,^n(c)}{n!}(x-c)^n\\&= 0+(x-1)-\dfrac12(x-1)^2+\dfrac13(x-1)^3-\dfrac14(x-1)^4+\cdots+\dfrac{(-1)^{n+1}}{n}(x-1)^n.\end{align*}\] Note how the coefficients of the \((x-1)\) terms turn out to be "nice.'' - We can compute \(p_6(x)\) using our work above: \[p_6(x) = (x-1)-\dfrac12(x-1)^2+\dfrac13(x-1)^3-\dfrac14(x-1)^4+\dfrac15(x-1)^5-\dfrac16(x-1)^6.\] Since \(p_6(x)\) approximates \(\ln x\) well near \(x=1\), we approximate \(\ln 1.5 \approx p_6(1.5)\): \[\begin{align*}p_6(1.5) &= (1.5-1)-\dfrac12(1.5-1)^2+\dfrac13(1.5-1)^3-\dfrac14(1.5-1)^4+\cdots \\&\cdots +\dfrac15(1.5-1)^5-\dfrac16(1.5-1)^6\\&=\dfrac{259}{640}\\&\approx 0.404688.\end{align*}\] This is a good approximation as a calculator shows that \(\ln 1.5 \approx 0.4055.\) Figure \(\PageIndex{7}\) plots \(y=\ln x\) with \(y=p_6(x)\). We can see that \(\ln 1.5\approx p_6(1.5)\).
- We approximate \(\ln 2\) with \( p_6(2)\): \[\begin{align*}p_6(2) &= (2-1)-\dfrac12(2-1)^2+\dfrac13(2-1)^3-\dfrac14(2-1)^4+\cdots \\&\cdots +\dfrac15(2-1)^5-\dfrac16(2-1)^6\\&= 1-\dfrac12+\dfrac13-\dfrac14+\dfrac15-\dfrac16 \\&= \dfrac{37}{60}\\ &\approx 0.616667.\end{align*}\] This approximation is not terribly impressive: a hand held calculator shows that \(\ln 2 \approx 0.693147.\) The graph in Figure 8.22 shows that \(p_6(x)\) provides less accurate approximations of \(\ln x\) as \(x\) gets close to 0 or 2.
Surprisingly enough, even the 20\(^\text{th}\) degree Taylor polynomial fails to approximate \(\ln x\) for \(x>2\), as shown in Figure \(\PageIndex{8}\). We'll soon discuss why this is.
Taylor polynomials are used to approximate functions \(f(x)\) in mainly two situations:
- When \(f(x)\) is known, but perhaps "hard'' to compute directly. For instance, we can define \(y=\cos x\) as either the ratio of sides of a right triangle ("adjacent over hypotenuse'') or with the unit circle. However, neither of these provides a convenient way of computing \(\cos 2\). A Taylor polynomial of sufficiently high degree can provide a reasonable method of computing such values using only operations usually hard-wired into a computer (\(+\), \(-\), \(\times\) and \(\div\)).
- When \(f(x)\) is not known, but information about its derivatives is known. This occurs more often than one might think, especially in the study of differential equations.
Even though Taylor polynomials could be used in calculators and computers to calculate values of trigonometric functions, in practice they generally aren't. Other more efficient and accurate methods have been developed, such as the CORDIC algorithm.
In both situations, a critical piece of information to have is "How good is my approximation?'' If we use a Taylor polynomial to compute \(\cos 2\), how do we know how accurate the approximation is?
We had the same problem when studying Numerical Integration. Theorem 43 provided bounds on the error when using, say, Simpson's Rule to approximate a definite integral. These bounds allowed us to determine that, for instance, using \(10\) subintervals provided an approximation within \(\pm .01\) of the exact value. The following theorem gives similar bounds for Taylor (and hence Maclaurin) polynomials.
THEOREM 76: TAYLOR'S THEOREM
- Let \(f\) be a function whose \(n+1^\text{th}\) derivative exists on an interval \(I\) and let \(c\) be in \(I\). Then, for each \(x\) in \(I\), there exists \(z_x\) between \(x\) and \(c\) such that
\[f(x) = f(c) + f^\prime(c)(x-c) + \dfrac{f^\prime (c)}{2!}(x-c)^2+ \cdots +\dfrac{f\,^{(n)}(c)}{n!}(x-c)^n+R_n(x),\]
where \( R_n(x) = \dfrac{f\,^{(n+1)}(z_x)}{(n+1)!}(x-c)^{(n+1)}.\) - \( \big|R_n(x)\big| \leq \dfrac{\max\left|\,f\,^{(n+1)}(z)\right|}{(n+1)!}\big|(x-c)^{(n+1)}\big|\)
The first part of Taylor's Theorem states that \(f(x) = p_n(x) + R_n(x)\), where \(p_n(x)\) is the \(n^\text{th}\) order Taylor polynomial and \(R_n(x)\) is the remainder, or error, in the Taylor approximation. The second part gives bounds on how big that error can be. If the \((n+1)^\text{th}\) derivative is large, the error may be large; if \(x\) is far from \(c\), the error may also be large. However, the \((n+1)!\) term in the denominator tends to ensure that the error gets smaller as \(n\) increases.
The following example computes error estimates for the approximations of \(\ln 1.5\) and \(\ln 2\) made in Example 8.7.2.
Example \(\PageIndex{3}\): Finding error bounds of a Taylor polynomial
Use Theorem 76 to find error bounds when approximating \(\ln 1.5\) and \(\ln 2\) with \(p_6(x)\), the Taylor polynomial of degree 6 of \(f(x)=\ln x\) at \(x=1\), as calculated in Example 8.7.2.
Solution
- We start with the approximation of \(\ln 1.5\) with \(p_6(1.5)\). The theorem references an open interval \(I\) that contains both \(x\) and \(c\). The smaller the interval we use the better; it will give us a more accurate (and smaller!) approximation of the error. We let \(I = (0.9,1.6)\), as this interval contains both \(c=1\) and \(x=1.5\).
The theorem references \(\max\big|f\,^{(n+1)}(z)\big|\). In our situation, this is asking "How big can the \(7^\text{th}\) derivative of \(y=\ln x\) be on the interval \((0.9,1.6)\)?'' The seventh derivative is \(y = -6!/x^7\). The largest value it attains on \(I\) is about 1506. Thus we can bound the error as:\[\begin{align*}\big|R_6(1.5)\big| &\leq \dfrac{\max\big|f\,^{(7)}(z)\big|}{7!}\big|(1.5-1)^7\big|\\&\leq \dfrac{1506}{5040}\cdot\dfrac1{2^7}\\&\approx 0.0023.\end{align*}\]
We computed \(p_6(1.5) = 0.404688\); using a calculator, we find \(\ln 1.5 \approx 0.405465\), so the actual error is about \(0.000778\), which is less than our bound of \(0.0023\). This affirms Taylor's Theorem; the theorem states that our approximation would be within about 2 thousandths of the actual value, whereas the approximation was actually closer.
- We again find an interval \(I\) that contains both \(c=1\) and \(x=2\); we choose \(I = (0.9,2.1)\). The maximum value of the seventh derivative of \(f\) on this interval is again about 1506 (as the largest values come near \(x=0.9\)). Thus \[\begin{align*}\big| R_6(2)\big| &\leq \dfrac{\max\big|f\,^{(7)}(z)\big|}{7!}\big|(2-1)^7\big|\\&\leq \dfrac{1506}{5040}\cdot1^7\\&\approx 0.30.\end{align*}\]
This bound is not as nearly as good as before. Using the degree 6 Taylor polynomial at \(x =1\) will bring us within 0.3 of the correct answer. As \(p_6(2)\approx 0.61667\), our error estimate guarantees that the actual value of \(\ln 2\) is somewhere between \(0.31667\) and \(0.91667\). These bounds are not particularly useful.
In reality, our approximation was only off by about 0.07. However, we are approximating ostensibly because we do not know the real answer. In order to be assured that we have a good approximation, we would have to resort to using a polynomial of higher degree.
We practice again. This time, we use Taylor's theorem to find \(n\) that guarantees our approximation is within a certain amount.
Example \(\PageIndex{4}\): Finding sufficiently accurate Taylor polynomials
Find \(n\) such that the \(n^\text{th}\) Taylor polynomial of \(f(x)=\cos x\) at \(x=0\) approximates \(\cos 2\) to within \(0.001\) of the actual answer. What is \(p_n(2)\)?
Solution
Following Taylor's theorem, we need bounds on the size of the derivatives of \(f(x)=\cos x\). In the case of this trigonometric function, this is easy. All derivatives of cosine are \(\pm \sin x\) or \(\pm \cos x\). In all cases, these functions are never greater than 1 in absolute value. We want the error to be less than \(0.001\). To find the appropriate \(n\), consider the following inequalities:
\[\begin{align*}
\dfrac{\max\big|f\,^{(n+1)}(z)\big|}{(n+1)!}\big|(2-0)^{(n+1)}\big| &\leq 0.001 \\
\dfrac1{(n+1)!}\cdot2^{(n+1)} &\leq 0.001
\end{align*}\]
We find an \(n\) that satisfies this last inequality with trial-and-error. When \(n=8\), we have \( \dfrac{2^{8+1}}{(8+1)!} \approx 0.0014\); when \(n=9\), we have \( \dfrac{2^{9+1}}{(9+1)!} \approx 0.000282 <0.001\). Thus we want to approximate \(\cos 2\) with \(p_9(2)\).\\
We now set out to compute \(p_9(x)\). We again need a table of the derivatives of \(f(x)=\cos x\) evaluated at \(x=0\). A table of these values is given in Figure \(\PageIndex{8}\).
Notice how the derivatives, evaluated at \(x=0\), follow a certain pattern. All the odd powers of \(x\) in the Taylor polynomial will disappear as their coefficient is 0. While our error bounds state that we need \(p_9(x)\), our work shows that this will be the same as \(p_8(x)\).
Since we are forming our polynomial at \(x=0\), we are creating a Maclaurin polynomial, and:
\[\begin{align*}
p_8(x) &= f(0) + f^\prime(0)x + \dfrac{f^{\prime\prime}(0)}{2!}x^2 + \dfrac{f^{\prime\prime\prime}(0)}{3!}x^3 + \cdots +\dfrac{f\,^{(8)}}{8!}x^8\\
&= 1-\dfrac{1}{2!}x^2+\dfrac{1}{4!}x^4-\dfrac{1}{6!}x^6+\dfrac{1}{8!}x^8
\end{align*}\]
We finally approximate \(\cos 2\):
\[\cos 2 \approx p_8(2) = -\dfrac{131}{315} \approx -0.41587. \nonumber\]
Our error bound guarantee that this approximation is within \(0.001\) of the correct answer. Technology shows us that our approximation is actually within about \(0.0003\) of the correct answer.
Figure \(\PageIndex{10}\) shows a graph of \(y=p_8(x)\) and \(y=\cos x\). Note how well the two functions agree on about \((-\pi,\pi)\).
Example \(\PageIndex{5}\): Finding and using Taylor polynomials
- Find the degree 4 Taylor polynomial, \(p_4(x)\), for \(f(x)=\sqrt{x}\) at \(x=4.\)
- Use \(p_4(x)\) to approximate \(\sqrt{3}\).
- Find bounds on the error when approximating \(\sqrt{3}\) with \(p_4(3)\).
Solution
- We begin by evaluating the derivatives of \(f\) at \(x=4\). This is done in Figure \(\PageIndex{11}\). These values allow us to form the Taylor polynomial \(p_4(x)\): \[p_4(x) = 2 + \dfrac14(x-4) +\dfrac{-1/32}{2!}(x-4)^2+\dfrac{3/256}{3!}(x-4)^3+\dfrac{-15/2048}{4!}(x-4)^4.\]
- As \(p_4(x) \approx \sqrt{x}\) near \(x=4\), we approximate \(\sqrt{3}\) with \(p_4(3) = 1.73212\).
- To find a bound on the error, we need an open interval that contains \(x=3\) and \(x=4\). We set \(I = (2.9,4.1)\). The largest value the fifth derivative of \(f(x)=\sqrt{x}\) takes on this interval is near \(x=2.9\), at about \(0.0273\). Thus \[\big|R_4(3)\big| \leq \dfrac{0.0273}{5!}\big|(3-4)^5\big| \approx 0.00023.\]
This shows our approximation is accurate to at least the first 2 places after the decimal. (It turns out that our approximation is actually accurate to 4 places after the decimal.) A graph of \(f(x)=\sqrt x\) and \(p_4(x)\) is given in Figure \(\PageIndex{12}\). Note how the two functions are nearly indistinguishable on \((2,7)\).
Our final example gives a brief introduction to using Taylor polynomials to solve differential equations.
Example \(\PageIndex{6}\): Approximating an unknown function
A function \(y=f(x)\) is unknown save for the following two facts.
- \(y(0) = f(0) = 1\), and
- \(y^\prime= y^2\)
(This second fact says that amazingly, the derivative of the function is actually the function squared!)
Find the degree 3 Maclaurin polynomial \(p_3(x)\) of \(y=f(x)\).
Solution
One might initially think that not enough information is given to find \(p_3(x)\). However, note how the second fact above actually lets us know what \(y^\prime(0)\) is:
\[y^\prime = y^2 \Rightarrow y^\prime(0) = y^2(0). \nonumber\]
Since \(y(0) = 1\), we conclude that \(y^\prime(0) = 1\).
Now we find information about \(y^{\prime\prime}\). Starting with \(y^\prime=y^2\), take derivatives of both sides, with respect to \(x\). That means we must use implicit differentiation.
\[\begin{align*}
y^\prime &= y^2\\
\dfrac{d}{dx}\left(y^\prime\right) &= \dfrac{d}{dx}\left(y^2\right)\\
y^{\prime\prime} &= 2y\cdot y^\prime. \\
\text{Now evaluate both sides at \(x=0\): }&\\
y^{\prime\prime}(0) &= 2y(0)\cdot y^\prime(0)\\
y^{\prime\prime}(0) &= 2
\end{align*}\]
We repeat this once more to find \(y^{\prime\prime\prime}(0)\). We again use implicit differentiation; this time the Product Rule is also required.
\[\begin{align*}
\dfrac{d}{dx}\left(y^{\prime\prime}\right) &= \dfrac{d}{dx} \left(2yy^\prime\right)\\
y^{\prime\prime\prime} &= 2y^\prime\cdot y^\prime + 2y\cdot y^{\prime\prime}.\\
\text{Now evaluate both sides at \(x=0\): }& \\
y^{\prime\prime\prime}(0) &= 2y^\prime(0)^2 + 2y(0)y^{\prime\prime}(0)\\
y^{\prime\prime\prime}(0) &= 2+4=6
\end{align*}\]
In summary, we have:
\[y(0) = 1 \qquad y^\prime(0) = 1 \qquad y^{\prime\prime}(0) = 2 \qquad y^{\prime\prime\prime}(0) = 6. \nonumber\]
We can now form \(p_3(x)\):
\[\begin{align*}
p_3(x) &= 1 + x + \dfrac{2}{2!}x^2 + \dfrac{6}{3!}x^3\\
&= 1+x+x^2+x^3.
\end{align*}\]
It turns out that the differential equation we started with, \(y^\prime=y^2\), where \(y(0)=1\), can be solved without too much difficulty: \( y = \dfrac{1}{1-x}\). Figure 8.28 shows this function plotted with \(p_3(x)\). Note how similar they are near \(x=0\).
It is beyond the scope of this text to pursue error analysis when using Taylor polynomials to approximate solutions to differential equations. This topic is often broached in introductory Differential Equations courses and usually covered in depth in Numerical Analysis courses. Such an analysis is very important; one needs to know how good their approximation is. We explored this example simply to demonstrate the usefulness of Taylor polynomials.
Most of this chapter has been devoted to the study of infinite series. This section has taken a step back from this study, focusing instead on finite summation of terms. In the next section, we explore Taylor Series, where we represent a function with an infinite series.
Contributors and Attributions
Gregory Hartman (Virginia Military Institute).Contributions were made by Troy Siemers andDimplekumar Chalishajar of VMI and Brian Heinold of Mount Saint Mary's University. This content iscopyrighted by a Creative CommonsAttribution - Noncommercial (BY-NC) License.http://www.apexcalculus.com/