I have this integral with parameter:
$$I(a) =\int_{0}^{\pi/2} \frac{\ln(1+a\cos x)}{\cos x}dx, 0<a<1 $$
Tried to use the differentation under the integral sign:
$$\frac{\partial I}{\partial a} = \frac{1}{a\cos x+1}$$
$$\int_{0}^{\pi/2}\frac{dx}{a\cos x+1} = \frac{2\tanh^{-1}\left(\frac{(-1 + a) \tan(x/2)}{\sqrt{a^2-1}}\right)}{\sqrt{a^2-1}} + C$$
I think that something goes wrong on this step. If I substitute ${a}$ into $\sqrt{a^2-1}$, the result is negative.
Any help would be really helpful.