Differentiation under integration $\int_0^{\frac{\pi}{2}}\frac{\ln(1+\cos\alpha\cos x)}{\cos x}dx$ 
Question: Discuss the method of differentiation under the sign of integration. Hence evaluate following integrals: $$(i)\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx\quad(ii)\int_0^{\frac{\pi}{2}}\frac{\ln(1+\cos\alpha\cos x)}{\cos x}dx\quad\cdots$$ 

First of all I am confused which parameter I take. Although I tried to take both parameter individually to get some intuition.
\begin{align*} 
I(b) &= \int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx \\ 
I'(b)&=\frac{d}{db}\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx\\
I'(b)&=\int_0^{\infty}\frac{\partial}{\partial b}\left(\frac{\ln(1+a^2x^2)}{1+b^2x^2}\right)dx\\
I'(b)&=\int_0^{\infty}-\frac{2x^2b\ln \left(1+a^2x^2\right)}{\left(1+x^2b^2\right)^2}dx
\end{align*}
Now I feel I choose wrong parameter. Then try again,
\begin{align*} 
I(a) &= \int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx \\ 
I'(a)&=\frac{d}{da}\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx\\
I'(a)&=\int_0^{\infty}\frac{\partial}{\partial a}\left(\frac{\ln(1+a^2x^2)}{1+b^2x^2}\right)dx\\
I'(a)&=\int_0^{\infty}\frac{2ax^2}{\left(1+x^2b^2\right)\left(1+a^2x^2\right)}dx
\end{align*}
Now I am frustrated and think I am missing something or didn't understand the concept.

questions:
$(1)$ Actually how to deal with them$?$
$(2)$ How to choose parameter wisely or assure that I am going right direction because after that partial derivatives those look more ugly to integrate/handle 
 and backtracking isn't possible in Exam Hall$?$
Thanks in advance and thanks for your time .
 A: For (i), let 
$$I(t)=\int_0^{\infty}\frac{\ln(1+tx^2)}{1+b^2x^2}dx\quad$$
Then,
$$I'(t)=\int_0^{\infty}\frac{x^2}{(1+b^2x^2)(1+tx^2)}dx$$
$$=\frac1{b^2-t}\int_0^{\infty}\left(\frac{1}{1+tx^2}-\frac{1}{1+b^2x^2}\right)dx$$
$$=\frac\pi2\frac1{\sqrt t(b^2-t)} -\frac\pi2\frac1{b(b^2-t)} $$
Thus,
$$I(t)=\frac\pi2 \int_0^t\frac{ds}{\sqrt s(b^2-s)}  -\frac\pi2 \int_0^t\frac{ds}{b(b^2-s)} $$
$$=\frac\pi2 \frac1b\ln\frac{b+\sqrt t}{\left|b-\sqrt t\right|}+\frac\pi2 \frac1{b}\ln\frac{\left|b^2-t\right|}{b^2}=\frac\pi{b}\ln\frac{b+\sqrt t}b$$
The original integral is
$$I(a^2)=\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx
=\frac\pi{b}\ln\frac{b+a}b$$
A: Using Nyssa's comment I tried like that: 
\begin{align*} 
I(a) &= \int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx \\ 
I'(a)&=\frac{d}{da}\int_0^{\infty}\frac{\ln(1+a^2x^2)}{1+b^2x^2}dx\\
&=\int_0^{\infty}\frac{\partial}{\partial a}\left(\frac{\ln(1+a^2x^2)}{1+b^2x^2}\right)dx\\
&=\int_0^{\infty}\frac{2ax^2}{\left(1+x^2b^2\right)\left(1+x^2a^2\right)}dx\\
&=\int_0^{\infty}\left(\frac{2a}{(a^2-b^2)(1+x^2b^2)}-\frac{2a}{(a^2-b^2)(1+x^2a^2)}\right)dx\\
&=\frac{2a}{a^2-b^2}\frac{1}{b}\arctan(bx)\bigg|_0^\infty -\frac{2a}{a^2-b^2}\frac{1}{a}\arctan(ax)\bigg|_0^\infty\\
&=\frac{\pi}{a^2-b^2}\left(\frac{a}{b}-1\right)=\frac{\pi}{(a-b)(a+b)}\frac{a-b}{b}=\frac{\pi}{b(a+b)}
\end{align*}
Now we integrate back:
\begin{align*} 
I(a)&=\frac{\pi}b\int\frac{1}{a+b}da\\
&=\frac{\pi}b\ln(a+b)+C\\
I(0)=0\implies C=-\frac{\pi}{b}\ln b \implies I(a)=\frac{\pi}{b}\ln\left(\frac{a+b}{b}\right)
\end{align*}
For $(2)$ I personally now think to choose parameter such a way that it remove $\ln,\sin^{-1}\cdots$ stuff. Please correct me If I am wrong. I put my answer as community so that anyone can edited it.
A: As others have noted, (i) is best done by differentiating with respect to $a$; you just need to write $\frac{x^2}{(1+a^2x^2)(1+b^2x^2)}$ as a linear combination of $\frac{1}{1+c^2x^2}$ with $c\in\{a,\,b\}$, use $\int_0^\infty\frac{dx}{1+c^2x^2}=\frac{\pi}{2c}$, and integrate $I^\prime$ using $I(0)=0$.
For (ii), differentiate with respect to $k:=\cos\alpha$, so you'll need to evaluate $\int_0^{\pi/2}\frac{dx}{1+k\cos x}$ with $t:=\tan\frac{x}{2}$. For $\alpha\in[0,\,\pi)$, you should find$$\int_0^{\pi/2}\frac{dx}{1+k\cos x}=\frac{\alpha}{\sin\alpha}\implies\int_0^{\pi/2}\frac{\ln(1+k\cos x)dx}{\cos x}=\int_{\pi/2}^\alpha\frac{\alpha^\prime}{\sin\alpha^\prime}\frac{dk^\prime}{d\alpha^\prime}d\alpha^\prime=\frac{\pi^2-4\alpha^2}{8}.$$
A: For (ii),
$$I(\alpha)=\int_0^{\frac{\pi}{2}}\frac{\ln(1+\cos\alpha\cos x)}{\cos x}dx$$ 
Use the standard substitution $\cos x =\frac{1-t^2}{1+t^2}$ and $dx =\frac{2dt}{1+t^2}$ to evaluate its derivative,
$$I'(\alpha) = \int_0^{\frac{\pi}{2}}\frac{-\sin\alpha \>dx}{1+\cos\alpha\cos x}
= \int_0^1\frac{-2\sin\alpha\> dt}{(1-\cos\alpha)t^2+(1+\cos\alpha)}$$
$$= -2\int_0^1 \frac{d(t\tan\frac{\alpha}2)}{(t\tan\frac{\alpha}2)^2+1}
=-2\tan^{-1}\left(t\tan\frac{\alpha}2\right)_0^1=-\alpha$$
where $\tan^2\frac{\alpha}2 = \frac{1-\cos\alpha}{1+\cos\alpha}$ and $\tan\frac{\alpha}2 = \frac{\sin\alpha}{1+\cos\alpha}$ are used. Thus, with $I(\pi/2) = 0 $,
$$I(\alpha) = \int_{\pi/2}^{\alpha}I'(s)ds = \int_{\pi/2}^{\alpha}(-s)ds 
= \frac12\left(\frac{\pi^2}4-\alpha^2 \right)$$
