<s>[INST] unknown polynomial divided by $x^2(x-1)$, find the remainder. I took an exam today and there's a problem stuck in my head; I still can't figure out yet.
Here's the question (just the concept as I can't remember precisely). 
An unknown polynomial divided by $(x-1)^2$ leaves the remainder of $x + 3$ (not sure about the number) and when this polynomial is divided by $x^2 $, it leaves $2x + 4$ (again, not sure about the number). From the given conditions, if this polynomial is divided by $(x-1)x^2$, what would be the remainder?
The solution as far as I figured out is this: 
first, from the division of $(x-1)^2$, I got that $f(1) = 3$
in the same way from division of $x^2$, I got $f(0) = 4.$
I can write the polynomial as follows: 
$f(x) = (x-1)(x)(x) g(x) + ax^2 +bx +c$
$ax^2 + bx + c$ is the remainder.  And to find $a,b,c$, I can use the conditions above, so I got $c = 4$ by substituting $x = 0,$ and I got $a+b+4 = 3$ by substituting $x = 1.$
This leaves $a + b = -1,$ and I can't figure out how to continue; please help.
Edit : I made a mistake $f(1)$ should be equal to $4$ and $a+b+c = 4$
 [/INST] General method, without the formal derivatives. 
Suppose
$$
f(x) = g(x) (x-1)^2 + (x+3)= h(x) x^2 + (2x + 4). 
$$
Then 
$$
(x-1)^2 f(x) = (x-1)^2 x^2 h(x) + (x-1)^2 (2x+4) \tag 1
$$
and
$$
x^2 f(x) = x^2 (x-1)^2 g(x) + x^2(x+3). \tag 2
$$
Now do the Euclidean algorithm to $x^2, (x-1)^2$:
\begin{align*}
x^2 &= (x-1)^2 + (2x-1), \\
(x-1)^2 &= \frac 14 (2x-1)(2x - 3) + \frac 14, 
\end{align*}
therefore
$$
1 = 4(x-1)^2 - (2x - 1) (2x-3) = 4(x-1)^2 - (x^2 - (x-1)^2) (2x-3) = (x-1)^2 (4 + 2x-3) - x^2 (2x - 3) = \color{blue}{(x-1)^2 (2x+1) - x^2 (2x - 3)}. 
$$
Thus $(2x+1) \cdot \mathrm {Eq}(1) - (2x - 3) \cdot \mathrm {Eq} (2)$ yields
$$
f(x) = (x-1)^2 x^2 F(x) + (2x+4) (2x+1)(x-1)^2 - (x+3)(2x-3)x^2.
$$
Since
$$
(2x+4) (2x+1)(x-1)^2 - (x+3)(2x-3)x^2 = (4x^2 + 10x + 4)(x-1)^2 - (2x^2 + 3x -9)x^2 = (4x^3 +6x^2 -6x - 4)(x-1) - ((2x+5)(x-1) -4)x^2 = x^2 (x-1) G(x) + ((-6x -4)(x-1) + 4x^2) = x^2(x-1)G(x) + (\color{red}{-2x^2 +2x +4}), 
$$
we have
$$
f(x) = x(x-1)^2 (G(x)+ xF(x)) + (\color{red}{-2x^2 +2x +4}),
$$
which means the remainder is 
$$
\color{red}{-2x^2 +2x +4}. 
$$
</s>