Help with $\int_0^{\frac{\pi}{2}} \frac{x \cos(x)}{\sin^2(x)+1} \; \mathrm{d}x = \frac{1}{2} \sinh^{-1}(1)^2$

\begin{align} \int_0^{\frac{\pi}{2}} \frac{x \cos(x)}{\sin^2(x)+1} \; \mathrm{d}x&\overset{\text{IBP}}=\Big[x\arctan(\sin x)\Big]_0^{\frac{\pi}{2}}-\int_0^{\frac{\pi}{2}}\arctan(\sin x)\,dx\\ &=\frac{\pi^2}{8}-\int_0^{\frac{\pi}{2}}\arctan(\sin x)\,dx\\ &\overset{u=\sqrt{\frac{1-\sin x}{1+\sin x}}}=\frac{\pi^2}{8}-2\int_0^1 \frac{\arctan\left(\frac{1-x^2}{1+x^2}\right)}{1+x^2}\,dx\\ &=\frac{\pi^2}{8}-2\int_0^1\frac{\arctan(1)}{1+x^2}\,dx+2\int_0^1\frac{\arctan(x^2)}{1+x^2}\,dx\\ &=2\int_0^1\frac{\arctan(x^2)}{1+x^2}\,dx\\ \int_0^1 \dfrac{\arctan(x^2)}{1+x^2}dx&=\Big[\arctan x\arctan(x^2)\Big]_0^1-\int_0^1 \dfrac{2x\arctan x}{1+x^4}dx\\ &=\dfrac{\pi^2}{16}-\int_0^1 \dfrac{2x\arctan x}{1+x^4}dx\\ \end{align}

Since,

$\displaystyle \arctan x=\int_0^1 \dfrac{x}{1+t^2x^2}dt$

then,

