A problem about parametric integral How to solve the following integral.
$I(\theta) = \int_0^{\pi}\ln(1+\theta \cos x)dx$ where $|\theta|<1$

Differentiating under the integral sign yields: $$ I'(\theta) = \int^{\pi}_0 \frac{\cos x}{1+ \theta \cos x} dx .$$
So $$\theta I'(\theta) = \int^{\pi}_0 1 - \frac{1}{1+\theta \cos x} dx= \pi -  \int^{\pi}_0 \frac{1}{1+\theta \cos x} dx$$
To deal with the last integral, consider $$
\begin{aligned} I & = \int_{0}^{\pi} \frac{1}{a+b\cos{x}}\;{dx} \\&   = \int_{0}^{\pi} \frac{1}{a\left(\sin^2\frac{1}{2}x+\cos^2\frac{1}{2}x\right)+b\left(\cos^2\frac{1}{2}x-\sin^2\frac{1}{2}x\right)}\;{dx} \\& =\int_{0}^{\pi}\frac{1}{(a-b)\sin^2\frac{1}{2}x+(a+b)\cos^2\frac{1}{2}x}\;{dx} \\& =\int_{0}^{\pi}\frac{\sec^2{\frac{1}{2}x}}{(a+b)+(a-b)\tan^2\frac{1}{2}x}\;{dx} \\& = 2\int_{0}^{\infty}\frac{1}{(a+b)+(a-b)t^2}\;{dt} \\& =  2\int_{0}^{\infty}\frac{1}{(\sqrt{a+b})^2+(\sqrt{a-b})^2t^2}\;{dt}\\& = \frac{2}{{\sqrt{a^2-b^2}}}\tan^{-1}\bigg(\frac{\sqrt{a-b}}{\sqrt{a+b}}~t \bigg)\bigg|_{0}^{\infty} \\& = \frac{\pi}{\sqrt{a^2-b^2}}.\end{aligned}
$$
Thus, $$ \theta I'(\theta) = \pi \left(1 - \frac{1}{\sqrt{1-\theta^2}} \right).$$
You can now do some integration of your own to find $I'(\theta).$
