How can I calculate the integral $$\int_0^{\pi /2}\frac x {\tan x} \, dx$$ with complex integration? (Contours, residue theorem, etc.) I was thinking on using the fact that $\displaystyle \tan x=\frac{e^{ix}-e^{-ix}}{i(e^{ix}+e^{-ix})}$, which implies $e^{ix}=z$. I still have not been succesful.
-
1$\begingroup$ You can do it with real methods. Let $f(a)=\int_{0}^{0.5\pi} \frac{\arctan(a \tan(x))}{\tan x} dx$. Then $f'(a)=..$ $\endgroup$ – Ahmed S. Attaalla Aug 21 '17 at 22:04
-
3$\begingroup$ HI! Yes, I know. But now I am studying complex integration and I'm only interested on this method. $\endgroup$ – otreblig Aug 21 '17 at 22:10
-
$\begingroup$ I used the substitution x = arctan u then I represented the original integral as a double integral. Don't have time now, but thanks for your attention. $\endgroup$ – otreblig Aug 21 '17 at 23:38
-
$\begingroup$ Are you sure how your statement ? Ahmed's method seems the best. $\endgroup$ – reuns Aug 22 '17 at 2:47
A complex-analytic solution. Here is a combination of calculus and a basic complex analysis: Perform integration by parts to sanitize the integrand:
$$ \int_{0}^{\frac{\pi}{2}} \frac{x}{\tan x} \, dx = \underbrace{ \left[ \vphantom{\int} x \log\sin x \right]_{0}^{\frac{\pi}{2}} }_{=0} - \int_{0}^{\frac{\pi}{2}} \log \sin x \, dx. $$
Also notice that, if $x \in (0,\frac{\pi}{2}]$ then $\log|\sin x| = -\log 2 + \operatorname{Re}\log(1 - e^{2ix})$. So
\begin{align*} \int_{0}^{\frac{\pi}{2}} \frac{x}{\tan x} \, dx &= - \frac{1}{2} \int_{0}^{\pi} \log |\sin x| \, dx \\ &= \frac{\pi}{2}\log 2 - \frac{1}{2} \operatorname{Re} \left( \int_{0}^{\pi} \log(1 - e^{2ix}) \, dx \right) \\ (z = e^{2ix}) \quad&= \frac{\pi}{2}\log 2 - \frac{1}{4} \operatorname{Re} \left( \oint_{|z|=1} \frac{\log(1 - z)}{iz} \, dz \right), \end{align*}
Since $z \mapsto \frac{\log(1 - z)}{iz}$ is holomorphic in the unit disc $\mathbb{D}$ and has only logarithmic singularity on the boundary $\partial \mathbb{D}$, we can still apply the Cauchy integral theorem to conclude that the integral vanishes. Therefore we have
$$ \int_{0}^{\frac{\pi}{2}} \frac{x}{\tan x} \, dx = \frac{\pi}{2}\log 2. $$
Alternative complex-analytic solution. Use the substitution $x = \arctan u$ to write
$$ \int_{0}^{\frac{\pi}{2}} \frac{x}{\tan x} \, dx = \frac{1}{2}\int_{-\infty}^{\infty} \frac{\arctan u}{u(u^2+1)} \, du. $$
This hints us that we may use some contour integration technique, but we need to resolve the branch cut of $\arctan$. Here we give one such trick. Notice that
$$ \frac{\arctan u}{u} = \int_{0}^{1} \frac{dt}{1+u^2 t^2}. $$
Plugging this back and interchanging the order of integration, we get
$$ \int_{0}^{\frac{\pi}{2}} \frac{x}{\tan x} \, dx = \frac{1}{2}\int_{0}^{1} \left( \int_{-\infty}^{\infty} \frac{du}{(u^2 t^2+1)(u^2+1)} \right) \, dt. $$
Now we can perform contour integration to obtain that
\begin{align*} \int_{-\infty}^{\infty} \frac{du}{(u^2 t^2+1)(u^2+1)} &= 2\pi i \left( \underset{u = i}{\mathrm{Res}} \, \frac{1}{(u^2 t^2+1)(u^2+1)} + \underset{u = i/t}{\mathrm{Res}} \, \frac{1}{(u^2 t^2+1)(u^2+1)} \right) \\ &= \frac{\pi}{t+1}. \end{align*}
So we have
$$ \int_{0}^{\frac{\pi}{2}} \frac{x}{\tan x} \, dx = \frac{1}{2}\int_{0}^{1} \frac{\pi}{t+1} \, dt = \frac{\pi}{2} \log 2. $$
-
$\begingroup$ This might be more in line with what OP was looking for, but I'd be remiss if I didn't mention that that latter integral is solvable with real methods. math.stackexchange.com/questions/2381701/… $\endgroup$ – David Bowman Aug 22 '17 at 3:47
-
3$\begingroup$ @DavidBowman, I agree :) Solution using symmetry is certainly a thing that we would not want to miss. It is also interesting to see that this integral can be solved by Fourier series and harmonic analysis. $\endgroup$ – Sangchul Lee Aug 22 '17 at 3:56
I would like to add an alternative approach. By considering the logarithmic derivative of the Weierstrass product $$ \sin(\theta) = \theta\prod_{n\geq 1}\left(1-\frac{\theta^2}{\pi^2 n^2 }\right) \tag{1}$$ we get: $$ \theta\cot\theta = 1-\sum_{n\geq 1}\frac{2\theta^2}{\pi^2 n^2 -\theta^2} \tag{2}$$ from which: $$ \int_{0}^{\pi/2}\theta\cot\theta\,d\theta = \frac{\pi}{2}+\pi\sum_{n\geq 1}\left(1-2n\,\text{arctanh}\frac{1}{2n}\right) \tag{3}$$ where the RHS of $(3)$ can be computed through summation by parts and Stirling's approximation. Indeed, $$\begin{eqnarray*}\sum_{n=1}^{N}\left(1-n \log\frac{2n+1}{2n-1}\right) &=&N-N\log(2N+1)+\sum_{n=1}^{N-1}\log(2n+1)\\&=&N-N\log(2N+1)+\log\frac{(2N)!}{2^N N!}\\&=&\frac{\log 2-1}{2}+O\left(\frac{1}{N}\right)\tag{4}\end{eqnarray*}$$ leads to $\int_{0}^{\pi/2}\frac{x}{\tan x}\,dx = \color{blue}{\frac{\pi}{2}\log 2}$. Still another approach is to exploit Riemann sums (!!!). We have
$$ \int_{0}^{\pi/2}\theta\cot\theta\,d\theta\stackrel{IBP}{=}-\int_{0}^{\pi/2}\log\sin\theta\,d\theta=-\frac{1}{2}\int_{0}^{\pi}\log\sin\theta\,d\theta\tag{5}$$ and $$ \prod_{k=1}^{N-1}\sin\left(\frac{\pi k}{N}\right)=\frac{2N}{2^N},\tag{6} $$ so that: $$ \int_{0}^{\pi/2}\theta\cot\theta\,d\theta = -\frac{\pi}{2}\lim_{N\to +\infty}\frac{1}{N}\log\frac{2N}{2^N}=\color{blue}{\frac{\pi}{2}\log 2}.\tag{7}$$ At last, an efficient overkill: since $\Gamma(z)\,\Gamma(1-z)=\frac{\pi}{\sin(\pi z)}$, the equality between the RHS of $(5)$ and $\frac{\pi}{2}\log 2$ is a straightforward consequence of Raabe's Theorem on $\int\log\Gamma$.
-
$\begingroup$ This one is simple yet brilliant. +1 $\endgroup$ – Paramanand Singh Aug 22 '17 at 17:23
Let $z=\tan{x}$, then the integral you're looking for is $\int_{0}^{\infty}\frac{\arctan{z}}{z}\frac{1}{1+z^{2}}dz$. The integrand is an even function of $z$. This integral is then equal to $\frac{1}{2}\int_{-\infty}^{\infty}\frac{\arctan{z}}{z}\frac{1}{1+z^{2}}dz$. Use the residue theorem to evaluate this one
-
$\begingroup$ How do you use the residue theorem ? $\text{arctan}(z)$ has some branch points $\endgroup$ – reuns Aug 22 '17 at 2:42