<s>[INST] Partial fractions $\int \frac{(3x^2 - 4x + 5)\,dx}{(x-1)(x^2+2)}$ $$\int \frac{(3x^2 - 4x + 5 )\, dx}{(x-1)(x^2+2)}$$
I am going to use undetermined coefficients since it seems straightforward, no wacky matrices or tables to memorize.
 $$\int \frac{(3x^2 - 4x + 5 )\, dx}{(x-1)(x^2+2)} \quad = \quad\int \left(\frac {A}{x} + \frac{B}{(x-1)^2}+\frac{C}{(x-1)}+D\right)\,dx$$
I get $$A(x^3 - 3x^2 + 3x - 1) +B(x^3 - 2x^2 + x) + C(x^2 - x) + Dx$$
This gives me the sets of
$$\begin{align} 
A + B & = 0\\ \\ 
-3A + -2B + C & = 0 \\ \\
3A + B - C + D & = 0 \\ \\
-A &= 0
\end{align}$$
This is obviously wrong because A and B are now 0. What do I do?
 [/INST] We need to use the factors of the denominator of the following integral, to decompose into partial fractions.  We need for the numerator of the second degree factor (second fraction below) to be of the form of a degree one polynomial: $Bx + C$, since $x^2 + 2$ cannot be factored into the product of first-degree factors:
$$\int \frac{3x^2 - 4x + 5}{(x-1)(x^2+2)}\,dx = \int \frac{A}{x- 1} + \frac{Bx + C}{x^2 + 2}\,dx\tag{1}$$
Then we need for $$A(x^2 + 2) + (Bx + C)(x-1) = 3x^2 - 4x + 5\tag{2}$$
We expand the terms on the left-hand side of equation $(2)$, group coefficients for $\,x^2,\, x,\; \text{and constants},\;$ and equate with the right-hand side of $(2)$:
$$\begin{align} A(x^2 + 2) + (Bx + C)(x-1) & = (A x^2 + 2A) + (Bx^2 + Cx - Bx - C)\\ \\ & = \color{blue}{\bf (A + B)}x^2 + \color{red}{\bf (C - B)} x + \color{green}{\bf (2A - C)}  \\ \\ & = \color{blue}{\bf 3}x^2 + \color{red}{\bf - 4}x + \color{green}{\bf 5}\end{align}$$
Now we match up coefficients of the left hand side with those on the right (I'll use color to distinguish between the three matchings we'll need to make), to obtain three equations in three unknowns $A,\, B, \,C :$: 
This gives us the following system of linear equations to solve:
$$\begin{align} \color{blue}{\bf A + B} & = \color{blue}{\bf 3}\\ 
\color{red}{\bf C - B} & = \color{red}{\bf -4} \\ 
\color{green}{\bf 2A - C} & = \color{green}{\bf 5} \end{align}$$
suppose we add the first two of these equations. Then we get: $$\begin{align} A + B - B + C & = 3 - 4 \\ A + C & = -1\end{align}$$. Now adding this "new" equation with the third equation above, we get $$\begin{align} 2A - C + A + C & = 5 - 1\\ 3A & = 4 \\ A & = \dfrac 43\end{align}$$
Now, we know that $2A -C = 5,$ so $$\begin{align} 2A - C & = 5 \\ C & = 2A - 5 \\
C & = 2\cdot \dfrac 43 -\dfrac{15}{3} \\
C &= \left(-\dfrac 73\right)
\end{align}.$$
And we know that $$\begin{align} A + B & = 3 \\ B & = 3 - A = 3 - \dfrac 43 \\ B& = \dfrac 53\end{align}$$
That gives us, in all: $$A = \dfrac 43,\;B = \frac 53,\;C =  -\dfrac 73$$
Now, we have the integral:
$$\begin{align} \int \frac{A}{x- 1} + \frac{Bx + C}{x^2 + 2}\,dx & =  \int \frac 13 \left(\frac{4}{x - 1} + \frac{5x - 7}{x^2 + 2}\right)\,dx \\
& = \frac 43 \int \dfrac {dx}{x - 1}  + \frac {1\cdot 5}{3\cdot 2} \int \frac{2x \,dx}{x^2 + 2} - \frac 73 \int \frac {dx}{x^2 + (\sqrt 2)^2} \\
& = \frac 43 \ln|x - 1| + \frac 56 \ln(x^2 + 2) - \frac 7{3\sqrt 2} \tan^{-1}\left(\frac{x}{\sqrt 2}\right) + C
\end{align}$$
We can get really clever and write the sum (first two terms) $ \dfrac 43\ln|x - 1| + \dfrac 56\ln(x^2 + 2)$ as $\ln(x - 1)^{4/3} + \ln(x^2 + 2)^{5/6} = \ln\left((x-1)^{4/3}(x^2 + 2)^{5/6}\right) = \ln\left((x - 1)^8(x^2 + 2)^5\right)^{1/6}$, giving us an answer: 
$$\ln\left((x - 1)^8(x^2 + 2)^5\right)^{1/6} - \frac 7{3\sqrt 2} \tan^{-1}\left(\frac{x}{\sqrt 2}\right) + C = $$
</s>