# is this trig integral doable using contour integration?.

Is it possible to evaluate $\displaystyle \int_{0}^{\pi}\frac{x\cos(x)}{1+\sin^{2}(x)}dx=\frac{-{\pi}^{2}}{4}+ln^{2}(\sqrt{2}-1)$ by using residues?.

I attempted it by considering $\displaystyle \oint_{C}\frac{2log(z)(z^{2}+1)}{(z^{2}-2z-1)(z^{2}+2z-1)}dz$

This came about by rewriting it as $\displaystyle\int_{0}^{\pi}\frac{2x\cos(x)}{3-\cos(2x)}dx$ and making the sub $\cos(z)=\frac{1}{2}\left(z+z^{-1}\right), \;\ \cos(2z)=\frac{1}{2}\left(z^{2}-z^{-2}\right)$

The poles are then at $\displaystyle\sqrt{2}+1, \;\ -\sqrt{2}+1, \;\ -\sqrt{2}-1, \;\ \sqrt{2}-1$

I considered a semi-circular contour, but I do not think these subs will give a closed contour. So maybe integrate along the real axis form -1 to 1?.

The only poles that are in the contour are then $\displaystyle-\sqrt{2}+1, \;\ \sqrt{2}-1$

Since the poles are on the contour, then multiply the sum of the residues by $\pi i$ instead of the usual $2\pi i$.

Anyway, for $\displaystyle Res(z=\sqrt{2}-1)$, I got $-\frac{1}{2}\ln(\sqrt{2}-1)$.

And for $\displaystyle Res(z=-\sqrt{2}+1)$,

I got $\frac{1}{2}\ln(\sqrt{2}-1)-\frac{\pi i}{2}$.

Summing results in the log terms cancelling and all that remains is $-\frac{\pi i}{2}$

So, $\displaystyle \pi i\left(-\frac{\pi i}{2}\right) = \frac{{\pi}^{2}}{2}$

Now, I am rather stuck as to how to continue. How about a branch cut because of the log in the numerator?. The results look encouraging because they are beginning to resemble the required result, but that may mean nothing. I may be full of it on all of this.

Does anyone have a clever idea as to evaluate this one using residues?. Is it even possible using residues?. Ron Gordon?. :)

Take care everyone.

• I don't see how residues will help here. The favor of $x$ gums up the works. You can integrate by parts and get $$\int \arctan{\sin{x}} dx$$ but that doesn't help matters much. You really need a rational function just of sines and cosines. – Ron Gordon May 5 '13 at 1:16
• actually, random variable has a clever solution to the arctan(sin(x)) you just mentioned. Thanks, Ron. I was just wondering if it was doable or not using residues. – Cody May 5 '13 at 8:22


