Help solving $\int {\frac{8x^4+15x^3+16x^2+22x+4}{x(x+1)^2(x^2+2)}dx}$

Below I show how the Heaviside cover-up method generalizes to handle nonlinear denominators. With numerator $\rm\:f(x)\ =\ 8x^4+15x^3+16x^2+22x+4\:,\: $ the undetermined partial fraction is

$$\rm\frac{f(x)}{x(x+1)^2(x^2+2)}\ =\ \frac{a}{x}\, + \,\frac{b\, (x+1) + c}{(x+1)^2}\, + \,\frac{d\, x+e}{x^2+2}$$

To find $\,\rm d\,x+e\,$ in the $\rm\: x^2+2\ $ fraction, clear denominators and collect factors of $\rm\: x^2 + 2\: $

$$\rm f(x)\ \ =\ \ x\ (x+1)^2\ (d\, x +\: e)\, +\, (x^2+2)\ g(x)\ ,\quad some\ \ g(x) \in \mathbb Q[x]$$

Evaluating this $\rm\bmod\, x^2 + 2,\ $ i.e.$\:$ iteratively applying the rewrite rule $\rm\ x^2 \to -2\,\ $ yields

$$\rm - 8\, x + 4\ =\: -(4\, d + e)\, x\, +\, 2\, d - 4\, e\ \iff \ d=2,\ e=0 $$

Notice this method amounts to ignoring ("covering") all the undetermined partial fractions having denominator different (i.e. coprime) from the current denominator $\rm\:p(x) = x^2+2\:$ (i.e. having different roots) then evaluating what remains at the roots of $\rm\,p(x)\,$ or, equivalently, evaluating it $\rm\bmod p(x).\,$ To avoid computing inverses $\rm\bmod p(x)\:$ we scale to clear denominators before evaluating. This is simply the higher-degree analog of the classical Heaviside method - where covering up and evaluating at $\rm\: x = r\:$ is equivalent to evaluating modulo $\rm\:x-r\:$.

Using the same method we can solve for the numerator of the $\rm\ (x+1)^2\,$ fraction

$$\rm f(x)\ =\ x\, (x^2+2)\, (b\, (x+1) + c)\, + \, (x+1)^2\ h(x)\ ,\quad some\ \ h(x) \in\mathbb Q[x]$$

Evaluating it mod $\rm\, (x+1)^2,\, $ i.e. iteratively applying rewrite rule $\rm\, x^2 \to\, -2\ x - 1\, $ yields

$$\rm 3\ x - 6\ =\ (5\, c - 3\, b)\, x\, +\, 2\, c - 3\, b\ \iff\ c = 3,\ b = 4 $$


First, I trust you used the correct partial fraction decomposition: $$\frac{8x^4+15x^3+16x^2+22x+4}{x(x+1)^2(x^2+2)} = \frac{A}{x} + \frac{B}{x+1} + \frac{C}{(x+1)^2} + \frac{Dx+E}{x^2+2}.$$ This leads to \begin{align*} &8x^4 + 15x^3 + 16x^2 + 22x + 4\\ &\qquad = A(x+1)^2(x^2+2) + Bx(x+1)(x^2+2) + Cx(x^2+2) + (Dx+E)x(x+1)^2. \end{align*} A useful "trick" is to evaluate at the zeros of the linear factors to get some information; I suspect you evaluated at $x=0$ to get $2A = 4$, from which you got $A=2$.

You can then evaluate at $x=-1$ to get $-3C = -9$, which is how you got $C=3$. Looking good.

Then you used that to simplify. $$2(x^2+2x+1)(x^2+2) +3x(x^2+2) = 2x^4 + 7x^3 + 6x^2 + 14x + 4,$$ which subtracted from $8x^4 + 15x^3 + 16x^2 + 22x + 4$ gave you $$6x^4 + 8x^3 + 10x^2 + 8x = Bx(x+1)(x^2+2) + (Dx+E)x(x+1)^2.$$ Hmmm... Which is not quite what you have. Did you use the correct decomposition, or did you forget about being careful with that $(x+1)^2$?

Anyway: here's where you go stuck because you are used to being able to solve the partial fractions problems using only the evaluation trick. But when you have irreducible quadratic factors or powers of linear factors (or worse, both), the trick doesn't get you all the way there.

Here, we can factor out $x$ from both sides to get $$6x^3 + 8x^2 + 10x + 8 = B(x+1)(x^2+2) + (Dx+E)(x+1)^2.$$ (We factored out $x$ from both sides and cancelled; that's how we dropped from fourth power to cube).

Edit.

We can further factor out $x+1$ from both sides: $$(x+1)(6x^2 + 2x + 8) = (x+1)(B(x^2+2) + (Dx+E)(x+1))$$ to get $$6x^2 + 2x + 8 = B(x^2+2) + (Dx+E)(x+1).$$ Contrary to your claim before, now that we had all the right terms, we cannot simply conclude that $D=6$, because there are two quadratic terms: $Bx^2$ and $Dx^2$.

You can, however, evaluate at $x=-1$ to get $12 = 3B$, or $B=4$; from this you go to $$6x^2 + 2x + 8 = 4x^2 + 8 + (Dx+E)(x+1)$$ or $$2x^2 + 2x = (Dx+E)(x+1).$$ Noting that the constant term on the right is $E$, and $0$ on the left, you get $E=0$. This gives $$2x(x+1) = Dx(x+1)$$ which, cancelling $x(x+1)$ yields $D=2$.

Alternatively, from $2x^2+2x = (Dx+E)(x+1)$, we can factor the left hand side completely to get $$2x(x+1) = (Dx+E)(x+1)$$ from which we immediately get $Dx+E = 2x$, so $D=2$ and $E=0$.

So, in summary, $A=2$, $B=4$, $C=3$, $D=2$, $E=0$.