What is the integral of $\frac{x-1}{(x+3)(x^2+1)}$? I've worked with partial fractions to get the integral in the form $$\int\frac{A}{x+3} + \frac{Bx + C}{x^2+1}\,dx$$ Is there a quicker way?
 A: Notice, for $(Bx+C)$ part, you should use separation as follows  $$\int \frac{x-1}{(x+3)(x^2+1)}\ dx=\int \frac{-2}{5(x+3)}+\frac{2x-1}{5(x^2+1)}\ dx$$
$$=\frac{1}{5}\int \left(-\frac{2}{x+3}+\frac{2x}{x^2+1}-\frac{1}{x^2+1}\right)\ dx$$
$$=\frac{1}{5} \left(-2\int \frac{1}{x+3}\ dx+\int \frac{d(x^2)}{x^2+1}-\int\frac{1}{x^2+1}\ dx\right)$$
A: First of all: you have to be carefull with your notation because you mean:
$$\int\left(\frac{A}{x+3} + \frac{Bx + C}{x^2+1}\right)\space\text{d}x$$

And Partial fractions is the most easy way:
$$\int\frac{x-1}{(x+3)(x^2+1)}\space\text{d}x=$$
$$\int\left(\frac{2x-1}{5(x^2+1)}-\frac{2}{5(x+3)}\right)\space\text{d}x=$$
$$\frac{1}{5}\int\frac{2x-1}{x^2+1}\space\text{d}x-\frac{2}{5}\int\frac{1}{x+3}\space\text{d}x=$$
$$\frac{1}{5}\int\left(\frac{2x}{x^2+1}-\frac{1}{x^2+1}\right)\space\text{d}x-\frac{2}{5}\int\frac{1}{x+3}\space\text{d}x$$
A: $\int \frac{x-1}{(x+3)(x^2+1)} dx= \int\frac{A}{x+3} + \frac{B(2x) + C}{x^2+1}\,dx $
and
$ x-1= A(x^{2}+1)+ (B(2x)+C)(x+3)$
which is simple. 
A: Here is a slightly different way.
We start with
$$
\frac{x - 1}{(x+3)(x^2+1)} =
\frac{A}{x+3} + \frac{B}{x+i} + \frac{B^*}{x-i},
\qquad (1)
$$
where $B^*$ is the complex conjugate of $B$. The coefficient for $(x-i)^{-1}$ must be $B^*$: since the left-hand side is real, the right-hand side is real too, and hence is invariant under complex conjugation.
Multiplying both sides by $x+3$ and taking the limit of $x \rightarrow -3$, we get
$$
A = \frac{-3-1}{(-3)^2 + 1} = -\frac{2}{5}.
\qquad (2)
$$
Similarly, multiplying both sides by $x + i$ and taking the limit of $x \rightarrow -i$ yields
$$
B = \frac{-i - 1}{(-i + 3)(-i - i)} = \frac{1}{5} - \frac{i}{10}.
\qquad (2)
$$
Now the right-hand side of (1) is easy to integrate
$$
\begin{aligned}
\int \frac{x - 1}{(x+3)(x^2+1)} dx
&=
A\log|x+3| + B\log(x+i) + B^*\log(x-i)  + C\\
&=
A \log|x+3| + (\Re B) \log(x+i)(x-i) + (\Im B) \, i\log\frac{x+i}{x-i} + C \\
&=
A \log|x+3| + (\Re B) \log(x^2+1) -2 (\Im B) \arctan \frac{1}{x} + C \\
&=
-\frac{2}{5} \log|x+3| + \frac{1}{5} \log(x^2+1) 
+\frac{1}{5} \arctan \frac 1 x + C.
\end{aligned}
$$
The third line needs some explanation.  Since
$$
\begin{aligned}
\log \frac{x + i}{\sqrt{x^2+1}} &= i \arctan\frac{1}{x}, \\
\log \frac{x - i}{\sqrt{x^2+1}} &= -i \arctan\frac{1}{x},
\end{aligned}
$$
the difference
$$
\log \frac{x + i}{x - i} = 2 i \arctan\frac{1}{x}.
$$
