Finding polynomial given the remainders Question: Find a polynomial $f(x) \in \mathbb{Q} (x)$ of minimal degree that has both the following properties:
When $f(x)$ is divided by $(x-1)^2$, the remainder is $2x$; and when $f(x)$ is divided by $(x-2)^3$, the remainder is $3x$.
Answer provided: $f(x)=(x-2)^3 \cdot (4x-3)+3x$
Work so far: Okay, so I know this problem shouldn't be difficult, but I've been stumped. I know that this is probably a simple application of the division algorithm, where $f(x)=q(x) \cdot d(x)+r(x)$ but I can't seem to get an answer. The polynomial's minimum degree should be $4$, intuitively.
So I have that $f(x)=(x-1)^2 \cdot q_1(x) + 2x$ and $f(x)=(x-2)^3 \cdot q_2(x)+3x$. Then I know that for the second equation, $q_2(x)$ should be of form $(ax+b)$ for some $a,b \in \mathbb{Q}$, also I also applied the remainder theorem to find that $f(1)=4$ and that $f(2)=6$, and so 
$f(1)=4=(-1)^3 \cdot (a+b) +3(1) \rightarrow a+b=1$ 
so it makes sense that the answer is $q_2(x)=4x-3$, but I don't know how to get there after finding $a+b=1$. 

Rather than attempting to match two solutions, construct the solution using one remainder, and then solve using the other one, like this:
$$
f(x) = (x-2)^3g(x)+3x
$$
Therefore, mod $(x-1)^2$,
$$
f(x) = (3x-4) g(x) + 3x = 2x
$$
Therefore, $(3x-4)g(x) = -x$ under mod $(x-1)^2$.
Now, we just need to find the polynomial that is the inverse of $(3x-4)$.
$$
(ax+b)(3x-4) = 3ax^2+(3b-4a)x-4b = (2a+3b)x-(3a+4b) = 1
$$
Now, $2a+3b=0$ and $-3a-4b=1$, so $b=2$ and $a=-3$. Therefore,
$$
g(x) = -x(-3x+2) = 3x^2-2x = 3(2x-1)-2x = 4x-3
$$
So $g(x)=4x-3$, and the answer is
$$
f(x) = (x-2)^3(4x-3)+3x
$$
