# $\int_0^{\frac{\pi}{2}}x\cot(x)dx$ and $\lim_{m \rightarrow \infty}\log\left( e^{2m}\left(\frac{(2m-1)!!}{(2m+1)^m}\right)^2\right)$.

I'm trying to evaluate the integral, but in doing so have stumbled upon the limit, which I don't know whether it exists, and if so how to resolve it (and whether I've derived the relationship between the integral and limit correctly [see below]).

Derivation: First, use the cotangent formula: $$\cot(x)=\sum_{-\infty\le n\le\infty}\frac{1}{x+\pi n},$$ and apply it to the integral: $$\int_0^{\frac{\pi}{2}}x\cot(x)dx=\sum_{-\infty\le n\le\infty}\int_0^{\frac{\pi}{2}}\frac{x}{x+\pi n}dx$$ $$=\sum_{-\infty\le n\le\infty}\int_{n \pi}^{\pi \left(n+\frac{1}{2}\right)}\frac{u- \pi n}{u}du$$ $$=\sum_{-\infty\le n\le\infty}[u-\pi n \log(u)]_{n \pi}^{\pi \left(n+\frac{1} {2}\right)},$$ and rearranging, $$=\sum_{-\infty\le n\le\infty}\frac{\pi}{2}-\pi n \log\left(\frac{2n+1}{2n}\right)$$ $$=\frac{\pi}{2}\sum_{-\infty\le n\le\infty} \log\left( e\left(\frac{2n}{2n+1}\right)^{2n}\right)$$ $$=\frac{\pi}{2} \log\left( \prod_{-\infty\le n\le\infty} e\left(\frac{2n}{2n+1}\right)^{2n}\right).$$

Note that $$\prod_{-\infty\le n\le\infty} \left(\frac{2n}{2n+1}\right)^{2n}= \prod_{1\le n\le\infty} \left(\frac{2n}{2n+1}\right)^{2n}\left(\frac{-2n}{-2n+1}\right)^{-2n}$$ $$= \prod_{1\le n\le\infty} \left(\frac{2n-1}{2n+1}\right)^{2n}$$ $$=\left(\frac{1^1}{3^1}\cdot\frac{3^2}{5^2}\cdot\frac{5^3}{7^3}\cdots\right)^2=\lim_{m \rightarrow \infty}\left(\frac{(2m-1)!!}{(2m+1)^m}\right)^2.$$ Thus the original integral is equal to $$\frac{\pi}{2} \lim_{m \rightarrow \infty}\log\left( e^{2m+1}\left(\frac{(2m-1)!!}{(2m+1)^m}\right)^2\right).$$

• In the end, when you pair up the terms for $n$ and $-n$, it cancels out, I think, but up until then, you are working with divergent sums/products. You need corrective terms for convergence. Oct 26 '13 at 22:41
• @DanielFischer How is it possible that a convergent integral yields a divergent sum? I don't see any algebraic manipulations above that are incorrect.
– Meow
Oct 27 '13 at 10:19
• The formula you start with is incorrect. $\sum\limits_{n\in\mathbb{Z}} \frac{1}{x+\pi n}$ doesn't converge (the limit of the symmetric partial sums exists, and is $\cot x$, however). To get a convergent series that allows all the manipulations, consider $$\cot x = \frac1x + \sum_{n\in\mathbb{Z}\setminus\{0\}}\left(\frac{1}{x+\pi n} - \frac1n\right),$$ or group the terms for $n$ and $-n$ directly, $\cot x = \frac1x + 2\sum_{n=1}^\infty \frac{x}{x^2 - (\pi n)^2}$. As I said, in the end, when you pair up, it cancels out, so [unless you made a mistake] the end result is okay. Oct 27 '13 at 10:29
• @DanielFischer Ah, thanks! That seems interesting, but I'm curious whether there are there infinitely many corrective terms (i.e. things like $f(n)=\frac{-1}{n}$ which force convergence of $\sum_{n \in \mathbb{Z}} \frac{1}{x+n \pi}$when not taking the symmetric sum)?
– Meow
Oct 27 '13 at 10:59
• Dang. Old habit of considering $\pi \cot (\pi z)$. The correction terms here ought to be $-\frac{1}{\pi n}$ of course, not $-\frac1n$. You can choose many different corrective terms, the point is that you get a general term in the series such that the sum converges locally uniformly and absolutely on every compact set. $-\frac{1}{\pi n + c}$ for any fixed constant $c$ also works. But $\frac{1}{\pi n}$ has the nice property of being the first term in the Taylor expansion of $\frac{1}{x+\pi n}$. Oct 27 '13 at 11:10

IMHO, it will be simpler if one integrate the integral by parts. Using answers from the question Evaluate: $\int_0^{\pi} \ln \left( \sin \theta \right) d\theta$, we have $$\int_0^{\frac{\pi}{2}} x \cot x dx = \int_0^{\frac{\pi}{2}} x (\log \sin x)' dx = \Big[x \log \sin x\Big]_0^{\frac{\pi}{2}} - \int_0^{\frac{\pi}{2}} \log\sin x dx\\ = - \int_0^{\frac{\pi}{2}} \log\sin x dx = \frac{\pi}{2}\log 2$$

• Nice explanation.............. Oct 27 '13 at 17:39

As mentioned in the comments, there are some issues regarding convergence in your calculation. These are not insurmountable, you can add a corrective term to the summands of the partial fraction decomposition of the cotangent,

$$\cot x = \frac1x + \sum_{n\in \mathbb{Z}\setminus\{0\}} \left(\frac{1}{x+\pi n} - \frac{1}{\pi n} \right),$$

to get a locally uniformly convergent series that allows interchange of summation and integration, you can pair up the terms for $n$ and $-n$ in the series before any manipulation,

$$\cot x = \frac1x + \sum_{n=1}^\infty \left(\frac{1}{x+\pi n} + \frac{1}{x-\pi n}\right) = 1 + 2\sum_{n=1}^\infty \frac{x}{x^2 - (\pi n)^2},$$

or you can explicitly consider the limit of symmetric partial sums,

$$\cot x = \lim_{N\to\infty} \sum_{n=-N}^N \frac{1}{x+\pi n}.$$

All these allow the performed manipulations since the corresponding series/sequence of symmetric partial sums for $x\cot x$ then converges uniformly on $\left[0,\frac{\pi}{2}\right]$.

With the understanding that the series and infinite products in your calculation are to be interpreted as the limits of symmetric partial sums/products, the computation is correct, and we have indeed

$$\int_0^{\pi/2} x\cot x\,dx = \pi\cdot \lim_{m\to\infty} \log \left(e^{m+1/2}\frac{(2m-1)!!}{(2m+1)^m}\right).$$

To evaluate that limit, it is helpful to rewrite the expression a little,

$$e^{m+1/2}\frac{(2m-1)!!}{(2m+1)^m} = e^{m+1/2}\frac{(2m)!}{2^mm!(2m+1)^m}.$$

Now we can use Stirling's formula

$$n! = \sqrt{2\pi n} \left(\frac{n}{e}\right)^n\cdot e^{\rho(n)},$$

where $\lim\limits_{n\to\infty}\rho(n) = 0$ (more precisely, $\frac{1}{12n+1} < \rho(n) < \frac{1}{12n}$, but we don't need that). Thus

\begin{align} e^{m+1/2}\frac{(2m)!}{2^mm!(2m+1)^m} &= e^{m+1/2}\frac{2\sqrt{\pi m} (2m)^{2m}e^{-2m} e^{\rho(2m)}}{\sqrt{2\pi m}\cdot 2^mm^me^{-m} e^{\rho(m)}(2m+1)^m}\\ &= \sqrt{2}e^{1/2}\left(\frac{2m}{2m+1}\right)^m e^{\rho(2m) - \rho(m)}\\ &= \frac{\sqrt{2}\cdot e^{1/2}}{\left(1+\frac{1}{2m} \right)^m} e^{\rho(2m)-\rho(m)}\\ &\to \sqrt{2}. \end{align}

Hence

$$\int_0^{\pi/2} x\cot x\,dx = \frac{\pi}{2}\log 2.$$

• Exemplary answer! I should have guessed Stirlings would be useful.
– Meow
Oct 27 '13 at 16:55