How to compute the integral $\int^{\pi/2}_0\ln(1+\tan\theta)d\theta$? How to compute the integral $\int^{\pi/2}_0\ln(1+\tan\theta)d\theta$. If we let $t=\tan\theta$, then the integral becomes to
$$\int^{\pi/2}_0\ln(1+\tan\theta)d\theta=\int_0^\infty\frac{\ln(1+t)}{1+t^2}dt$$. 
Can we calculate this integral explicitly?
 A: $$\begin{align}\int_0^{\pi/2}  d\theta \, \log{(1+\tan{\theta})} &=\int_0^{\pi/2}  d\theta \, \log{(\sin{\theta}+\cos{\theta})} - \int_0^{\pi/2}  d\theta \, \log{(\cos{\theta})} \\ &= \int_0^{\pi/2}  d\theta \, \log{\left [\sqrt{2}\cos{\left (\theta-\frac{\pi}{4} \right )}\right ]} - \int_0^{\pi/2}  d\theta \, \log{(\cos{\theta})} \\ &= \frac{\pi}{4} \log{2} + \int_0^{\pi/2}  d\theta \, \log{\left [\cos{\left (\theta-\frac{\pi}{4} \right )}\right ]} - \int_0^{\pi/2}  d\theta \, \log{(\cos{\theta})}\\ &=  \frac{\pi}{4} \log{2} + \int_{-\pi/4}^{\pi/4}  d\theta \, \log{\left (\cos{\theta}\right )} - \int_0^{\pi/2}  d\theta \, \log{(\cos{\theta})}\\ &= \frac{\pi}{4} \log{2} + \int_{0}^{\pi/4}  d\theta \, \log{\left (\cos{\theta}\right )} - \int_{\pi/4}^{\pi/2}  d\theta \, \log{(\cos{\theta})} \\ &= \frac{\pi}{4} \log{2} + \int_{0}^{\pi/4}  d\theta \, \log{\left (\cos{\theta}\right )} - \int_{0}^{\pi/4}  d\theta \, \log{\left (\sin{\theta}\right )}\end{align} $$
Now use the Fourier series representations:
$$-\log(\sin(\theta))=\sum_{k=1}^\infty\frac{\cos(2k \theta)}{k}+\log(2)$$
and
$$-\log(\cos(\theta))=\sum_{k=1}^\infty(-1)^k\frac{\cos(2k \theta)}{k}+\log(2)$$
Substituting, exchanging the respective sums and integrals, we get 
$$\begin{align}\int_0^{\pi/2}  d\theta \, \log{(1+\tan{\theta})} &= \frac{\pi}{4} \log{2} + \sum_{k=1}^{\infty} \frac1{2 k^2} \left [1-(-1)^k \right ] \sin{\frac{\pi}{2} k} \\ &= \frac{\pi}{4} \log{2} + \sum_{k=1}^{\infty} \frac{(-1)^k}{(2 k+1)^2} \\ &= \frac{\pi}{4} \log{2} + G\end{align} $$
where $G$ is Catalan's constant.
A: 
$$$$
  Let us start to calculate it.
  \begin{eqnarray}
&&\int_0^{\pi/2}\ln(1+\tan \theta)d\theta \\
&=&\int_0^{\pi/2}\ln(\frac{\sin \theta+\cos \theta}{\cos \theta})d\theta\\
&=&\int_0^{\pi/2}[ \ln(\sqrt{2}\cos (\theta-\pi/4))-\ln (\cos \theta) d\theta ]\\
&=& \frac{\pi}{4}\ln2+\int_0^{\pi/2}\ln(\cos \theta-\pi/4)d\theta-\int_0^{\pi/2}\ln (\cos \theta) d\theta \\
&=&\frac{\pi}{4}\ln2+\int_{-\pi/4}^{\pi/4}\ln\cos (\theta)d\theta-\int_0^{\pi/2}\ln (\cos \theta) d\theta \\
&=&\frac{\pi}{4}\ln2+2\int_{0}^{\pi/4}\ln\cos (\theta)d\theta-\int_0^{\pi/2}\ln (\cos \theta) d\theta \\
&=&\frac{\pi}{4}\ln2+G
\end{eqnarray} 

We know the following integrals: 

$$$$
  \begin{eqnarray}
\int_{0}^{\pi/4}\ln\cos (\theta)d\theta&=&-\frac{\pi}{4}\ln2+\frac{G}{2}\\
\int_{0}^{\pi/2}\ln\cos (\theta)d\theta &=& -\frac{\pi}{2}\ln2\\
\end{eqnarray}
  where $G$ is Catalan constant.

A: Let
$$ I(a)=\int_0^{\pi/2}\ln(1+a\tan x)dx. $$
Then $I(0)=0$ and
\begin{eqnarray}
I'(a)&=&\int_0^{\pi/2}\frac{\tan x}{1+a\tan x}dt\\
&=&\int_0^{\pi/2}\frac{\sin x}{\cos x+a\sin x}dx.
\end{eqnarray}
Let 
$$ A=\int_0^{\pi/2}\frac{\sin x}{\cos x+a\sin x}dx, B=\int_0^{\pi/2}\frac{\cos x}{\cos x+a\sin x}dx. $$
Then it is easy to check
$$ -A+aB=\ln a, B+aA=\frac{\pi}{2}, $$
from which we have
$$ I'(a)=A=\frac{a\pi-2\ln a}{2(1+a^2)}. $$
Noting 
we have
$$ I(1)=\int_0^1\frac{a\pi-2\ln a}{2(1+a^2)}da=\frac{\pi}{4}\ln2+G. $$
