Differentiation uner the integral sign - help me find my mistake This is my integral:
$$I(a)=\int_0^\infty\frac {\ln(a^2+x^2)}{(b^2+x^2)}dx.$$
Taking the first derivative with respect to a:
$$I'(a)=\int_0^\infty \frac {2adx} {(a^2+x^2)(b^2+x^2)}.$$
This is how I did the partial fraction decomposition:
$\frac {2a} {(a^2+x^2)(b^2+x^2)}=\frac {Ax+B} {(a^2+x^2)}+\frac {Cx+D} {(b^2+x^2)}$.
From here I get that $A=C=0$, $B=\frac {2a} {(b^2-a^2)}$ and $D=\frac {-2a} {(b^2-a^2)}$
Is this correct? Because when I try to solve $I'(a)$ using these values for $B$ and $D$ I get a different solution from the textbook?

Here you are solving:
\begin{equation}
I(a,b)=\int_0^\infty\frac {\ln\left(a^2+x^2\right)}{\left(b^2+x^2\right)}dx
\end{equation}
The method you have taken is perfectly fine. Here I will employ Feynman's Trick and introduce a new parameter:
\begin{equation}
J(t;a,b)=\int_0^\infty\frac {\ln\left(a^2+tx^2\right)}{\left(b^2+x^2\right)}dx
\end{equation}
We see that $I(a,b) = \lim_{t \rightarrow 1^+} J(t;a,b)$ and that $J(0;a,b)$ is easy to resolve (will do later). Applying Leibniz's Integral Rule we take the derivative with respect to $t$:
\begin{align}
\frac{dJ}{dt} &= \int_0^\infty\frac {x^2}{\left(a^2 + tx^2\right)\left(b^2+x^2\right)}dx = \frac{1}{b^2t - a^2}\int_0^\infty\left[\frac{b^2}{b^2 + x^2} - \frac{a^2}{a^2+tx^2} 
 \right]dx \\
&= \frac{1}{b^2t - a^2}\left[\left|b\right|\operatorname{arctan}\left(\frac{x}{\left|b\right|} \right) - \frac{\left|a\right|}{\sqrt{t}} \operatorname{arctan}\left(\frac{\sqrt{t}x}{\left|a\right|}\right)
 \right]_0^\infty \\
&=\frac{1}{b^2t - a^2}\left[\left|b\right|\cdot \frac{\pi}{2} -\frac{\left|a\right|}{\sqrt{t}}\cdot \frac{\pi}{2}\right] =\frac{\pi}{2\left(b^2t - a^2\right)}\left[\left|b\right|\ -\frac{\left|a\right|}{\sqrt{t}}\right] = \frac{\pi}{2\sqrt{t}\left(b^2t - a^2\right)}\left[\left|b\right|\sqrt{t} -\left|a\right|\right] \\
&=\frac{\pi}{2\sqrt{t}\left(\left|b\right|\sqrt{t} + \left|a\right|\right)}
\end{align}
We now integrate with respect to $t$:
\begin{equation}
J(t;a,b) = \int \frac{\pi}{2\sqrt{t}\left(\left|b\right|\sqrt{t} + \left|a\right|\right)}\:dt
\end{equation}
Here let $t = u^2$
\begin{align}
 &\int \frac{\pi}{2\sqrt{t}\left(\left|b\right|\sqrt{t} + \left|a\right|\right)}\:dt =  \int \frac{\pi}{2\sqrt{u^2}\left(\left|b\right|\sqrt{u^2} + \left|a\right|\right)}\cdot 2u\:du = \int \frac{\pi}{\left|b\right||u| + \left|a\right|}\:du \\
&= \frac{\pi}{|b|}\ln\left|\left|b\right||u| + \left|a\right| \right| + C = \frac{\pi}{|b|}\ln\left|\left|b\right|\sqrt{t} + \left|a\right| \right| + C
\end{align}
Where $C$ is the constant of integration.To resolve we use $J(0;a,b)$:
\begin{equation}
J(0;a,b) = \int_0^\infty\frac {\ln\left(a^2+0\cdot x^2\right)}{\left(b^2+x^2\right)}dx = \frac{\pi}{|b|}\ln\left|\left|b\right|\sqrt{0} + \left|a\right| \right| + C =  \frac{\pi}{|b|}\ln\left|ab \right| + C 
\end{equation}
And thus
\begin{align}
 \frac{\pi}{|b|}\ln\left|ab \right| + C&= \int_0^\infty\frac {\ln\left(a^2\right)}{\left(b^2+x^2\right)}dx = 2\ln|a| \int_0^\infty\frac {1}{\left(b^2+x^2\right)}dx\\
& =  2\ln|a| \left[\frac{1}{\left|b\right|}\operatorname{arctan\left(\frac{x}{\left|b\right|} \right)} 
\right]_0^\infty = 2\ln|a| \cdot \frac{1}{\left|b\right|} \frac{\pi}{2} = \frac{\pi\ln|a|}{|b|}
\end{align}
Thus
\begin{equation}
C = \frac{\pi\ln|a|}{|b|} - \frac{\pi}{|b|}\ln\left|ab \right| = -\frac{\pi}{|b|}\ln|b|
\end{equation}
Thus, we form our solutions for $J(t;a,b)$:
\begin{equation}
J(t;a,b) = \frac{\pi}{|b|}\ln\left|\left|b\right| \sqrt{t}+ \left|a\right| \right| -\frac{\pi}{|b|}\ln|b|
\end{equation}
We now can solve for $I(a,b)$ by applying the limit as above:
\begin{align}
I(a,b) &= \lim_{t \rightarrow 1^+} J(t;a,b) = \lim_{t \rightarrow 1^+}\frac{\pi}{|b|}\ln\left|\left|b\right| \sqrt{t}+ \left|a\right| \right| -\frac{\pi}{|b|}\ln|b| \\
&= \frac{\pi}{|b|}\ln\left|\left|b\right| + \left|a\right| \right| -\frac{\pi}{|b|}\ln|b| =\frac{\pi}{|b|}\ln\left|\frac{\left|b\right| + \left|a\right|}{|b|} \right|
\end{align}
Or 
\begin{equation}
\int_0^\infty\frac {\ln\left(a^2+x^2\right)}{\left(b^2+x^2\right)}dx = \frac{\pi}{|b|}\ln\left|\frac{\left|b\right| + \left|a\right|}{|b|} \right|
\end{equation}
