# Asymptotic expansion of $I_n = \int_0^{\pi/4} \tan(x)^n \mathrm dx$

I'm trying to compute the asymptotic expansion of

$$I_n = \int_0^{\pi/4} \tan(x)^n \mathrm dx$$

Here is what I've done:

Change of variable $$t= \tan x$$

$$I_n = \int_0^1 \frac{t^n \mathrm dt}{1+t^2} = \int_0^1 \frac{(1-t)^n \mathrm dt}{t^2-2t+2}$$

Change of variable

$$t=\frac{x}{n}$$

$$I_n = \frac{1}{2n}\int_0^n \frac{\left(1-\frac{x}{n}\right)^n \mathrm dx}{1-\left(\frac{x}{n}-\frac{x^2}{2n^2} \right)}$$

Taylor expansions:

$$\left(1-\frac{x}{n}\right)^n = e^{-x} \left(1-\frac{x^2}{2n}+\frac{3x^4-8x^3}{24n^2}+\mathcal{O} \left(\frac{1}{n^3} \right) \right)$$

$$\frac{1}{1-\left(\frac{x}{n}-\frac{x^2}{2n^2} \right)} = 1+\frac{x}{n}+\frac{x^2}{2n^2} + \mathcal{O} \left(\frac{1}{n^3} \right)$$

$$\frac{\left(1-\frac{x}{n}\right)^n }{1-\left(\frac{x}{n}-\frac{x^2}{2n^2} \right)}=e^{-x} \left( 1+\frac{x}{n}+\frac{x^2}{2n^2}-\frac{x^2}{2n}-\frac{x^3}{2n^2}+\frac{3x^4-8x^3}{24n^2} + \mathcal{O} \left(\frac{1}{n^3} \right) \right)$$

So

$$I_n = \frac{1}{2n} \int_0^n e^{-x} \left( 1+\frac{x}{n}+\frac{x^2}{2n^2}-\frac{x^2}{2n}-\frac{x^3}{2n^2}+\frac{3x^4-8x^3}{24n^2} + \mathcal{O} \left(\frac{1}{n^3} \right) \right) \mathrm dx$$

$$I_n = \frac{1}{2n} \left(1+\frac{1}{n}+\frac{1}{2n^2}\times 2-\frac{1}{2n}\times 2 - \frac{1}{2n^2} \times 6 + \frac{1}{8n^2} \times 24 - \frac{1}{3n^2} \times 6+ \mathcal{O} \left(\frac{1}{n^3} \right) \right)$$

$$I_n = \frac{1}{2n}-\frac{1}{2n^3}+\mathcal{O} \left(\frac{1}{n^4} \right)$$

For example Wolfram gives:

$$1-1000^2+ 2\times1000^3\int_0^{\pi/4} \tan(x)^{1000} \mathrm dx \approx 4.9\times 10^{-6}$$

I'm quite sure of my work, I would just like to know if everything is correct!

-
See Laplace's Method. – Mhenni Benghorbal Jan 31 '13 at 5:06

I figured I'd throw my hat into the ring as well.

We can appeal to Watson's lemma to find a full asymptotic expansion of the integral.

After your substitution $t=\tan x$, make another substitution $t = e^{-s}$. This gives

$$\int_0^1 t^n \frac{dt}{1+t^2} = \int_0^\infty e^{-ns} \frac{ds}{e^s+e^{-s}}.$$

By Watson's lemma we have

$$\int_0^\infty e^{-ns} \frac{ds}{e^s+e^{-s}} \approx \frac{1}{2} \sum_{k=0}^{\infty} \frac{E_k}{n^{k+1}}$$

as $n \to \infty$, where $E_k$ is the $k^{\text{th}}$ Euler number.

-

Not an independent answer but completing the circle start by others.

Several people here have derived the expression: $$I_n = \sum_{k=0}^{\infty} \dfrac{(-1)^k}{n+1+2k}$$

