<s>[INST] Dividing a polynomial with $(x^2+1)^2$ I have been given that a polynomial $f(x)$ with real coefficients is divisible by $(x^2+1)$, and that when $f'(x)$ is divided by $(x^2+1)$, we get a remainder of $(x+1)$. I need to prove that $2f(x)+(x-1)(x^2+1)$ is divisible by $(x^2+1)^2$. 
What I did was to express $f(x)$ as $f(x)=(x^2+1)g(x)$, for some polynomial $g$ (1),and $f'(x)=((x^2+1))q(x) + (x+1)$, for some polynomial $q$ (2).
From (1) I deduced another expression of $f'(x)$, (3): $$f'(x)=(x^2+1)g'(x) + 2x(g(x))$$ 
I then expressed the given expression as:
$$2f(x)+(x-1)(x^2+1) = 2(x^2+1)g(x) + (x-1)(x^2+1)$$ (4)
To find an expression for $g(x)$, I then equated (2) and (3) above, to get 
$$ 2g(x) = (x^2+1)(q(x)-g'(x) + x+1)(1/x)$$
Letting $(q(x)-g'(x) + x+1)(1/x) = h(x)$, I simplified to:
$$2g(x)= (x^2+1)h(x)$$
then here I stopped, realizing that $h(x)$ is maybe not even a polynomial. 
Any alternative method or advancement of this one will be very appreciated!
 [/INST] You can use the rule for a linear factor that $a$ is a double-root, and $(x-a)^2$ a factor, of $p(x)=0$ if and only if $p(a)=p'(a)=0$.
Use $a=i$ and $a=-i$. $(x-i)^2(x+i)^2=(x^2+1)^2$
</s>