Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
Doing Limit[c/(n + 1)!, n -> Infinity, Assumptions -> 0 < c < 1] MMA provides the right answer. – Pragabhava Oct 3 '12 at 4:15
The problem is that $c$ is not a constant, but an expression that depends on $n$: in the other thread, $c=(\pi/4)^{n+1}tan^{(n+1)}(\pi/4)$. Edit: sorry for the notation abuse, but the $c\in (0,1)$ above is not the same as the $c$ referred to in the other thread. – MathStudent1208 Oct 3 '12 at 4:19
That doesn't make sence at all. $\frac{\pi}{4} < 1$ and $\tan(\frac{\pi}{4}) = 1$, so $c_{n+1}<c_n<...<\frac{\pi}{4}$. Still, Limit[(\[Pi]/4)^(n + 1) Tan[\[Pi]/4]^(n + 1)/(n + 1)!, n -> Infinity] gives the correct answer in MMA 8. – Pragabhava Oct 3 '12 at 4:35
$\tan^{(n+1)}$ denotes the $n+1$-st derivative, and not power, of $\tan$... – MathStudent1208 Oct 3 '12 at 4:50

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.

share|cite|improve this answer
Great approach! +1 – Pragabhava Oct 3 '12 at 4:22
I've tried using the Cauchy estimate before actually, but that didn't work out well. I'll try this and see how it goes... – MathStudent1208 Oct 3 '12 at 4:50
So we have $R_n=\frac{1}{2\pi i}\int_\gamma \frac{\tan(z)}{(z-c)^{n+2}}dt$, and the integrand has a pole of order $n+2$ at $z=c$. Computing this residue would make me differentiate $\tan(z)$ $n+1$ times. Is there a better way to go about this? – MathStudent1208 Oct 3 '12 at 5:12
@MathStudent1208 Please see my edited answer. – Ragib Zaman Oct 3 '12 at 5:20
Hi Ragib, thanks for your update. This is the same as using Cauchy's estimate, which I tried before. In particular, with the bound above, we have $|R_n|\leq \frac{M_r}{r^{n+1}}$. But since $\tan$ is only analytic on $(-\pi/2,\pi/2)$ and $z\in (0,1)$, if we take $z>\pi/2-1$ we will have $|r|<1$, as the largest circle around $z$ must be contained in the strip of convergence. In that case, since $|r|<1$, it appears that $|R_n|\rightarrow \infty$ as $n\rightarrow \infty$, which is puzzling because $n\rightarrow \infty$ should make the approximation better. – MathStudent1208 Oct 3 '12 at 6:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.