Lecture 24 Approximation of Integrals using Taylor Polynomials

Text References: Course notes pp. 111-114 & Rogawski 10.7

24.1 Recap

Last time, we found a way to estimate the error bound of a Taylor polynomial.

Exercise 24.1 Find the error bound for the third order Taylor polynomial of \(f(x)=\ln(x)\) for centred at \(1\) and evaluated at \(x=1.2\).

Solution. First, we need to find a value of \(K\) such that \(|f^{(4)}(x)|\leq K\) for values of \(x\) between \(1\) and \(1.2\). We have \(f^{(4)}(x)=-6x^{-4}\) and so \(|f^{(4)}(x)|\) is decreasing on the interval \([1, 1.2]\). The maximum value on that interval is at \(x=1\), and so \(|f^{(4)}(x)|\leq f^{(4)}(1)=6\). We therefore set \(K\).

Applying Taylor’s Inequality, we have \(\displaystyle |R_3(1.2)|\leq 6 \frac{|1.2-1|^4}{4!}\approx 0.0004\).

24.2 Learning Objectives

  • Use Taylor polynomials to approximate integrals.

24.3 Motivation

Now that we’ve developed a nice and robust theory of Taylor polynomials, it’s time to put it to use. One particularly useful application is in approximating integrals for which there is no tidy antiderivative.

Let’s work with a motivating example. Suppose that we want to estimate \(\displaystyle \int_0^1 e^{x^2}dx\). Our approach will be to replace \(e^{x^2}\) with a function that is close to \(e^{x^2}\) but is much easier to integrate. The Taylor polynomial of \(e^{x^2}\) is an excellent candidate: we know that it gives a good approximation of the function and polynomials are much easier to integrate.

24.4 Approximating Integrals using Polynomials

Let’s take the second order Maclaurin polynomial of \(e^x\) and use it to find the second order Maclaurin polynomial of \(e^{x^2}\). We have \(P_{0,2}(x)=1+x+\frac{x^2}{2!}+R_2(x)\) and so \(P_{0,2}(x^2)=1+x^2+\frac{x^4}{2!}+R_2(x^2)\)

Now, we have to deal with those remainders–simply throwing them away with throw off the accuracy of our approximation.

Recall that \(\displaystyle |R_2(x)|\leq \frac{K|x-0|^3}{3!}\). We are working on the interval \([0,1]\) and so the third derivative of \(e^x\) is bounded above by \(e\). We can therefore set \(K=e\) to get \(\displaystyle |R_2(x)|\leq \frac{e|x|^3}{3!}\leq \frac{3|x|^3}{3!} = \frac{|x|^3}{2}\). Note that here, we rounded \(e\) up to \(3\) to get some nice cancellations.

Given that \(\displaystyle |R_2(x)|\leq\frac{|x|^3}{2}\) this means that \(\displaystyle |R_2(x^2)|\leq\frac{|x^2|^3}{2}=\frac{x^6}{2}\). That is, \[1+x^2+\frac{x^4}{2}-\frac{x^6}{2}\leq e^{x^2}\leq 1+x^2+\frac{x^4}{2}+\frac{x^6}{2}\]

Now that we have all of the pieces in place, we can get back to the integral:

\[\begin{align*} \int_0^1 e^{x^2}dx & \leq \int_0^1 1+x^2+\frac{x^4}{2!}+R_2(x^2) dx \\ &= \int_0^1 1+x^2+\frac{x^4}{2!}+\frac{x^6}{2} dx\\ &= \frac{158}{105} \approx 1.505\\ \end{align*}\]

Similarly, \[\int_0^1 1+x^2+\frac{x^4}{2}-\frac{x^6}{2}dx \leq \int_0^1 e^{x^2}dx \implies \frac{143}{105}\approx 1.361 \leq \int_0^1 e^{x^2}dx\]

We can therefore conclude that \[1.361 \leq \int_0^1 e^{x^2}dx \leq 1.505\]

Exercise 24.2 Estimate \(\displaystyle \int_0^{2/3}x\sin(x^3)dx\) using the tenth degree Maclaurin polynomial for \(x\sin(x^3)\). You may use the fact that \(P_{3,0}(x)=x-\frac{x^3}{3}+R_3(x)\) for \(f(x)=\sin(x)\).

Solution. We know that \(f(x)=x-\frac{x^3}{3}+R_3(x)\) and therefore for \(g(x)=x\cdot sin(x^3)\) we have \(g(x)=x\cdot f(x^3)=x\cdot \left (x^3-\frac{x^9}{6}+R_3(x^3)\right) = x^4-\frac{x^{10}}{6}+xR_3(x^3)\)

Now, let’s work on the remainder. On the interval \(x\in [0, 2/3]\), we have \(x^3 \in [0, 8/27]\) \(|\sin(x)^{(4)}|=|\sin(x)|\leq 8/27\leq 1\). And so \[|R_3(x)|\leq \frac{1\cdot |x-0|^4}{4!}=\frac{x^4}{4!}\]

From here, we can find \[|xR_3(x^3)| \leq x\cdot \frac{(x^4)^3}{4!} = \frac{|x|^{13}}{48}\] since we are on an interval with \(x >0\), we can drop the absolute values on the numerator to get \(\displaystyle |xR_3(x^3)| \leq \frac{x^{13}}{48}\)

Putting everything together, we have

\[\begin{align*} \int_0^{2/3}x\sin(x^3)dx &= \int_0^{2/3} x^4-\frac{x^{10}}{6}+xR_3(x^3) dx \\ &= \int_0^{2/3} x^4-\frac{x^{10}}{6}+\frac{x^{13}}{48}\\ & \approx 0.02616228 + 0.0000051\\ &= 0.02616738 \end{align*}\]