<s>[INST] Evaluating $\int_{0}^{\pi}\ln (1+b\cos x)\ \text{d}x$, $b$ is a parameter Evaluating $\int_{0}^{\pi}\ln (1+b\cos x)\ \text{d}x$ where $b$ is a parameter
I've tried Integration by parts which yield $$\int_{0}^{\pi}\ln (1+b\cos x)\ \text{d}x=\pi\ln(1-b)+b\int_{0}^{\pi}{x\sin x\over 1+b\cos x}\text{d}x$$ I cannot figure out what do next.
I also tried using Leibniz integral rule by putting $I(b)=\int_{0}^{\pi}\ln (1+b\cos x)\ \text{d}x$ to form a differential equation.
$${\text{d}I(b)\over \text{d}b}=\int_{0}^{\pi}{\cos x\over 1+b\cos x}\text{d}x$$ but I'm not able to solve the integral on right.
I've looked similar questions like this one Evaluating $\int_{0}^{\pi}\ln (1+\cos x)\, dx$ to no avail. Also I'm high school student so I don't understand advanced calculus stuff yet.
 [/INST] \begin{align*}
\frac{\mathrm{d} I(b)}{\mathrm{d} b}=\int_{0}^{\pi}{\cos x\over 1+b\cos x}\; \mathrm{d}x &= \frac{1}{b}\int_0^{\pi} \frac{ 1+b \cos{x}-1}{1+b\cos{x}} \; \mathrm{d}x \\
&= \frac{\pi}{b}-\frac{1}{b} \int_0^{\pi} \frac{1}{1+b \cos{x}} \; \mathrm{d}x\\
&= \frac{\pi}{b}-\frac{2}{b} \int_0^{\infty} \frac{1}{(t^2+1)+b(1-t^2)} \; \mathrm{d}t \tag{1}\\
&= \frac{\pi}{b}-\frac{2}{b} \int_0^{\infty} \frac{1}{(1-b)t^2+(1+b)} \; \mathrm{d}t\\
&= \frac{\pi}{b}-\frac{2}{b} \left(\frac{\pi}{2\sqrt{1-b^2}}\right) \\
&= \frac{\pi}{b}- \frac{\pi}{b\sqrt{1-b^2}} \\
I(b) &= \int \frac{\pi}{b}- \frac{\pi}{b\sqrt{1-b^2}} \; \mathrm{d}b \\
&= \pi \ln|b| + \pi \operatorname{artanh}{\left(\sqrt{1-b^2}\right)}+C \\ I(1)&=-\pi \ln{2} \implies C=-\pi \ln{2}\\
I(b) &= \pi \ln|b| + \pi \operatorname{artanh}{\left(\sqrt{1-b^2}\right)}-\pi \ln{2} \\ 
&= \pi \ln\bigg|\frac{b}{2}\bigg| -\frac{\pi}{2} \ln\left(1-\sqrt{1-b^2}\right)+\frac{\pi}{2}\ln \left(1+\sqrt{1-b^2}\right) \\ 
&= \boxed{\pi \ln\left(\frac{1+\sqrt{1-b^2}}{2}\right)}
\end{align*}
Additionally, note that $-1<b<1$.
$(1):$ Weierstrass substitution
</s>