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$. 
 A: It might be worth noticing that this can be phrased in terms of congruences
$$
\begin{cases}
f(x) \equiv 2x \pmod{(x-1)^2}\\
f(x) \equiv 3x \pmod{(x-2)^3}.
\end{cases}
$$
There is definitely a solution because of CRT, since $(x-1)^2$ and $(x-2)^3$ are clearly coprime.
The solution is of course the same the others have given, I just would like to illustrate how you get it using the general theory of system of congruences.
Now use the extended Euclidean algorithm on $(x-1)^2$ and $(x-2)^3$ to get 
$$
1 = (x-1)^2 \cdot (3x^2 -14 x + 17) + (x-2)^3 \cdot (-3x+2).
$$
So applying the general method for solving a system of congruences, write
$$
3 x - 2 x = x = (x-1)^2 \cdot (3x^3 -14 x^2 + 17 x) + (x-2)^3 \cdot (-3x^2+2x),
$$
so that
$$
3 x + (x-2)^3 \cdot (3x^2-2x) = 2 x + (x-1)^2 \cdot (3x^3 -14 x^2 + 17 x)
=
3 x^5-20 x^4+48x^3-48x^2+19 x
$$
is a solution. This is not minimal, because you can still take the remainder with respect to the lcm of $(x-1)^2$ and $(x-2)^3$ (which is their product in this case), so one gets
$$
4 x^4-27 x^3+66 x^2-65x+24.
$$
A: 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
$$
A: An alternative:
Note that if $f(x)$ satisfies the 2 properties, so does $f(x)-q(x-1)^2(x-2)^3, q \in \mathbb{Q}$. Thus the polynomial of minimal degree has degree 4. We have $f(x)=(x-2)^3(ax+b)+3x$. Note that $1$ is a repeated root of $f(x)-2x$, so $f(1)=f'(1)=2$. 
$2=f(1)=(-1)^3(a+b)+3$ so $a+b=1$. $f'(x)=3(x-2)^2(ax+b)+a(x-2)^3+3$ so $2=f'(1)=3(-1)^2(a+b)+a(-1)^3+3=6-a$ so $a=4, b=-3$.
Thus $f(x)=(x-2)^3(4x-3)+3x$
A: Let $\rm\ \hat f = f\!-\!3x = (x\!-\!2)^3 g.\: $ $\rm\: (x\!-\!1)^2\!\mid x\!+\!\hat f =  x \!+\! (x\!-\!2)^3 g =: h,\: $ so $\rm\ 0 = h(1) = 1\!-\!g(1),\,$  $\rm\,0 = h'(1) = 1\!+\!3g(1)\!-\!g'(1) = 4\!-\!g'(1).\,$ So min $\rm deg\,g = 1.$ $\rm\,g(1)\! = 1,\, g'(1)\! = 4\,$ $\Rightarrow$ $\rm g = 4x\!-\!3.$