\begin{align}&\color{#c00000}{\int_{0}^{\pi}% {x\cos\pars{x} \over 1 + \sin^{2}\pars{x}}\,\dd x} =\Im\int_{0}^{\pi}{x\cos\pars{x} \over \sin\pars{x} - \ic}\,\dd x \\[3mm]&=\Im\bracks{\left.\vphantom{\large A}% \ln\pars{\sin\pars{x} - \ic}x\,\right\vert_{\,0}^{\,\pi} -\int_{0}^{\pi}\ln\pars{\sin\pars{x} - \ic}\,\dd x} \\[3mm]&=-\,{\pi^{2} \over 2} -\Im\int_{0}^{\pi}\ln\pars{\sin\pars{x} - \ic}\,\dd x \end{align}

$$\color{#c00000}{\int_{0}^{\pi}% {x\cos\pars{x} \over 1 + \sin^{2}\pars{x}}\,\dd x} =-\,{\pi^{2} \over 2} -2\ \color{#00f}{\Im\int_{0}^{\pi/2}\ln\pars{\cos\pars{x} - \ic}\,\dd x}\tag{1}$$

Now, we'll evaluate the "$\color{#00f}{\ds{blue\ expression}}$": \begin{align}&\color{#00f}{\Im\int_{0}^{\pi/2}\ln\pars{\cos\pars{x} - \ic}\,\dd x} =\Im \int_{\verts{z}\ =\ 1\atop{\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}} \ln\pars{{z^{2} + 1 \over 2z} - \ic}\,{\dd z \over \ic z} \\[3mm]&=-\Re \int_{\verts{z}\ =\ 1\atop{\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}} {\ln\pars{z^{2} - 2\ic z + 1} \over z}\,\dd z\ +\ \underbrace{\Re \int_{\verts{z}\ =\ 1\atop{\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}}{\ln\pars{2z} \over z}\,\dd z}_{\ds{=\ -\,{\pi^{2} \over 8}}} \\[3mm]&=-\,{\pi^{2} \over 8} - \Re \int_{\verts{z}\ =\ 1\atop{\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}} {\ln\pars{z^{2} - 2\ic z + 1} \over z}\,\dd z \end{align}

Replacing in $\pars{1}$: $$\color{#c00000}{\int_{0}^{\pi}% {x\cos\pars{x} \over 1 + \sin^{2}\pars{x}}\,\dd x} =-\,{\pi^{2} \over 4} + 2\,\Re \int_{\verts{z}\ =\ 1\atop{\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}} {\ln\pars{z^{2} - 2\ic z + 1} \over z}\,\dd z$$

The RHS second term becomes: \begin{align}&2\,\Re \int_{\verts{z}\ =\ 1\atop{\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}} {\ln\pars{z^{2} - 2\ic z + 1} \over z}\,\dd z \\[3mm]&=-2\Re\int_{1}^{0}{\ln\pars{-y^{2} + 2y + 1} \over \ic y}\,\ic\,\dd y -2\,\Re \int_{0}^{1}{\ln\pars{x^{2} - 2\ic x + 1} \over x}\,\,\dd x \\[3mm]&=2\int_{0}^{1}{\ln\pars{-\bracks{x + r}\bracks{x - 1/r}} \over x}\,\dd x -2\,\Re\int_{0}^{1}{\ln\pars{\bracks{x + r\ic}\bracks{x - \ic/r}} \over x}\,\dd x \end{align} where $\ds{r \equiv \root{2} - 1}$.

Then, \begin{align}&2\,\Re \int_{\verts{z}\ =\ 1\atop{\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}} {\ln\pars{z^{2} - 2\ic z + 1} \over z}\,\dd z \\[3mm]&=2\int_{0}^{1}{\ln\pars{1 + x/r} \over x}\,\dd x +2\int_{0}^{1}{\ln\pars{1 - rx} \over x}\,\dd x -2\int_{0}^{1}{\Re\ln\pars{\ic + x/r} \over x}\,\dd x \\[3mm]&\phantom{=}-2\int_{0}^{1}{\Re\ln\pars{rx - \ic} \over x}\,\dd x \end{align} Those integrals can be trivially evaluated in terms of the DiLogarithm function $\ds{{\rm Li}_{2}\pars{z}}$.

$$\color{#66f}{\large\int_{0}^{\pi}% {x\cos\pars{x} \over 1 + \sin^{2}\pars{x}}\,\dd x ={\rm Li}_{2}\pars{3 - 2\root{2}} - 4{\rm Li}_{2}\pars{\root{2} - 1}} \approx {\tt -1.6905}$$

• Thanks very much, Felix. Heck, I had forgotten all about this one. But, nonetheless, a solution is always appreciated. It would appear you used a quarter unit circle in the first quadrant as the contour?. Cool. – Cody Aug 2 '14 at 14:11
• @Cody Thanks. I still have to move from the ${\rm Li}_{2}$ to the $\ln^2$ when I get a little time. Yes, it's in the first quadrant. The indented points doesn't yield any contribution to the integral. – Felix Marin Aug 2 '14 at 17:16
• Yeah, there are oodles of these polylog identities. The identities that may be helpful in showing your dilog solution is equal to the solution in terms of ln and squares pi are: $Li_{2}(x)-Li_{2}(-x)+Li_{2}(\frac{1-x}{1+x})- Li_{2}(-\frac{1-x}{1+x})=\ln(\frac{1+x}{1-x})\ln(x)+\frac{\pi^{2}}{4}$ and $Li_{2}(x^{2})=2Li_{2}(x)+2Li_{2}(-x)$ – Cody Aug 3 '14 at 18:57

yes, I think you can see sos440 blog have nice solution,:http://sos440.tistory.com/83

• It would help to add more details in case the link goes away and a future person is also looking for an answer. Regards – Amzoti May 4 '13 at 17:12
• Thanks for the response math110. But, sos's solution, though clever and very nice, does not use residues. Residue methods is what I am wondering about. – Cody May 4 '13 at 18:58