<s>[INST] Trying to decompose Partial Fraction. Is this the method? Decompose $\frac{(x^3+x+1)}{(x^2+1)^2}$

Based on my understanding so far:
The partials of the denominator are $(x^2+1)$ and $(x^2+1)^2$
$\frac{(x^3+x+1)}{(x^2+1)^2}$ can be decomposed  into partial fractions as below:
$\frac{(x^3+x+1)}{(x^2+1)^2} = \frac{A}{x^2+1} +\frac{B}{(x^2+1)^2}$
multiply both sides by LCD which is $(x^2+1)^2$ we get:
$$x^3+x+1=A(x^2+1)+B$$
removing brackets
$$x^3+x+1=Ax^2+A+B$$
simplify
$$x(x^2+1)+1=A(x^2+1)+B$$
$\therefore$ looking at coefficients, $B=1$ and $A=x$.
Looking at the above, I don't seem to have a solution. Where am I going wrong? Am I on right path?
 [/INST] By inspection, the partial fractions decomposition is $\dfrac{x}{x^2+1}+\dfrac{1}{(x^2+1)^2}$. This is because $x^3+x=x(x^2+1)$.
Remark: If the top were less simple, we would look for constants $A, B, C, D$ such that our expression is identically equal to $\frac{Ax+B}{x^2+1}+\frac{Cx+D}{(x^2+1)^2}$. 
</s>