<s>[INST] Partial fractions - integration $$\int \frac{4}{(x)(x^2+4)} $$ 
By comparing coefficients, 
$ 4A = 4 $,
$A = 1$ 
$1 + B = 0 $, 
$B= -1 $ 
$xC= 0 $, 
$C= 0 $ 
where $\int \frac{4}{x(x^2+4)}dx =\int \left(\frac{A}{x} + \frac{Bx+C}{x^2 + 4}\right)dx$. 
So we obtain $\int \frac{1}{x} - \frac{x}{x^2+4} dx$. 
And my final answer is 
$\ln|x| - x \ln |x^2 + 4| + C$. 
However my answer is wrong , the answer is - $\ln|x| - \frac{1}{2} \ln |x^2 + 4| + C$. 
Where have I gone wrong?
 [/INST] I'm not necessarily sure how you got a factor of $x$ in the second term, but here is my go at it:
$$\frac{4}{x(x^2+4)}= \frac{A}{x} + \frac{Bx+C}{x^2+4}=\frac{A(x^2+4)+x(Bx+C)}{x(x^2+4)}=\frac{Ax^2+Bx^2+Cx+4A}{x(x^2+4)}$$
Then, by equating the numerator of the first and last expressions we have:
$$4=x^2(A+B) +Cx +4A$$
Equating coefficients:
$$A+B=0,C=0,4A=4\Rightarrow A=1,B=-1 \text{ and } C=0$$
Then we have:
$$\int{\frac{4}{x(x^2+4)}}\,dx=\int{\frac{1}{x}-\frac{x}{x^2+4}\,dx} = \int\frac{dx}{x}\,  - \int{\frac{x}{x^2+4}\,dx}$$
In the second integral, we let $u=x^2+4$ then $du=2x dx\Rightarrow xdx=\frac{1}{2}du$. Hence
$$\int{\frac{dx}{x}} - \frac{1}{2}\int{\frac{du}{u}}=\ln \left|x\right|+\frac{1}{2}\ln\left|u\right|+C=\ln|x|-\frac{1}{2}\ln|x^2+4|+C$$
as required.
</s>