Definite Integral $\int_0^{\pi/2} \frac{\log(\cos x)}{x^2+\log^2(\cos x)}dx = \frac{\pi}{2}\left(1-\frac{1}{\log 2}\right)$
I want to prove that
$$\int_0^{\pi/2} \frac{\log(\cos x)}{x^2+\log^2(\cos x)}dx = \frac{\pi}{2}\left(1-\frac{1}{\log 2}\right)$$
Solution 1:
Note that for $|x| < \frac{\pi}{2}$, we have
$$ \frac{\log\cos x}{\log^2 \cos x + x^2} = \Re \frac{1}{\log\left( \frac{1+e^{2ix}}{2} \right)}. $$
Thus if $I$ denotes the given integral, we have
\begin{align*} I &= \frac{1}{2}\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \Re \frac{1}{\log\left( \frac{1+e^{2ix}}{2} \right)} \, dx \\ &= \frac{1}{4} \mathrm{PV}\int_{-\pi}^{\pi} \Re \frac{1}{\log\left( \frac{1+e^{ix}}{2} \right)} \, dx \\ &= \frac{1}{4} \Re \mathrm{PV}\int_{-\pi}^{\pi} \frac{1}{\log\left( \frac{1+e^{ix}}{2} \right)} \, dx. \end{align*}
Now let $C_{\epsilon}$ be the counter-clockwised contour consisting of the circle of radius 1 centered at the origin, with two semicircular indents $\gamma_{1,\epsilon}$ around $1$ and $\gamma_{2,\epsilon}$ around $-1$ as follows:
By writing
\begin{align*} I = \frac{1}{4} \Re \lim_{\delta\to0^{+}}\left( \int_{-\pi+\delta}^{-\delta} + \int_{\delta}^{\pi-\delta} \right) \frac{1}{\log\left( \frac{1+e^{ix}}{2} \right)} \, dx \end{align*}
and plugging the substitution $z = e^{ix}$, we observe that
\begin{align*} I = \frac{1}{4} \Im \lim_{\epsilon\to 0^{+}}\left(\oint_{C_{\epsilon}} - \int_{\gamma_{1,\epsilon}} - \int_{\gamma_{2,\epsilon}} \right) \frac{dz}{z \log\left(\frac{1+z}{2}\right)} \end{align*}
Let
\begin{align*} f(z) = \frac{1}{z \log\left(\frac{1+z}{2}\right)}. \end{align*}
It is plain from the logarithmic singularity that
\begin{align*} \lim_{\epsilon \to 0^{+}} \int_{\gamma_{2,\epsilon}} f(z) \, dz = 0. \end{align*}
Also it follows that
\begin{align*} \lim_{\epsilon\to 0^{+}} \oint_{C_{\epsilon}} f(z) \, dz &= 2\pi i \operatorname{Res}_{z=0} f(z) = -\frac{2\pi i}{\log 2}, \\ \lim_{\epsilon\to 0^{+}} \int_{\gamma_{1,\epsilon}} f(z) \, dz &= -\pi i \operatorname{Res}_{z=1} f(z) = -2\pi i. \end{align*}
Therefore we have
\begin{align*} I &= \frac{1}{4} \Im \left( 2\pi i - \frac{2\pi i}{\log 2} \right) = \frac{\pi}{2} \left( 1 - \frac{1}{\log 2} \right). \end{align*}
Solution 2:
Consider $$f(z) = \frac{1}{\log(1-iz)} \frac{1}{1+z^{2}}$$ where the branch cut for $\log (1-iz)$ runs down the imaginary axis from $z=-i$.
Then integrate around a contour that consists of the line segment $[-R,R]$ and the upper half of the circle $|z|=R$, and is indented around the simple pole at the origin.
Since $ z f(z) ->0 $ uniformly as $R \to \infty$, $\displaystyle \int f(z) \ dz$ vanishes along the upper half of $|z|=R$ as $ R \to \infty$.
So we have
$$ \begin{align} \text{PV} \int_{-\infty}^{\infty} \frac{1}{\log(1-ix)} \frac{dx}{1+x^{2}} &= \text{PV} \int_{-\infty}^{\infty} \frac{1}{\frac{1}{2}\log(1+x^{2}) - i\arctan x} \frac{dx}{1+x^{2}} \\ &= \text{PV} \int_{-\infty}^{\infty}\frac{\frac{1}{2} \log(1+x^{2})+ i \arctan x }{\frac{1}{4} \log^{2}(1+x^{2})+ \arctan^{2} x} \frac{dx}{1+x^{2}} \\ &= 2 \pi i \ \text{Res}[f(z), i] + \pi i \ \text{Res}[f(z),0] \\ &= 2 \pi i \left(\frac{1}{2i \log 2} \right) + \pi i \left( -\frac{1}{i} \right) \\ &= \pi \left( \frac{1}{\log 2} - 1\right). \end{align}$$
Equating the real parts on both sides of the equation,
$$ \int_{-\infty}^{\infty} \frac{\frac{1}{2} \log(1+x^{2})}{\frac{1}{4} \log^{2}(1+x^{2}) + \arctan^{2} x} \frac{dx}{1+x^{2}} = \pi \left(\frac{1}{\log 2} -1 \right). $$
Now let $x= \tan u$.
Then
$$ \begin{align} \int_{-\pi /2}^{\pi /2} \frac{\frac{1}{2} \log(\sec^{2}u)}{\frac{1}{4} \log^{2}(\sec^{2}u) + u^{2}} du &= \int_{-\pi/2}^{\pi /2} \frac{\log (\sec u)}{\log^{2}(\sec u)+u^{2}} \ du \\ &= - \int_{-\pi/2}^{\pi/2} \frac{\log(\cos u)}{\log^{2}(\sec u) + u^{2}} \ du \\ &= \pi \left(\frac{1}{\log 2} -1 \right) \end{align}$$
which implies
$$ \int_{0}^{\pi/2} \frac{\log(\cos u)}{u^{2} + \log^{2}(\cos u)} \ du = \frac{\pi}{2} \left(1- \frac{1}{\log 2} \right).$$
Solution 3:
$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$ $\ds{\int_{0}^{\pi/2}{\ln\pars{\cos x} \over x^{2} + \ln^{2}\pars{\cos\pars{x}}} \,\dd x = {\pi \over 2}\,\bracks{1 - {1 \over \ln\pars{2}}}}$
${\sf\mbox{The integration can be performed without "leaving" the first quadrant !!!}}$.
We close the arc $\ds{\braces{z = \expo{\ic\theta}\ \mid\ 0 < \theta < {\pi \over 2}}}$ with the 'segments' $\ds{\braces{z=y\ic\ \mid\ y \in \pars{0,1}}}$ and $\ds{\braces{z=x \mid\ x \in \pars{0,1}}}$. The contour is properly indented as explained below.
\begin{align} &\color{#c00000}{% \int_{0}^{\pi/2}{\ln\pars{\cos x} \over x^{2} + \ln^{2}\pars{\cos\pars{x}}}\,\dd x} =\Re\int_{0}^{\pi/2}{\dd x \over \ln\pars{\cos\pars{x}} + x\ic} \\[3mm]&=\Re \int_{\verts{z}\ =\ 1 \atop {\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}} {1 \over \ln\pars{\bracks{z^{2} + 1}/\bracks{2z}} + \ln\pars{z}} \,{\dd z \over \ic z} \\[3mm]&=\Im \int_{\verts{z}\ =\ 1 \atop {\vphantom{\Huge A}0\ <\ {\rm Arg}\pars{z}\ <\ \pi/2}} {1 \over \ln\pars{\bracks{z^{2} + 1}/2}}\,{\dd z \over z} \\[3mm]&=\Im\left\lbrack\left.% -\int_{0}^{-\pi/2}{1 \over \ln\pars{\bracks{z^{2} + 1}/2}}\,{\dd z \over z} \right\vert_{z\ =\ \ic\ +\ \epsilon\expo{\ic\theta}} -\int_{1 - \epsilon}^{\epsilon}{1 \over \ln\pars{\bracks{-y^{2} + 1}/2}} \,{\ic\,\dd y \over \ic y} \right. \\[3mm]&\phantom{=\Im\left\lbrack a\right.}\color{#00f}{\left. -\int_{\pi/2}^{0}{1 \over \ln\pars{\bracks{z^{2} + 1}/2}}\,{\dd z \over z} \right\vert_{z\ =\ \epsilon\expo{\ic\theta}}} -\int_{\epsilon}^{1 - \epsilon}{1 \over \ln\pars{\bracks{x^{2} + 1}/2}} \,{\dd x \over x} \\[3mm]&\phantom{=\left\lbrack a\right.}\left.\color{#00f}{\left.-\int_{\pi}^{\pi/2} {1 \over \ln\pars{\bracks{z^{2} + 1}/2}}\,{\dd z \over z}\right\vert_{z\ =\ 1\ +\ \epsilon\expo{\ic\theta}}}\right\rbrack \end{align} The above integration is evaluated along the first quadrant, as explained above, and it's $\ds{"\epsilon\mbox{-indented}"}$ around $\ds{z = \ic, 0\ \mbox{and}\ 1}$. In the $\ds{\epsilon \to 0^{+}}$ limit, the contribution to the final result arises from the $\ds{\color{#00f}{\mbox{above blue terms}}}$
\begin{align} &\color{#c00000}{% \int_{0}^{\pi/2}{\ln\pars{\cos x} \over x^{2} + \ln^{2}\pars{\cos\pars{x}}}\,\dd x} \\[3mm]&=\lim_{\epsilon \to 0^{+}}\bracks{\left.% -\pars{-\,{\pi \over 2}}\,{1 \over \ln\pars{\bracks{z^{2} + 1}/2}} \right\vert_{z\ =\ \epsilon\expo{\ic\theta}} -\int_{\pi}^{\pi/2}{\epsilon\expo{\ic\theta}\,\dd\theta \over \ln\pars{1 + \epsilon\expo{\ic\theta} + \epsilon^{2}\expo{2\ic\theta}/2}}} \\[3mm]&=-\,{\pi \over 2}\,{1 \over \ln\pars{2}} + {\pi \over 2} \end{align}
$$\color{#66f}{\large% \int_{0}^{\pi/2}{\ln\pars{\cos x} \over x^{2} + \ln^{2}\pars{\cos\pars{x}}} \,\dd x = {\pi \over 2}\,\bracks{1 - {1 \over \ln\pars{2}}}} \approx {\tt -0.6953} $$