# 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$.

$\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?

• (1) What are $A$, $B$, and $C$? I understand that you must've set up the partial fraction decomposition. But if you don't show your work, how do we know which coefficient is which one? And we don't know whether you set it up correctly. So you really need to show all your work here. (2) How did you get $x\ln|x^2+4|$? This can't possibly be correct here. Remember that when integrating with respect to $x$, $x$ is not a constant. So $\color{red}{\int xf(x)dx\neq x\int f(x)dx}$. – zipirovich Aug 17 '17 at 2:33
• And so we see after the edit that the problem lies not with forming the partial fraction, but indeed with integrating $x/(x^2+4)$. – Graham Kemp Aug 17 '17 at 2:58
• Don't forget $dx$ – gen-ℤ ready to perish Aug 17 '17 at 3:03
• @GrahamKemp: I knew it! :-) – zipirovich Aug 17 '17 at 4:20

Yes, $4 = A(x^2+4)~+~(Bx+C)x \implies A=1, B=-1, C=0$

So

$$\require{enclose}\int \dfrac{4}{x(x^2+4)}~\mathrm d x ~{= \int \dfrac{1}{x}+\dfrac{\enclose{circle}{~-x~}}{(x^2+4)}~\mathrm d x \\ = \ln\lvert x\rvert -\int\dfrac{\tfrac 12\mathrm d (x^2+4)}{(x^2+4)} \\ = \ln\lvert x\rvert -\tfrac 12\ln\lvert x^2+4\rvert+D}$$

• +1 for \enclose{circle}{~-x~}. – Ander Biguri Aug 17 '17 at 11:20

Writing $$\frac{4}{x(x^2+4)} = \frac{A}{x} + \frac{Bx+C}{x^2+4},$$ you saw that $A=1$, $B=-1$, and $C=0$. So you have $$\int \frac{4}{x(x^2+4)}dx = \int \frac{dx}{x} - \int \frac{x}{x^2+4} dx.$$ To integrate the second term on the right, do a $u$-substitution: let $u=x^2+4$. Then $du=2xdx$. So $$\int \frac{dx}{x} - \int \frac{x}{x^2+4} dx = \int \frac{dx}{x} - \frac{1}{2}\int \frac{du}{u}.$$ After integrating term-by-term, change the $u$ back into $x^2+4$.

Your partial fraction expansion was correct.$$\frac 4{x(x^2+4)}=\frac 1x-\frac x{x^2+4}$$However, the error lies in integrating the second term of the right-hand side. To simplify$$\int\frac x{x^2+4}\, dx$$Make a substituting $z=x^2+4$. The derivative is $dz=2x\, dx$ so $x\, dx=dz/2$. Therefore, the integral transforms into\begin{align*}\int\frac {x\, dx}{x^2+4} & =\frac 12\int\frac {dz}{z}\\ & =\tfrac 12\log z+C\\ & =\tfrac 12\log(x^2+4)+C\end{align*}Hence, we have$$\boxed{\int\frac {4\, dx}{x(x^2+4)}=\log x-\tfrac 12\log(x^2+4)+C}$$

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.