\begin{align} \displaystyle K&=\int_0^1 \dfrac{2x\arctan x}{1+x^4}dx\\ \displaystyle &=\int_0^1\int_0^1 \dfrac{2x^2}{(1+t^2x^2)(1+x^4)}dtdx\\ \displaystyle &=\int_0^1\int_0^1 \left(\dfrac{2t^2}{(1+t^4)(1+x^4)}+\dfrac{2x^2}{(1+x^4)(1+t^4)}-\dfrac{2t^2}{(1+t^4)(1+t^2x^2}\right)dtdx\\ &=\displaystyle 4\left(\int_0^1 \dfrac{t^2}{1+t^4}dt\right)\left(\int_0^1 \dfrac{1}{1+x^4}dx\right)-K \end{align}

Therefore,

$\displaystyle K=2\left(\int_0^1 \dfrac{x^2}{1+x^4}dx\right)\left(\int_0^1 \dfrac{1}{1+x^4}dx\right)$

Since,

\begin{align}\displaystyle \int_0^1 \dfrac{x^2}{1+x^4}dx&=\frac{1}{2\sqrt{2}}\left[\dfrac{1}{2}\ln\left(\dfrac{x^2-\sqrt{2}x+1}{x^2+\sqrt{2}x+1}\right)+\arctan\left(\sqrt{2}x+1\right)+\arctan\left(\sqrt{2}x-1\right)\right]_0^1\\ &=\dfrac{1}{4\sqrt{2}}\Big(\pi+\ln\left(3-2\sqrt{2}\right)\Big) \end{align}

and,

\begin{align}\displaystyle \int_0^1 \dfrac{1}{1+x^4}dx&=\dfrac{1}{2\sqrt{2}}\left[\dfrac{1}{2}\ln\left(\dfrac{x^2+\sqrt{2}x+1}{x^2-\sqrt{2}x+1}\right)+\arctan\left(\sqrt{2}x+1\right)+\arctan\left(\sqrt{2}x-1\right)\right]_0^1\\ &=\dfrac{1}{4\sqrt{2}}\Big(\pi-\ln\left(3-2\sqrt{2}\right)\Big) \end{align}

Therefore,

$\boxed{K=\displaystyle \dfrac{\pi^2}{16}-\dfrac{1}{16}\Big(\ln\left(3-2\sqrt{2}\right)\Big)^2}$

Since, $\displaystyle 3-2\sqrt{2}=\left(1-\sqrt{2}\right)^2=\frac{1}{\left(1+\sqrt{2}\right)^2}$

Therefore,

$\displaystyle \ln^2\left(3-2\sqrt{2}\right)=4\ln^2\left(1+\sqrt{2}\right)$

Thus,

$\boxed{\displaystyle\int_0^{\frac{\pi}{2}} \frac{x \cos(x)}{\sin^2(x)+1} \; \mathrm{d}x=\dfrac{1}{2}\Big(\ln(1+\sqrt{2})\Big)^2}$


Substitute $t=\sin x$ and then IBPs,

$$\hspace{-1cm} \int_0^{\frac{\pi}{2}} \frac{x \cos x}{\sin^2x+1}dx =\int_0^1\frac{\sin^{-1}t}{1+t^2}dx=\frac{\pi^2}8-I,\>\>\>\> I=\int_0^1\frac{\tan^{-1}t}{\sqrt{1-t^2}}dt \tag1$$

Express $\tan^{-1}t=\int_0^1\frac t{1+y^2t^2}dy$ and use $$\int_0^1\frac {t\>dt}{\sqrt{1-t^2}(1+y^2t^2)}=\frac{\sinh^{-1}y}{y\sqrt{1+y^2}}\tag 2$$ to integrate $I$,

$$\begin{align} \hspace{-8mm} I & \hspace{-3mm} =\int_0^1\hspace{-4mm} \int_0^1\hspace{-3mm} \frac{tdydt }{\sqrt{1-t^2}(1+y^2t^2)} =\int_0^1\frac{\sinh^{-1}y}{y\sqrt{1+y^2}}dy \overset{u=\frac1y}=\int_1^\infty\frac{\text{csch}^{-1}u}{\sqrt{1+u^2}}du \\ & \hspace{-4mm}= \int_1^\infty d(\sinh^{-1}u)\>\text{csch}^{-1}u =\sinh^{-1}u\>\text{csch}^{-1}u|_1^\infty+ \int_1^\infty\frac{\text{sinh}^{-1}u}{u\sqrt{1+u^2}}du \\ & \hspace{-4mm}= -[\sinh^{-1}(1)]^2 + \int_0^\infty\frac{\text{sinh}^{-1}u}{u\sqrt{1+u^2}}du-I \tag3 \\ \end{align}$$ Evaluate the remaining integral with (2)

$$\hspace{-1cm} \int_0^\infty\frac{\text{sinh}^{-1}udu }{u\sqrt{1+u^2}} =\int_0^\infty\hspace{-4mm} \int_0^1\frac {t dtdu}{\sqrt{1-t^2}(1+u^2t^2)} =\frac\pi2 \int_0^1\frac {dt}{\sqrt{1-t^2}}= \frac{\pi^2}4 \\ \tag4 $$

Plug (4) into (3) to obtain $I =\frac{\pi^2}8-\frac12[\sinh^{-1}(1)]^2$. Then, plug it into (1) to obtain $$\int_0^{\frac{\pi}{2}} \frac{x \cos x}{\sin^2x+1}dx = \frac{\pi^2}8-I=\frac12[\sinh^{-1}(1)]^2$$



Define the function $\mathcal{I}:\mathbb{R}_{>0}\rightarrow\mathbb{R}$ via the definite integral

$$\mathcal{I}{\left(a\right)}:=\int_{0}^{\frac{\pi}{2}}\mathrm{d}\varphi\,\frac{a\varphi\cos{\left(\varphi\right)}}{1+a^{2}\sin^{2}{\left(\varphi\right)}}.$$

Obviously, this family of integrals includes the integral inquired after by the OP as the particular case $a=1$, but I thought it would be more interesting to attempt to find a closed-form expression for $\mathcal{I}{(a)}$ for arbitrary parameter $a\in\mathbb{R}_{>0}$.


For our purposes here, the inverse sine and inverse tangent functions may be defined for real arguments via their respective integral representations:

$$\arcsin{\left(z\right)}:=\int_{0}^{z}\mathrm{d}x\,\frac{1}{\sqrt{1-x^{2}}}=\int_{0}^{1}\mathrm{d}t\,\frac{z}{\sqrt{1-z^{2}t^{2}}};~~~\small{z\in\left[-1,1\right]},$$

$$\arctan{\left(z\right)}:=\int_{0}^{z}\mathrm{d}x\,\frac{1}{1+x^{2}}=\int_{0}^{1}\mathrm{d}t\,\frac{z}{1+z^{2}t^{2}};~~~\small{z\in\mathbb{R}}.$$

The inverse sine can be expressed in terms of the inverse tangent through the following relation:

$$\arcsin{\left(z\right)}=\arctan{\left(\frac{z}{\sqrt{1-z^{2}}}\right)};~~~\small{z\in\left(-1,1\right)}.$$

Other functional relations for the inverse tangent that'll be helpful below are the following:

$$\arctan{\left(z\right)}+\arctan{\left(\frac{1}{z}\right)}=\frac{\pi}{2};~~~\small{\in\mathbb{R}_{>0}},$$

$$\arctan{\left(z\right)}+2\arctan{\left(-z+\sqrt{1+z^{2}}\right)}=\frac{\pi}{2};~~~\small{\in\mathbb{R}},$$

$$2\arctan{\left(z\right)}=\arctan{\left(\frac{2z}{1-z^{2}}\right)};~~~\small{z\in\left(-1,1\right)}.$$


Suppose $a\in\mathbb{R}_{>0}$. Then, $0<\left(-a+\sqrt{1+a^{2}}\right)<1<\left(a+\sqrt{1+a^{2}}\right)=\left(\frac{1}{-a+\sqrt{1+a^{2}}}\right)$.

Setting $-a+\sqrt{1+a^{2}}=:p\in\left(0,1\right)$, we obtain

$$\begin{align} \mathcal{I}{\left(a\right)} &=\int_{0}^{\frac{\pi}{2}}\mathrm{d}\varphi\,\frac{a\varphi\cos{\left(\varphi\right)}}{1+a^{2}\sin^{2}{\left(\varphi\right)}}\\ &=\int_{0}^{1}\mathrm{d}x\,\frac{a\arcsin{\left(x\right)}}{1+a^{2}x^{2}};~~~\small{\left[\varphi=\arcsin{\left(x\right)}\right]}\\ &=\int_{0}^{1}\mathrm{d}x\,\frac{a\arctan{\left(\frac{x}{\sqrt{1-x^{2}}}\right)}}{1+a^{2}x^{2}}\\ &=\int_{0}^{\infty}\mathrm{d}y\,\frac{1}{\left(1+y^{2}\right)^{3/2}}\cdot\frac{a\arctan{\left(y\right)}}{1+a^{2}\left(\frac{y}{\sqrt{1+y^{2}}}\right)^{2}};~~~\small{\left[x=\frac{y}{\sqrt{1+y^{2}}}\right]}\\ &=\int_{0}^{\infty}\mathrm{d}y\,\frac{1}{\sqrt{1+y^{2}}}\cdot\frac{a\arctan{\left(y\right)}}{1+\left(1+a^{2}\right)y^{2}}\\ &=\int_{0}^{1}\mathrm{d}t\,\frac{2\left(1+t^{2}\right)}{\left(1-t^{2}\right)^{2}}\cdot\frac{1-t^{2}}{1+t^{2}}\cdot\frac{a\arctan{\left(\frac{2t}{1-t^{2}}\right)}}{1+\left(1+a^{2}\right)\left(\frac{2t}{1-t^{2}}\right)^{2}};~~~\small{\left[\frac{y}{1+\sqrt{1+y^{2}}}=t\right]}\\ &=\int_{0}^{1}\mathrm{d}t\,\frac{4a\left(1-t^{2}\right)\arctan{\left(t\right)}}{\left(1-t^{2}\right)^{2}+4\left(1+a^{2}\right)t^{2}}\\ &=\int_{0}^{1}\mathrm{d}t\,\frac{4a\left(1-t^{2}\right)\arctan{\left(t\right)}}{t^{4}+2\left(1+2a^{2}\right)t^{2}+1}\\ &=\int_{0}^{1}\mathrm{d}t\,\frac{4a\left(1-t^{2}\right)\arctan{\left(t\right)}}{\left(t^{2}+1+2a^{2}\right)^{2}-4a^{2}\left(1+a^{2}\right)}\\ &=\int_{0}^{1}\mathrm{d}t\,\frac{4a\left(1-t^{2}\right)\arctan{\left(t\right)}}{\left(t^{2}+1+2a^{2}+2a\sqrt{1+a^{2}}\right)\left(t^{2}+1+2a^{2}-2a\sqrt{1+a^{2}}\right)}\\ &=\int_{0}^{1}\mathrm{d}t\,\frac{4a\left(1-t^{2}\right)\arctan{\left(t\right)}}{\left[t^{2}+\left(a+\sqrt{1+a^{2}}\right)^{2}\right]\left[t^{2}+\left(-a+\sqrt{1+a^{2}}\right)^{2}\right]}\\ &=\int_{0}^{1}\mathrm{d}t\,\left[-\frac{2\left(a+\sqrt{1+a^{2}}\right)}{t^{2}+\left(a+\sqrt{1+a^{2}}\right)^{2}}+\frac{2\left(-a+\sqrt{1+a^{2}}\right)}{t^{2}+\left(-a+\sqrt{1+a^{2}}\right)^{2}}\right]\arctan{\left(t\right)};~~~\small{P.F.D.}\\ &=\int_{0}^{1}\mathrm{d}t\,\left[\frac{2p}{p^{2}+t^{2}}-\frac{2p}{1+p^{2}t^{2}}\right]\arctan{\left(t\right)}.\\ \end{align}$$

Making use of the symmetry of this last integral under the transformation $t\mapsto\frac{1}{t}$, it is possible reduce $\mathcal{I}$ to an integral over the entire positive real line:

$$\begin{align} \mathcal{I}{\left(a\right)} &=\int_{0}^{1}\mathrm{d}t\,\left[\frac{2p}{p^{2}+t^{2}}-\frac{2p}{1+p^{2}t^{2}}\right]\arctan{\left(t\right)}\\ &=\int_{+\infty}^{1}\mathrm{d}t\,\frac{(-1)}{t^{2}}\left[\frac{2pt}{p^{2}+t^{2}}-\frac{2pt}{1+p^{2}t^{2}}\right]\frac{(-1)t\arctan{\left(\frac{1}{t}\right)}}{1};~~~\small{\left[t\mapsto\frac{1}{t}\right]}\\ &=-\int_{1}^{\infty}\mathrm{d}t\,\left[\frac{2p}{p^{2}+t^{2}}-\frac{2p}{1+p^{2}t^{2}}\right]\arctan{\left(\frac{1}{t}\right)}\\ &=-\int_{1}^{\infty}\mathrm{d}t\,\left[\frac{2p}{p^{2}+t^{2}}-\frac{2p}{1+p^{2}t^{2}}\right]\left[\frac{\pi}{2}-\arctan{\left(t\right)}\right]\\ &=\frac12\int_{0}^{1}\mathrm{d}t\,\left[\frac{2p}{p^{2}+t^{2}}-\frac{2p}{1+p^{2}t^{2}}\right]\arctan{\left(t\right)}\\ &~~~~~-\frac12\int_{1}^{\infty}\mathrm{d}t\,\left[\frac{2p}{p^{2}+t^{2}}-\frac{2p}{1+p^{2}t^{2}}\right]\left[\frac{\pi}{2}-\arctan{\left(t\right)}\right]\\ &=\int_{0}^{1}\mathrm{d}t\,\left[\frac{p}{p^{2}+t^{2}}-\frac{p}{1+p^{2}t^{2}}\right]\arctan{\left(t\right)}\\ &~~~~~+\int_{1}^{\infty}\mathrm{d}t\,\left[\frac{p}{p^{2}+t^{2}}-\frac{p}{1+p^{2}t^{2}}\right]\arctan{\left(t\right)}\\ &~~~~~-\frac{\pi}{2}\int_{1}^{\infty}\mathrm{d}t\,\left[\frac{p}{p^{2}+t^{2}}-\frac{p}{1+p^{2}t^{2}}\right]\\ &=\int_{0}^{\infty}\mathrm{d}t\,\left[\frac{p}{p^{2}+t^{2}}-\frac{p}{1+p^{2}t^{2}}\right]\arctan{\left(t\right)}\\ &~~~~~+\frac{\pi}{2}\int_{1}^{\infty}\mathrm{d}t\,\left[\frac{p}{1+p^{2}t^{2}}-\frac{p}{p^{2}+t^{2}}\right]\\ &=-\int_{0}^{\infty}\mathrm{d}t\,\left[\frac{p}{1+p^{2}t^{2}}-\frac{p}{p^{2}+t^{2}}\right]\arctan{\left(t\right)}\\ &~~~~~+\frac{\pi}{2}\left[\int_{1}^{\infty}\mathrm{d}t\,\frac{p}{1+p^{2}t^{2}}-\int_{1}^{\infty}\mathrm{d}t\,\frac{p}{p^{2}+t^{2}}\right]\\ &=-\int_{0}^{\infty}\mathrm{d}t\,\left[\frac{p}{1+p^{2}t^{2}}-\frac{p}{p^{2}+t^{2}}\right]\arctan{\left(t\right)}\\ &~~~~~+\frac{\pi}{2}\left[\int_{1}^{\infty}\mathrm{d}t\,\frac{p}{1+p^{2}t^{2}}-\int_{0}^{1}\mathrm{d}u\,\frac{p}{1+p^{2}u^{2}}\right];~~~\small{\left[t=u^{-1}\right]}\\ &=-\int_{0}^{\infty}\mathrm{d}t\,\left[\frac{p}{1+p^{2}t^{2}}-\frac{p}{p^{2}+t^{2}}\right]\arctan{\left(t\right)}\\ &~~~~~+\frac{\pi}{2}\left[\int_{0}^{\infty}\mathrm{d}t\,\frac{p}{1+p^{2}t^{2}}-2\int_{0}^{1}\mathrm{d}u\,\frac{p}{1+p^{2}u^{2}}\right]\\ &=-\int_{0}^{\infty}\mathrm{d}t\,\left[\frac{p}{1+p^{2}t^{2}}-\frac{p}{p^{2}+t^{2}}\right]\arctan{\left(t\right)}+\frac{\pi}{2}\left[\frac{\pi}{2}-2\arctan{\left(p\right)}\right]\\ &=\frac{\pi^{2}}{4}-\pi\arctan{\left(p\right)}-\int_{0}^{\infty}\mathrm{d}t\,\frac{p\arctan{\left(t\right)}}{1+p^{2}t^{2}}+\int_{0}^{\infty}\mathrm{d}t\,\frac{p\arctan{\left(t\right)}}{p^{2}+t^{2}}\\ &=\frac{\pi^{2}}{4}-\pi\arctan{\left(p\right)}-\int_{0}^{\infty}\mathrm{d}t\,\frac{p\arctan{\left(t\right)}}{1+p^{2}t^{2}}\\ &~~~~~+\int_{0}^{\infty}\mathrm{d}t\,\frac{p\arctan{\left(\frac{1}{t}\right)}}{1+p^{2}t^{2}};~~~\small{\left[t\mapsto\frac{1}{t}\right]}\\ &=\frac{\pi^{2}}{4}-\pi\arctan{\left(p\right)}-\int_{0}^{\infty}\mathrm{d}t\,\frac{p\arctan{\left(t\right)}}{1+p^{2}t^{2}}+\int_{0}^{\infty}\mathrm{d}t\,\frac{p\left[\frac{\pi}{2}-\arctan{\left(t\right)}\right]}{1+p^{2}t^{2}}\\ &=\frac{\pi^{2}}{4}-\pi\arctan{\left(p\right)}-2\int_{0}^{\infty}\mathrm{d}t\,\frac{p\arctan{\left(t\right)}}{1+p^{2}t^{2}}+\frac{\pi}{2}\int_{0}^{\infty}\mathrm{d}t\,\frac{p}{1+p^{2}t^{2}}\\ &=\frac{\pi^{2}}{2}-\pi\arctan{\left(p\right)}-2\int_{0}^{\infty}\mathrm{d}t\,\frac{p\arctan{\left(t\right)}}{1+p^{2}t^{2}}\\ &=\frac{\pi^{2}}{2}-\pi\arctan{\left(p\right)}-2\left[\frac{\pi^{2}}{4}-\int_{0}^{\infty}\mathrm{d}t\,\frac{\arctan{\left(pt\right)}}{1+t^{2}}\right];~~~\small{I.B.P.s}\\ &=-\pi\arctan{\left(p\right)}+2\int_{0}^{\infty}\mathrm{d}t\,\frac{\arctan{\left(pt\right)}}{1+t^{2}}\\ &=-\frac{\pi^{2}}{4}+\frac{\pi}{2}\arctan{\left(a\right)}+\int_{0}^{\infty}\mathrm{d}t\,\frac{2\arctan{\left(pt\right)}}{1+t^{2}}.\\ \end{align}$$

The remaining integral has a relatively straightforward evaluation in terms of the Legendre chi function:

$$\begin{align} \int_{0}^{\infty}\mathrm{d}x\,\frac{2\arctan{\left(px\right)}}{1+x^{2}} &=\int_{0}^{\infty}\mathrm{d}x\,\frac{2}{1+x^{2}}\int_{0}^{1}\mathrm{d}t\,\frac{px}{1+p^{2}x^{2}t^{2}}\\ &=\int_{0}^{\infty}\mathrm{d}x\int_{0}^{1}\mathrm{d}t\,\frac{2px}{\left(1+p^{2}t^{2}x^{2}\right)\left(1+x^{2}\right)}\\ &=\int_{0}^{1}\mathrm{d}t\int_{0}^{\infty}\mathrm{d}x\,\frac{2px}{\left(1+p^{2}t^{2}x^{2}\right)\left(1+x^{2}\right)}\\ &=\int_{0}^{1}\mathrm{d}t\,p\int_{0}^{\infty}\mathrm{d}u\,\frac{1}{\left(1+p^{2}t^{2}u\right)\left(1+u\right)};~~~\small{\left[x^{2}=u\right]}\\ &=\int_{0}^{p}\mathrm{d}t\int_{0}^{\infty}\mathrm{d}u\,\frac{1}{\left(1+t^{2}u\right)\left(1+u\right)};~~~\small{\left[t\mapsto p^{-1}t\right]}\\ &=\int_{0}^{p}\mathrm{d}t\,\frac{\ln{\left(t^{2}\right)}}{t^{2}-1}\\ &=\int_{0}^{p}\mathrm{d}t\,\frac{2\ln{\left(\frac{1}{t}\right)}}{1-t^{2}}\\ &=\int_{\frac{1-p}{1+p}}^{1}\mathrm{d}x\,\frac{\ln{\left(\frac{1+x}{1-x}\right)}}{x};~~~\small{\left[t=\frac{1-x}{1+x}\right]}\\ &=2\int_{\frac{1-p}{1+p}}^{1}\mathrm{d}x\,\frac{\operatorname{artanh}{\left(x\right)}}{x}\\ &=2\left[\chi_{2}{\left(1\right)}-\chi_{2}{\left(\frac{1-p}{1+p}\right)}\right]\\ &=\frac{\pi^{2}}{4}-2\chi_{2}{\left(\frac{1-p}{1+p}\right)}\\ &=\frac{\pi^{2}}{4}-2\chi_{2}{\left(\frac{\sqrt{1+a^{2}}-1}{a}\right)}.\\ \end{align}$$

Thus,

$$\begin{align} \mathcal{I}{\left(a\right)} &=\frac{\pi}{2}\arctan{\left(a\right)}-2\chi_{2}{\left(\frac{\sqrt{1+a^{2}}-1}{a}\right)}.\\ \end{align}$$

In particular,

$$\mathcal{I}{\left(1\right)}=\frac{\pi^{2}}{8}-2\chi_{2}{\left(\sqrt{2}-1\right)}.$$

Now, the Legendre chi function satisfies the following functional relation (ref. here):

$$\chi_{2}{\left(z\right)}+\chi_{2}{\left(\frac{1-z}{1+z}\right)}=\frac{\pi^{2}}{8}-\frac12\ln{\left(z\right)}\ln{\left(\frac{1-z}{1+z}\right)};~~~\small{z\in\left(0,1\right)}.$$

Since $z=\sqrt{2}-1$ satisfies the equation $\frac{1-z}{1+z}=z$, we have the following special value for the Legendre chi function:

$$2\chi_{2}{\left(\sqrt{2}-1\right)}=\frac{\pi^{2}}{8}-\frac12\ln^{2}{\left(\sqrt{2}-1\right)}=\frac{\pi^{2}}{8}-\frac12\ln^{2}{\left(1+\sqrt{2}\right)}.$$

Hence,

$$\mathcal{I}{\left(1\right)}=\frac12\ln^{2}{\left(1+\sqrt{2}\right)}.\blacksquare$$


Tags:

Integration