# Evaluating $\int_0^{\pi/2} \log \left| \sin^2 x - a \right|$ where $a\in [0,1]$.

How to evaluate $$\displaystyle\int_0^{\pi/2} \log \left| \sin^2 x - a \right|\,dx$$ where $$a\in[0,1]$$ ?

I think of this problem as a generalization of the following proposition $$\displaystyle\int_0^{\pi/2} \log \left(\sin x\right)\,dx =-\frac12\pi\log2$$

My try

Put $$I(a)=\displaystyle\int_0^{\pi/2} \log \left| \sin^2 x - a \right|\,dx$$ From the substitution $$x \to \frac{\pi}{2}-x$$ , we get $$\displaystyle\int_0^{\pi/2} \log \left| \sin^2 x - a \right|\,dx = \displaystyle\int_0^{\pi/2} \log \left| \cos^2 x - a \right|\,dx$$ Thus $$\displaystyle\int_0^{\pi/2} \log \left| \sin^2 x - a \right|\,dx = \displaystyle\int_0^{\pi/2} \log \left| \sin^2 x - (1-a) \right|\,dx$$ which means $$I(a)=I(1-a) \tag{1}$$

On the other hand, \begin{align} 2I(a) &= \displaystyle\int_0^{\pi/2} \log \left| (\sin^2 x - a)(\cos^2 x -a) \right|\,dx \\ &= \displaystyle\int_0^{\pi/2} \log \left| a^2-a+\sin^2 x \cos^2 x \right|\,dx \\ &= \displaystyle\int_0^{\pi/2} \log \left| 4(a^2-a)+\sin^2 (2x) \right|\,dx -\pi \log 2 \\ &= \frac{1}{2}\displaystyle\int_0^{\pi} \log \left| 4(a^2-a)+\sin^2 x \right|\,dx -\pi \log 2 \\ &= \displaystyle\int_0^{\pi/2} \log \left| 4(a^2-a)+\sin^2 x \right|\,dx -\pi \log 2 \\ &= \displaystyle\int_0^{\pi/2} \log \left| 1+4(a^2-a)-\sin^2 x \right|\,dx -\pi \log 2 \\ &= I((2a-1)^2) -\pi \log 2 \end{align} Thus $$2I(a)=I((2a-1)^2)-\pi \log 2 \tag{2}$$

Let $$a=0$$ we get the proposition mentioned above $$\displaystyle\int_0^{\pi/2} \log \left(\sin x\right)\,dx =-\frac12\pi\log2.$$

But how to move on ? Can we solve the problem only by $$(1)$$ and $$(2)$$? Or what other properties should we use to evaluate that?

Looking forward to your new solutions as well.

As pointed out in the comments, it seems like that the integral is identical to $$-\pi\log 2$$.

From $$(1)$$ and $$(2)$$ we can also find many numbers such that $$I(a)=-\pi\log 2$$.

• Breaking the integral into two with different interval so that the modulus gets converted , might help for solving the problem. – Bijayan Ray Mar 14 at 17:32
• I'm fairly certain that the integral is identical to $-e$ for $a\in [0,1]$ – clathratus Mar 14 at 17:47
• @BijayanRay I tried it but it was horrible :D – Advil Sell Mar 14 at 17:54
• @clathratus It seems like that you meant it's identical to $-\pi \log 2$. – Zero Mar 14 at 18:14
• Wait yeah its $-\pi\log2$ my bad. I just got my decimals mixed up I guess :) – clathratus Mar 14 at 18:16

Using the symmetries and developing the $$\sin^2$$ term, we can express \begin{align} I&=\int_0^{\pi/2} \log \left| \sin^2 x - a \right|\,dx\\ &=\frac{1}{4}\int_0^{2\pi} \log \left| \sin^2 x - a \right|\,dx\\ &=\frac{1}{4}\int_0^{2\pi} \log \left| \frac{1-2a}{2}-\frac{1}{2}\cos 2x\right|\,dx %&=-\frac{\pi}{2}\ln 2+\frac{1}{4}\int_0^{2\pi} \log \left| \left( 2a-1 \right)+\cos 2x\right|\,dx \end{align} By denoting $$2a-1=\cos 2\alpha$$, \begin{align} I&=\frac{1}{4}\int_0^{2\pi} \log \left| \frac{1}{2}\left( \cos 2\alpha+\cos 2x\right)\right|\,dx\\ &=\frac{1}{4}\int_0^{2\pi} \log \left| \cos \left( x+\alpha \right)\cos \left( x-\alpha \right)\right|\,dx\\ &=\frac{1}{4}\int_0^{2\pi} \log \left| \cos \left( x+\alpha \right)\right|\,dx+\frac{1}{4}\int_0^{2\pi} \log \left| \cos \left( x-\alpha \right)\right|\,dx \end{align} As the functions are periodic, the integration variables can be shifted, thus $$$$I=\frac{1}{2}\int_0^{2\pi} \log \left| \cos \left( x \right)\right|\,dx$$$$ Finally using the symmetries of the integrand, \begin{align} I&=2\int_0^{\pi/2} \log \left| \cos \left( x \right)\right|\,dx\\ &=2\int_0^{\pi/2} \log \left| \sin \left( x \right)\right|\,dx\\ &=-\pi\ln 2 \end{align} from the quoted result.