How do you integrate  (x+2) / (x(x-4)) using partial fractions?

\color{red}{\int \frac{x+2}{x(x-4)}\ dx}=\color{blue}{-1/2\ln |x|+3/2\ln|x-4|+C

Explanation:

Let

$\setminus \frac{x + 2}{x \left(x - 4\right)} = \frac{A}{x} + \frac{B}{x - 4}$

$\left(A + B\right) x - 4 A = x + 2$

Comparing the corresponding coefficients on both the sides we get

A+B=1\ \ &\ \ -4A=2

Solving above equations we get

$A = - \frac{1}{2} , B = \frac{3}{2}$

Now, the partial fractions can be written as follows

$\setminus \frac{x + 2}{x \left(x - 4\right)} = \frac{- \frac{1}{2}}{x} + \frac{\frac{3}{2}}{x - 4}$

$= - \frac{1}{2 x} + \frac{3}{2 \left(x - 4\right)}$

$\setminus \therefore \setminus \int \setminus \frac{x + 2}{x \left(x - 4\right)} \setminus \mathrm{dx}$

$= \setminus \int \left(- \frac{1}{2 x} + \frac{3}{2 \left(x - 4\right)}\right) \setminus \mathrm{dx}$

$= - \frac{1}{2} \setminus \int \frac{\mathrm{dx}}{x} + \frac{3}{2} \setminus \int \frac{\mathrm{dx}}{x - 4}$

$= - \frac{1}{2} \setminus \ln | x | + \frac{3}{2} \setminus \ln | x - 4 | + C$