finding the remainder of $f(x)$ when divided by $(x-1)(x-2)$

$f(x)\in \mathbb{R}[x]$ is a function that has a remainder of 2 when divided by $(x-1)$, and a remainder of 1 when divided by $(x-2)$.

I know that the remainder of $f(x)$ when divided by $(x-1)(x-2)=x^2-3x+2$ needs to be $-x+3$ but I just don't know how to prove it.

I tried to write down $$f(x)=q_1(x)\cdot (x-1)+2=q_2(x)\cdot (x-2)+1$$ for $q_1,q_2\in\mathbb{R}[x]$, but I couldn't find what need's to be $p(x)\in\mathbb{R}[x]$ so that $$f(x)=p(x)\cdot (x-1)(x-2)+(-x+3)$$

• Do you know Chinese Remainder Theorem? This exercize seems to need to be solved with that. – Crostul Apr 27 '17 at 9:31
• @Crostul: I was thinking the same but the answer below gives a more direct approach. – Mathematician 42 Apr 27 '17 at 9:32
• You can apply the strategy given in the answers of Give the remainder of $x^{100}$ divided by $(x-2)(x-1)$. – Arnaud D. Apr 27 '17 at 9:33

The remainder when $f$ is divided by $(x-1)(x-2)$ is at most a first degree polynomial. That means that $f(x) = p(x)\cdot (x-1)(x-2) + (ax+b)$ for some real numbers $a, b$. Now use your knowledge of $f(1)$ and $f(2)$ to find $a$ and $b$.
Well you already write $p(x) = q(x)(x-1)(x-2) + r(x)$, and you know that $deg(r) \leq 1$. And you know $r(1) = f(1) = 2$ and $r(2) = f(2) = 1$.
Note that here we have $P(1)+1 = P(2)+2 = 3$
i.e. the polynomial $P(x)+x-3$ has roots $x=1$ and $x=2$
$\Rightarrow P(x)+(x-3) = (x-1)(x-2)Q(x) \Rightarrow P(x) = (x-1)(x-2)Q(x) -(x-3)$
Its easy to see that $a=-1, b=3$