Analysis – Estimating Error of sin(x) = x with Taylor’s Theorem

analysisnumerical methodstaylor expansion

I want to calculate the numerical error in approximating $\sin(x)=x$ with Taylor's Theorem. Furthermore, what values of $x$ will this approximation be correct to within $7$ decimal places?

Here is what I have done:

$\sin(x) = \sum\limits_{k=0}^n (-1)^k\dfrac{x^{2k+1}}{(2k+1)!} + E_n(x)$

Where $E_n(x) =\dfrac{f^{(n+1)}(\xi)}{(n+1)!}x^{n+1}$, $x\in (-\infty, \infty)$ and $\xi$ is between $x$ and $0$. (This is just Taylor's Theorem with Lagrange remainder)

Let $\xi = 0$ (why not). I am unsure of how I made $E_n(x)$:

\begin{align}
\left|\sin(x)-x\right| =& \sum\limits_{k=0}^n (-1)^k\dfrac{x^{2k+1}}{(2k+1)!} + (-1)^{2n+3}\dfrac{x^{2n+3}}{(2n+3)!} -x \\
\left|\sin(x)-x -\sum\limits_{k=0}^n (-1)^k\dfrac{x^{2k+1}}{(2k+1)!}\right|
=& \left|(-1)^{2n+3}\dfrac{x^{2n+3}}{(2n+3)!} -x\right| \\
=&\left|\dfrac{x^{2n+3}}{(2n+3)!}-x\right|
\end{align}

Continuing in this way find the values of $n$ and $x$ that solve:
\begin{equation}
\left|\dfrac{x^{2n+3}}{(2n+3)!}-x\right| \leq 10^{-7}
\end{equation}

Intuitively this seems off because $(2n+3)!$ grows faster than $x^{2n+3}$, and so taking the limit as $n\to\infty$ we get $\left|-x\right|=x$ and thus any value of $x \leq 10^{-7}$ would work. This just does not seem right.

All help is greatly appreciated!

Best Answer

We need to understand what Taylor's Theorem, Lagrange form of the remainder, says in this case.

We are using the Taylor polynomial $P_1(x)=x$ to approximate $\sin x$. We could therefore call the error term $E_1$. But in this case the second term in the Taylor expansion is $0$, so $P_1(x)=P_2(x)$, and therefore $E_1$ and $E_2$ are equal.

By the Lagrange form of the remainder, we have $$|E_2|=\left|\frac{-\cos \xi}{3!}x^3\right|\tag{1}$$ for some $\xi$ between $0$ and $x$. Since the absolute value of the cosine is $\le 1$, from (1) we obtain the estimate $$|E_2| \le \frac{|x|^3}{3!}.\tag{2}$$ It should now be straightforward to find the range of $x$ for which the right-hand side of (2) is $\lt 10^{-7}$.

Remark: If you have met alternating series, we can bypass the Lagrange form of the remainder. In this case we end up with basically the same estimate of the error. Usually, however, the Lagrange form of the remainder results in technically correct but excessively pessimistic estimates.