1

I am trying to evaluate $\int_0^{\pi/2}\frac{x}{\tan x} \, dx$. This is how I started: $$ \int_0^{\pi/2} x\cot x \, dx$$ Integrating by parts we get: $$x\ln\left|\sin x\right| - \int_0^{\pi/2}\ln\left|\sin x\right| \, dx $$ Since $x$ is between $0$ and $\pi/2$, we can drop the absolute value. $$x\ln \sin x - \int_0^{\pi/2}\ln \sin x \, dx $$ Integrating the second integral again by parts we get:

$$x\ln \sin x - x\ln \sin x - \int_0^{\pi/2}\frac{x}{\tan x} \, dx$$

Now we take the last integral to the other side to get $$2\int_0^{\pi/2}\frac{x}{\tan x} \, dx = 0$$ and therefore $\int_0^{\pi/2} \frac{x}{\tan x} \, dx = 0$. However, when I checked the memo, it said the answer was $\frac{\pi}{2} \ln2$. What is wrong with my solution? Please help me find where I went wrong.

  • 2
    You can't integrate again by parts that way, because it brings you where you started from. Indeed, the last $-$ should be $+$, so you just get $0=0$. – egreg Feb 15 '16 at 16:47
  • In the second integration by parts, you got a sign wrong. You should be left with $\int x \cot x = x \ln \sin x - x \ln \sin x + \int x \cot x$. This is a tautology caused by what @egreg has remarked. – Octania Feb 15 '16 at 16:49
  • Also, you omitted the bounds - $\displaystyle \int\limits_{a}^{b}f'(x)g(x)\text{d}x=\Big.f(x)g(x)\Big\vert_{a}^{b}- \int\limits_{a}^{b}f(x)g'(x)\text{d}x$. – Galc127 Feb 15 '16 at 16:50
  • the result should be $$\frac{\pi\ln(2)}{2}$$ – Dr. Sonnhard Graubner Feb 15 '16 at 16:57
  • 2
    @Dr.SonnhardGraubner The result IS $\frac{\pi\ln(2)}{2}$. But giving a result is quite useless without the method through which getting it. – Enrico M. Feb 15 '16 at 17:02
  • Take a look here – Galc127 Feb 15 '16 at 17:22
  • Without doing any of what you did above you can see that $$ \int_0^{\pi/2} \frac x {\tan x},dx>0 $$ because $x\tan x>0$ when $0<x<\pi/2$. $\qquad$ – Michael Hardy Feb 15 '16 at 17:28
  • 1
    $$\left.x\log\sin x\vphantom{\frac\int\int}\right|_0^{\pi/2}=0.$$ You can see that by applying L'Hopital's rule to $\dfrac{\log\sin x}{1/x}$. $\qquad$ – Michael Hardy Feb 15 '16 at 17:29
  • Your second integration by parts is not clear to me. Can you elaborate? $\qquad$ – Michael Hardy Feb 15 '16 at 17:29
  • 2
    Why cannot we solve the integral with residues methods? Someone may enlighten me about a possible Reside method?? ^^ – Enrico M. Feb 15 '16 at 18:17
  • @KimPeek, we can use residue theorem, but we got to be careful with the arguments. $x$ goes from $0$ to $\frac{\pi}{2}$, hence we need to use only points that are in the first quadrant. – Galc127 Feb 15 '16 at 18:18
  • @MichaelHardy, please notice comments - there was a mistake in second IBP - should be a (-) sign that implies $0=0$. – Galc127 Feb 15 '16 at 18:19
  • @Galc127 Right!! It would be cool to see a computation with residue. I think I'm not able because of that single $x$ term, but I'll try now. Just as a curiosity, not for an answer (I guess the OP doesn't know Complex Analysis yet) – Enrico M. Feb 15 '16 at 18:21
  • @KimPeek the resulting integral after one i.p.b is doable with residue methods...U can use for example the technique shown here: http://math.stackexchange.com/questions/1164183/how-to-evaluate-i-int-0-pi-2-fracx-log-sinx-sinx-dx/1172031#1172031 – tired Feb 15 '16 at 21:10

1 Answers1

3

Let $\displaystyle{I = \int^{\frac{\pi}{2}}_0 x \cot x \, dx}$. Now \begin{align*}I &= \int^{\frac{\pi}{4}}_0 x \cot x \, dx + \int^{\frac{\pi}{2}}_{\frac{\pi}{4}} x \cot x \, dx = \int^{\frac{\pi}{4}}_0 x \cot x \, dx + I_1\end{align*}

For the integral $I_1$, set $x = \frac{\pi}{2} - u, dx = - du$ while for the limits of integration at $x = \frac{\pi}{4}, u = \frac{\pi}{4}$ while at $x = \frac{\pi}{2}, u = 0$. Thus

\begin{align*}I_1 &= - \int^0_{\frac{\pi}{4}} \left (\frac{\pi}{2} - u \right ) \cot \left (\frac{\pi}{2} - u \right ) \, du\\ &= \int^{\frac{\pi}{4}}_0 \left (\frac{\pi}{2} - u \right ) \tan u \, du\\ &= \frac{\pi}{2} \int^{\frac{\pi}{4}}_0 \tan u \, du - \int^{\frac{\pi}{4}}_0 u \tan u \, du\\ &= \frac{\pi}{2} \Big{[}-\ln |\cos u| \Big{]}^{\frac{\pi}{4}}_0 - \int^{\frac{\pi}{4}}_0 u \tan u \, du\\ &= \frac{\pi}{4} \ln 2 - \int^{\frac{\pi}{4}}_0 u \tan u \, du \end{align*}

So for integral $I$ we have \begin{align*}I &= \frac{\pi}{4} \ln 2 + \int^{\frac{\pi}{4}}_0 x \cot x \, dx - \int^{\frac{\pi}{4}}_0 x \tan x \, dx\\ &= \frac{\pi}{4} \ln 2 + \int^{\frac{\pi}{4}}_0 x \left (\cot x - \tan x \right ) \, dx\\ &= \frac{\pi}{4} \ln 2 + \int^{\frac{\pi}{4}}_0 x \left (\frac{\cos x}{\sin x} - \frac{\sin x}{\cos x} \right ) \, dx\\ &= \frac{\pi}{4} \ln 2 + \int^{\frac{\pi}{4}}_0 x \frac{\cos^2 x - \sin^2 x}{\sin x \cos x} \, dx\\ &= \frac{\pi}{4} \ln 2 + \int^{\frac{\pi}{4}}_0 2x \frac{\cos 2x}{\sin 2x} \, dx\\ &= \frac{\pi}{4} \ln 2 + \int^{\frac{\pi}{4}}_0 2x \cot 2x \, dx \end{align*}

For the integral to the right, set $u = 2x, du = 2 dx$ while for the limits of integration, at $x = 0, u = 0$, while at $x = \frac{\pi}{4}, u = \frac{\pi}{2}$. Thus

\begin{align*}I &= \frac{\pi}{4} \ln 2 + \frac{1}{2} \int^{\frac{\pi}{2}}_0 u \cot u \, du\\ &= \frac{\pi}{4} \ln 2 + \frac{1}{2} I\\\Rightarrow \frac{1}{2} I &= \frac{\pi}{4} \ln 2\\\Rightarrow I &= \frac{\pi}{2} \ln 2.\end{align*}

Thus $\displaystyle{\int^{\frac{\pi}{2}}_0 x \cot x \, dx = \frac{\pi}{2} \ln 2}$ as indicated in one of the comments.

omegadot
  • 11,736