finding an indefinite integral of a fraction (a) Show that $\frac{4-3x}{(x+2)(x^2+1)}$ can be written in the form ${\frac{A}{x+2} + \frac{1-Bx}{x^2+1}}$ and find the constants $A$ and $B$. 
(b) Hence find $\displaystyle\int\frac{4-3x}{(x+2)(x^2+1)}dx$
For (a) I found that $B=2$ and $A=2$
And I am not quite sure how to integrate. I tried to split them into two $\displaystyle\int\frac{2}{x+2
}dx$ and $\displaystyle\int\frac{1-2x}{x^2+1}dx$ but I don't know how to do after. 
 A: Use
$$\int\frac{f'(x)}{f(x)}dx=\ln|f(x)|+C.$$
Note that $$\int\frac{2}{x+2}dx=2\int\frac{(x+2)'}{x+2}dx$$
$$\int\frac{1-2x}{x^2+1}dx=-\int\frac{2x}{x^2+1}dx+\int\frac{1}{x^2+1}dx=-\int\frac{(x^2+1)'}{x^2+1}dx+\int\frac{1}{x^2+1}dx.$$
Here, set $x=\tan\theta$ for $$\int\frac{1}{x^2+1}dx.$$
A: Hint:
Let $u=x+2$ for
\begin{equation}
\int\frac{2}{x+2}dx
\end{equation}
Split the latter integral into two parts
\begin{equation}
\int\frac{1-2x}{x^2+1}dx=\int\frac{1}{x^2+1}dx-\int\frac{2x}{x^2+1}dx
\end{equation}
then let $x=\tan\theta$ also use identity $\sec^2\theta=1+\tan^2\theta$ for
\begin{equation}
\int\frac{1}{x^2+1}dx
\end{equation}
and
let $v=x^2+1$ for
\begin{equation}
\int\frac{2x}{x^2+1}dx
\end{equation}
A: Well,
$$\int\frac{2}{x+2} dx= 2\log(x+2)$$
So you have that part.
But for:
$$\int\frac{1-2x}{x^2 + 1} dx$$
You must further decompose this fraction into partial fractions:
$$\frac{1 - 2x}{x^2 + 1} = \frac{1}{x^2 + 1} - \frac{2x}{x^2 + 1}$$
So this integral becomes:$$\int\frac{1 - 2x}{x^2 + 1} dx= \int\frac{1}{x^2 + 1}dx - \int\frac{2x}{x^2 + 1}dx$$
$$= \tan^{-1}x - \log(x^2 + 1)$$
And overall:
$$\int\frac{4-3x}{(x+2)(x^2 + 1)}= 2\log(x+2) + \tan^{-1}x - \log(x^2 + 1) + c$$
Note that the constant is ommited till the end, just to simplify the answer.