Using the digamma function $\psi(x) = \frac{\Gamma'(x)}{\Gamma(z)}$ which has the expression and asymptotic expansion: \begin{align} \psi(x) &= - \gamma -\frac{1}{x} - \sum_{k=1}^{\infty}(\frac{1}{k} - \frac{1}{x+k})\\ &\approx_{ae} \ln{x} - \frac{1}{2x} + \sum_{k=1}^{\infty}\frac{B_{2k}}{2 k\ x^{2k}} \end{align} where $B_{k}$ is the k-th Bernoulli number, one can simplify $I_n$ as: \begin{align} I_n &= \frac{1}{2}( \psi(\frac{n+1}{2})-\psi(\frac{n+1}{4}) - \ln{2})\\ &\approx_{ae} \frac{1}{2}( \frac{1}{n+1} + \sum_{k=1}^{\infty}\frac{4^k(4^k-1)B_{2k}}{2 k(n + 1)^{2k}} )\\ &\approx_{ae} \frac{1}{2}( \frac{1}{n+1} + \frac{1}{(n+1)^2} - \frac{8}{(n+1)^4} + \frac{144}{(n+1)^6} - \frac{4352}{(n+1)^8} + .. ) \end{align} In particular, the leading terms up to $O(\frac{1}{n^4})$ is given by: $$I_{n} \approx \frac{1}{2}(\frac{1}{n+1} + \frac{1}{(n+1)^2} ) \approx \frac{1}{2}( \frac{1}{n} - \frac{1}{n^3} )$$ agree with @rlgordonma result.

-

May be this can give you an asymptotics. Consider even case $$I_{2k}=\int\limits_{0}^{1}\frac{t^{2k}}{t^2+1}dt=\int\limits_{0}^{1}(-1)^k\left(\sum\limits_{j=0}^{k-1}(-1)^{j+1}t^{2j}+\frac{1}{t^2+1}\right)dt=\\ (-1)^k\left(-\sum\limits_{j=0}^{k-1}\frac{(-1)^j}{2j+1}+\frac{\pi}{4}\right)=\sum\limits_{j=k}^\infty\frac{(-1)^{j+k}}{2j+1}=\sum\limits_{j=0}^\infty\frac{(-1)^{j}}{2j+2k+1}$$ and the odd case $$I_{2k+1}=\int\limits_{0}^{1}\frac{t^{2k+1}}{t^2+1}dt=\int\limits_{0}^{1}(-1)^k\left(\sum\limits_{j=0}^{k-1}(-1)^{j+1}t^{2j+1}+\frac{t}{t^2+1}\right)dt=(-1)^k\left(-\sum\limits_{j=0}^{k-1}\frac{(-1)^j}{2j+2}+\frac{1}{2}\ln2\right)=\sum\limits_{j=k}^{\infty}\frac{(-1)^{j+k}}{2j+2}=\sum\limits_{j=0}^\infty\frac{(-1)^{j}}{2j+2k+2}$$ Hence $$I_n=\sum\limits_{j=0}^\infty\frac{(-1)^{j}}{2j+n+1}$$

-
I also managed to get this formula for $I_n$ (using Marvis' method) but I can't see how an asymptotic expansion of this series can be computed when $n\rightarrow \infty$... – Chon Jan 30 '13 at 20:21
See my comment to @Marvis; this is not what the OP sought. – Ron Gordon Jan 30 '13 at 20:22

You get that $$I_n = \int_0^1 \dfrac{t^n}{1+t^2} dt = \int_0^1 t^n \left(\sum_{k=0}^{\infty} (-t^2)^k\right) dt = \sum_{k=0}^{\infty}(-1)^k \int_0^1 t^{n+2k} dt$$ Now $$\int_0^1 t^{n+2k} dt = \dfrac1{n+1+2k}$$ Hence, $$I_n = \sum_{k=0}^{\infty} \dfrac{(-1)^k}{n+1+2k}$$

-
How would you derive the asymptotic behavior the OP has sought? It is nice that you have an "exact" result, but in reality, this is a Hurwitz-Lerch transcendent, whose behavior is not trivial. The OP is looking for simple behavior of $I_n$ as $n \rightarrow \infty$. – Ron Gordon Jan 30 '13 at 20:22

Consider

$$I_{n+2} = \int_0^{\pi/4} \tan(x)^{n+2} \mathrm dx = \int_0^{\pi/4} \tan(x)^{n}(\sec(x)^2-1) \mathrm dx$$

$$= -\int_0^{\pi/4} \tan(x)^{n} \mathrm dx + \int_0^{\pi/4} \tan(x)^{n}\sec(x)^2 \mathrm dx$$

$$\implies I_{n+2}+I_n=\frac{1}{n+1}=\frac{1}{n}-\frac{1}{n^3}+\frac{1}{n^5}-\dots$$

$$\implies 2I_n\sim \frac{1}{n} \implies I_n \sim \frac{1}{2n},$$

as $n \to \infty.$

-
Hi, how can you prove your second implication ? – user119228 Jan 26 '14 at 2:45

I couldn't follow what you were doing, but I do see that you have the right answer to first order. I can, however, point to a simpler way based on Laplace's Method.

First of all, write the integral as an exponential whose maximum is at $x=0$:

$$I_n = \int_0^{\pi/4} dx \: e^{n \log{\tan{\left ( \frac{\pi}{4} - x \right )}}}$$

As $n \rightarrow \infty$, the integral is dominated by its contributions from where the integrand is a maximum, or at $x=0$. We may then approximate $\log{\tan{\left ( \frac{\pi}{4} - x \right )}}$ by its lower-order terms in its Taylor expansion about $x=0$.

To first order, note that $\log{\tan{\left ( \frac{\pi}{4} - x \right )}} \sim -2 x$ as $x \rightarrow \infty$. We may then write

$$I_n \sim \int_0^{\pi/4} dx \: e^{-2 n x} \: \: (n \rightarrow \infty)$$

We may also may as well send that upper integration limit to $\infty$, as, again, the contributions to the integral away from $x=0$ are exponentially small. The leading order term in the expansion is then

$$I_n \sim \frac{1}{2 n} \: \: (n \rightarrow \infty)$$

You may also derive higher order terms from the higher-order terms in the Taylor expansion. The integrals that result will come from Taylor expanding the exponential piece containing these higher-order terms, which will result in Gamma-function-like integrals which will bring in decreasing powers of $n$ in the asymptotic expansion.

EDIT

I will do out the next order. To second order:

$$\log{\tan{\left ( \frac{\pi}{4} - x \right )}} =-2 x -\frac{4}{3} x^3 +O(x^4)$$

The corrected expansion is then

$$I_n \sim \int_0^{\infty} dx \: e^{-2 n x} \left ( 1 - \frac{4}{3} n x^3 \right ) \: \: (n \rightarrow \infty)$$

Doing this next integral as well, we find that

$$I_n \sim \frac{1}{2 n} - \frac{1}{2 n^3} \: \: (n \rightarrow \infty)$$

in agreement with your result.

-