TITLE: 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)$
QUESTION [21 upvotes]: 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)$$

REPLY [5 votes]: $\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}
$$