How many ways to deal with the integral $\int_{0}^{\frac{\pi}{4}} \ln (\tan x) d x$ and $\int_{0}^{\frac{\pi}{4}} \ln (\sin x) d x$?
After finding that $\displaystyle \int_{0}^{\frac{\pi}{2}} \ln (\tan x) d x =0$ in my post, I was curious about the value of the integral with different upper limit $\dfrac{\pi}{4} $.
The answer is surprisingly simple and elegant i.e.
$$ \int_{0}^{\frac{\pi}{4}} \ln (\tan x) d x=-G \text {, } $$
where $G$ is the Catalan’s constant.
We first let $y=\tan x$, then $d y=\sec ^{2} x d x=\left(1+y^{2}\right) d x$ and $I$ is converted to $$ I=\int_{0}^{1} \frac{\ln y}{1+y^{2}} d y. $$
Applying a power series yields $$ \begin{aligned} I &=\sum_{n=0}^{\infty}(-1)^{n} \int_{0}^{1} y^{2 n} \ln y d y \\ &=\sum_{n=0}^{\infty} \frac{(-1)^{n}}{2 n+1} \int_{0}^{1} \ln y d\left(y^{2 n+1}\right) \\ &\left.=\sum_{n=0}^{\infty} \frac{(-1)^{n}}{2 n+1}\left(\left[y^{2 n+1} \ln y\right]_{0}^{1}-\int_{0}^{1} y^{2 n+1} \cdot \frac{1}{y} d y\right)\right) \\ &=\sum_{n=0}^{\infty} \frac{(-1)^{n}}{2 n+1}\left(-\int_{0}^{1} y^{2 n} d y\right) \\ &=-\sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2 n+1)^{2}} \\ &=-G. \end{aligned} $$ where $G$ is the Catalan’s constant.
For the second integral in the question, we use the identity $$ \ln (\sin x)=\ln (\tan x)+\ln (\cos x), $$
we have $$\int_{0}^{\frac{\pi}{4}} \ln (\sin x) d x=\int_{0}^{\frac{\pi}{4}} \ln (\tan x) d x+ +\int_{0}^{\frac{\pi}{4}} \ln (\cos x) d x$$
By my post in Quora, $$\int_{0}^{\frac{\pi}{4}} \ln (\cos x) d x=\frac{G}{2}-\frac{\pi}{4} \ln 2.$$
Now we conclude that $$ \int_{0}^{\frac{\pi}{4}} \ln (\sin x) d x=-G+\left(\frac{G}{2}-\frac{\pi}{4} \ln 2\right)=-\frac{G}{2}-\frac{\pi}{4} \ln 2 $$
:|D Wish you enjoy the solution!
Is there any other simpler method to deal with the integral?
We can also find the integrals using the Fourier series of $\ln (\sin x)$ on $(0, \pi)$, $$ \ln (\sin x)=-\ln 2-\sum_{n=1}^{\infty} \frac{1}{n} \cos (2 n x) \quad \forall x \in(0, \pi). $$
Integrating both sides from $0$ to $\dfrac{\pi}{4} $ yields
$$ \begin{aligned} \int_{0}^{\frac{\pi}{4}} \ln (\sin x) d x &=-\int_{0}^{\frac{\pi}{4}} \ln 2 d x-\sum_{x=1}^{\infty} \frac{1}{n} \int_{0}^{\frac{\pi}{4}} \cos (2 n x) d x \\ &=-\frac{\pi}{4} \ln 2-\sum_{n=1}^{\infty} \frac{1}{n}\left[\frac{\sin 2 n x}{2 n}\right]_{0}^{\frac{\pi}{4}} \\ &=-\frac{\pi}{4} \ln 2-\frac{1}{2} \sum_{n=1}^{\infty} \frac{1}{n^{2}} \sin \left(\frac{n \pi}{2}\right) \\ &=-\frac{\pi}{4} \ln 2-\frac{1}{2} \sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2 n+1)^{2}} \\ &=-\frac{\pi}{4} \ln 2-\frac{1}{2} G \end{aligned} $$
Similarly, using the result in my post in Quora, $$ \begin{aligned} \int_{0}^{\frac{\pi}{4}} \ln (\tan x) d x &=\int_{0}^{\frac{\pi}{4}} \ln (\sin x) d x-\int_{0}^{\frac{\pi}{4}} \ln (\cos x) d x \\ &=\left(-\frac{\pi}{4} \ln 2-\frac{1}{2} G\right)-\left(\frac{G}{2}-\frac{\pi}{4} \ln 2\right) \\ &=-G \end{aligned} $$