# Evaluate $\int_{0}^{\frac{\pi}{4}} \ln(\sec x)dx$

Evaluate $$P=\int_{0}^{\frac{\pi}{4}} \ln(\sec x)dx$$

My try: I tried using its complimentary integral:

Let $$Q=\int_{0}^{\frac{\pi}{4}} \ln(\csc x)dx$$

$$P+Q=\int_{0}^{\frac{\pi}{4}}\ln(\sec x\csc x)dx$$ $$\implies$$

$$2P+2Q=\int_{0}^{\frac{\pi}{4}}\ln(\sec^2 x\csc^2 x)dx=\int_{0}^{\frac{\pi}{4}}\ln\left(\frac{4}{4\sin^2 x\cos^2 x}\right)dx$$ $$\implies$$

$$2P+2Q=\frac{\pi}{4}\ln 4-\int_{0}^{\frac{\pi}{4}}\ln\left(\sin^2 2x\right)dx$$

$$2P+2Q=\frac{\pi}{2}\ln 2-2 \int_{0}^{\frac{\pi}{4}}\ln(\sin 2x)dx$$

Using the substitution $$2x=t$$ we get

$$2P+2Q=\frac{\pi}{2}\ln 2- \int_{0}^{\frac{\pi}{2}}\ln(\sin t)dt$$

Using the formula:

$$\int_{0}^{\frac{\pi}{2}}\ln(\sin t)dt=\frac{-\pi}{2}\ln 2$$ we get

$$2P+2Q=\pi \ln 2$$

$$P+Q=\frac{\pi}{2}\ln 2$$

Is there any way to find $$P-Q$$

In fact $$\begin{eqnarray*} P-Q&=&\int_0^{\frac{\pi}{4}}\ln(\tan t)dt\\ &=&\int_0^1\frac{\ln u}{1+u^2}du\\ &=&\int_0^1\ln u\sum_{n=0}^\infty(-1)^nu^{2n}du\\ &=&\sum_{n=0}^\infty(-1)^n\int_0^1u^{2n}\ln udu\\ &=&-\sum_{n=0}^\infty(-1)^n\frac{1}{(2n+1)^2}\\ &=&-C \end{eqnarray*}$$ where $$C$$ is the Catalan constant.
Through the properties of the logarithm, the integral can be rewritten as$$\mathfrak{I}=-\int\limits_0^{\pi/4}\mathrm dx\,\log\cos x$$Now use the Fourier expansion for $$\log\cos x$$ which is
$$\log\cos x=\sum\limits_{n\geq1}\frac {(-1)^{n-1}\cos 2nx}{n}-\log 2$$
Now integrate each time termwise to get that\begin{align*}\mathfrak{I} & =\frac {\pi}4\log 2+\sum\limits_{n\geq1}\frac {(-1)^n}{n}\int\limits_0^{\pi/4}\mathrm dx\,\cos 2nx\\ & =\frac {\pi}4\log 2+\frac 12\sum\limits_{n\geq1}\frac {(-1)^n}{n^2}\sin\left(\frac {\pi n}2\right)\\ & =\frac {\pi}4\log 2-\frac 12G\end{align*}where $$G$$ is Catalan’s constant.
\begin{aligned} \int_0^{\frac{\pi}{4}} \ln (\cos x) d x&=\int_0^{\frac{\pi}{4}} \ln \left(\frac{e^{x i}+e^{-x i}}{2}\right) \\ & =\int_0^{\frac{\pi}{4}} \ln \left[e^{x i}\left(1+e^{-2 x i}\right)\right] d x-\frac{\pi}{4} \ln 2 \\ & =\Re \int_0^{\frac{\pi}{4}} \ln \left(1+e^{-2 x i}\right) d x-\frac{\pi}{4} \ln 2 \\ & =\Re\left(-\frac{1}{2 i}\left[\operatorname{Li_2} \left(-e^{-2 x i}\right)\right]_0^{\frac\pi 4}\right)-\frac{\pi}{4} \ln 2 \\ & =\Re\left(-\frac{1}{2 i} \operatorname{Li_2}(-i)\right)-\frac{\pi}{4} \ln 2 \\ & =\Re\left(\frac{1}{-2 i}\left(-\frac{\pi^2}{48}-i G\right)\right)-\frac{\pi}{4} \ln 2\\ & =\frac{G}{2}-\frac{\pi}{4} \ln 2 \\ & \end{aligned} $$\boxed{\int_0^{\frac{\pi}{4}} \ln (\sec x) d x=\frac{\pi}{4} \ln 2-\frac{G}{2}}$$