<s>[INST] Using differentiation under integral sign to calculate $\int^{\pi/2}_0\frac{\log(1+a\sin\phi)}{\sin\phi}d\phi$ I want to calculate the integral $$\int^{\pi/2}_0\frac{\log(1+\sin\phi)}{\sin\phi}d\phi$$ using differentiation with respect to parameter in the integral $$\int^{\pi/2}_0\frac{\log(1+a\sin\phi)}{\sin\phi}d\phi$$
I know that I have to solve from differentiate under the integral and I must use a suitable substitution for integrands involving trigonometric functions but I can't complete the solution. Could you help me?
 [/INST] Define
$$I(a) = \int_0^{\pi/2} d\phi \frac{\log{(1+a\sin{\phi})}}{\sin{\phi}} $$
Then
$$I'(a) = \int_0^{\pi/2} \frac{d\phi}{1+a\sin{\phi}} $$
To evaluate the latter integral, sub $t=\tan{\phi/2}$.  Then $d\phi = 2/(1+t^2) dt$ (why?), and $\sin{\phi} = 2 t/(1+t^2)$ (why again?), and the integral is
$$I'(a) = 2 \int_0^1 \frac{dt}{1+t^2} \frac1{1+2 a t/(1+t^2)} = 2 \int_0^1 \frac{dt}{1+2 a t+t^2}$$
This is easily evaluated by completing the square in the denominator:
$$\begin{align}I'(a) &= 2 \int_0^1 \frac{dt}{(t+a)^2+1-a^2} \\ &= \frac{2}{\sqrt{1-a^2}} \left [\arctan{\frac{t+a}{\sqrt{1-a^2}}} \right ]_0^1 \\ &=\frac{2}{\sqrt{1-a^2}} \left [\arctan{\frac{1+a}{\sqrt{1-a^2}}}- \arctan{\frac{a}{\sqrt{1-a^2}}}\right ]\\ &= \frac{2}{\sqrt{1-a^2}} \arctan{}\frac{\sqrt{1-a^2}}{1+a+a^2} \end{align}$$
Now we must integrate with respect to $a$.  To do this, we integrate over each of the separate terms in the penultimate line.  To begin
$$\int da \, \frac{2}{\sqrt{1-a^2}} \arctan{\frac{a}{\sqrt{1-a^2}}}$$
Sub $a=\sin{\theta}$, and it should be straightforward to see that this antiderivative is simply
$$2 \int d\theta \, \theta = \theta^2 = \arcsin^2{a} $$
(Yes I am ignoring the constant of integration for now.)
Now the second piece:
$$\int da \, \frac{2}{\sqrt{1-a^2}} \arctan{\frac{1+a}{\sqrt{1-a^2}}}$$
Sub $a=\cos{\theta} $.  Note that the argument of the arctan becomes $\cot{(\theta/2)}$, so the integral becomes
$$-2 \int d\theta \left (\frac{\pi}{2} - \frac{\theta}{2} \right ) = \frac12 \theta^2 - \pi \theta = \frac{\pi}{2} \arcsin{a} + \frac12 \arcsin^2{a}-\frac{3 \pi^2}{8}$$
Including the constant of integration, then,
$$I(a) = \frac12 \theta^2 - \pi \theta = \frac{\pi}{2} \arcsin{a} - \frac12 \arcsin^2{a}-\frac{3 \pi^2}{8} + C$$
Given $I(0)=0$, then $I(a) = \frac{\pi}{2} \arcsin{a} - \frac12 \arcsin^2{a}$.  The desired integral is $I(1)$, so that
$$\int_0^{\pi/2} d\phi \frac{\log{(1+\sin{\phi})}}{\sin{\phi}} = \frac{\pi^2}{4} - \frac{\pi^2}{8} = \frac{\pi^2}{8} $$
EDIT
I should have mentioned above that $a$ is restricted to values such that $|a| \le 1$ in the above analysis.
</s>