Evaluation of $\int_{0}^{\pi}\ln(5-4\cos x)\,dx$ revisited This question is a reference to Evaluation of $\displaystyle \int_{0}^{\pi}\ln(5-4\cos x)dx$ which was posted earlier by Juantheron. I tried to work it out in a slightly "easier" way than Eric did in his answer, but couldn't get exactly to the right answer.
Here is what I did:
I considered the integral $\displaystyle \int_{0}^{\pi}\ln(a-4\cos x)dx$ and took derivative wrt $a$: $I'(a)=\displaystyle \int_{0}^{\pi}\frac{dx}{a-4\cos x}$ Then I applied "Weierstrass sub" to get
$$I'(a)= \int_{0}^{\infty}\frac{2dt}{(4+a)t^2+a-4}$$
To get this ready for the "arctan" I pull out $\frac{1}{4+a}$ to get $$I'(a)= \frac{1}{4+a}\int_{0}^{\infty}\frac{2dt}{t^2+\frac{a-4}{a+4}}=\frac{2}{4+a}\sqrt{\frac{a+4}{a-4}}\arctan\sqrt{\frac{a+4}{a-4}}t$$ ,from $0$ to infinity which gives: $\frac{\pi}{\sqrt{a^2-16}}=I'(a)$ So now $I(a)={\pi}\ln|a+\sqrt{a^2-16}|$ For $a=5$ I get ${\pi}\ln8$ as the answer. But the actual answer is ${\pi}ln4$. I don't know what I have done wrong. The only thing I can come up with, this that by integrating from $I'(a)$ to $I(a)$ there is a constant $C$ that might contribute? Can anyone help me if my approach is valid and how to get the right answer with my approach? This would be a great learning experience for me. Thanks! 
 A: Your solution was good up to
$$I(a)=\pi\ln(a+\sqrt{a^2-16})+C$$
But you still have to evaluate $C$ and it's trickier than when $b$ was the variable because in that case you knew the value of the integral for $b=0$. This time there are no values of $a$ for which you know the value of the integral, but you still can get to $C$ via the slant asymptote. We propose to start with the approximation $I(a)\approx m\cdot\ln a+b$. To get $m$, note that
$$\begin{align}m&=\lim_{a\rightarrow\infty}\frac{I(a)}{\ln a}=\lim_{a\rightarrow\infty}\frac{\int_0^{\pi}\ln(a-4\cos x)dx}{\ln a}\\
&=\lim_{a\rightarrow\infty}\frac{\int_0^{\pi}\left(\ln a+\ln(1-\frac{4\cos x}a)\right)dx}{\ln a}\\
&=\lim_{a\rightarrow\infty}\frac{\pi\ln a+\int_0^{\pi}\ln(1-\frac{4\cos x}a)dx}{\ln a}\\
&=\pi+\lim_{a\rightarrow\infty}\frac{\int_0^{\pi}\ln(1-\frac{4\cos x}a)dx}{\ln a}=\pi\end{align}$$
Because
$$\lim_{a\rightarrow\infty}\ln\left(1-\frac{4\cos x}a\right)=0$$
Now we can find $b$ as
$$\begin{align}b&=\lim_{a\rightarrow\infty}\left(I(a)-\pi\ln a\right)\\
&=\lim_{a\rightarrow\infty}\left(\pi\ln a+\int_0^{\pi}\ln\left(1-\frac{4\cos x}a\right)dx-\pi\ln a\right)\\
&=\lim_{a\rightarrow\infty}\int_0^{\pi}\ln\left(1-\frac{4\cos x}a\right)dx=0\end{align}$$
For the same reason. Thus we require
$$\begin{align}\pi&=\lim_{a\rightarrow\infty}\frac{\pi\ln(a+\sqrt{a^2-16})+C}{\ln a}\\
&=\lim_{a\rightarrow\infty}\frac{\pi\ln a+\pi\ln\left(1+\sqrt{1-\frac{16}{a^2}}\right)+C}{\ln a}\\
&=\pi+\lim_{a\rightarrow\infty}\frac{\pi\ln\left(1+\sqrt{1-\frac{16}{a^2}}\right)+C}{\ln a}=\pi\end{align}$$
OK, but also
$$\begin{align}0&=\lim_{a\rightarrow\infty}\pi\ln(a+\sqrt{a^2-16})+C-\pi\ln a\\
&=\pi\ln a+\pi\ln\left(1+\sqrt{1-\frac{16}{a^2}}\right)+C-\pi\ln a\\
&=\pi\ln2+C\end{align}$$
So now we have established that $C=-\pi\ln2$, so
$$I(a)=\pi\ln(a+\sqrt{a^2-16})-\pi\ln2$$
And
$$I(5)=\pi\ln(5+3)-\pi\ln2=\pi\ln4$$
