[Math] Error bound for Taylor approximation to $\tan(x)$

complex-analysisconvergence-divergencepower seriessequences-and-series

I'm looking to bound the error for the Taylor series of $\tan(x)$ so that I will know how many terms I need to go out to get a desired precision. I've already searched and came across this, but the bound provided in that answer doesn't make much sense.

In particular, for $f(x):=\tan(x)$, I want to first expand around $x=0$ then approximate $\tan(1)$ to a precision of $N$ digits (note that $\tan$ is analytic for $x\in (-\pi/2,\pi/2)$). After using the Lagrange error bound from elementary calculus I have
$$R_n=\frac{f^{(n+1)}(c)}{(n+1)!}(1-0)^{n+1}$$
for $c\in (0,1)$. We want $|R_n|\leq 10^{-N}$. The problem is that I can't find a good way to bound the term $f^{(n+1)}(c)$, as higher-order derivatives of $\tan$ are polynomials in $\tan(x)$ and have a very nasty closed form.

The first answer in the link I referred to had some $\frac{c}{(n+1)!}$ bound on it, but because of the way $c$ is defined, after using Mathematica I see that $\frac{c}{(n+1)!}\rightarrow \infty$ for $n\rightarrow \infty$, which doesn't make sense since increasing the number of terms should decrease the error.

In the above, $R_n\rightarrow \infty$ as $n\rightarrow \infty$ as well. I'm not sure if I'm just overlooking something–am I just doing something wrong? Could anybody give me any suggestions?

This is on a complex analysis assignment by the way, but it seems that complex-analytic methods aren't required here.

Best Answer

There is a good reason this is on a complex analysis assignment rather than a calculus one. The easiest way to bound the derivative term is to use $$ f^{(n)}(z) = \frac{n!}{2\pi i} \int_{\gamma_r} \frac{ f(t) }{(t-z)^{n+1}} dt $$

which comes from differentiating Cauchy's Integral formula. Here $\gamma_r$ is the circle of radius $r$ centered at $z.$


Don't evaluate the integral exactly, just make rough bounds. We have $z\in (0,1)$ and $\gamma_r$ is the circle of radius $r$ around $z.$ $$ | f^{(n)} (z)| = \frac{n!}{2\pi} \int_{\gamma_r} \frac{ |\tan t|}{|t-z|^{n+1}} dt \leq \frac{n!M_r}{r^n} $$

where $M_r$ is the maximum of $|\tan z|$ on the contour.

Related Question