Determine the remainder when $f(x) = 3x^5 - 5x^2 + 4x + 1$ is divided by $(x-1)(x+2)$ This question arose while I was tutoring a student on the topic of the Remainder Theorem. Now, the Remainder Theorem tells us that when a polynomial $p(x)$ is divided by a linear factor $(x-a)$, the remainder is simply $p(a)$. However, in this case we have a product of linear factors. 
Using the Remainder Theorem we can see that neither $(x-1)$ nor $(x+2)$ is a factor of $f(x)$. Also, if we try to find the remainder using long division, we get a relatively ugly remainder of 
$$
3(14x - 13)
$$
I assume this is not the correct approach as all other questions in this topic used the Remainder Theorem. So perhaps there is a more elegant approach?
 A: Hint: the remainder will be a polynomial of degree (at most) $1$ so:
$$f(x) = (x-1)(x+2)q(x) + ax + b$$
Substitute $x=1,-2$ in the above and you get two equations in $a,b$.

[ EDIT ]   For a less conventional approach (justified in the answer here) note that $(x-1)(x+2)=0 \iff x^2=-x+2$. Repeatedly using the latter substitution:

$$
\begin{align}
3x^5 - 5x^2 + 4x + 1 &= 3 (x^2)^2 \cdot x - 5(x^2) + 4x + 1 \\
 &= 3(x^2-4x+4)x - 5(-x+2) + 4x +1 \\
 &= 3(-x+2-4x+4)x + 9x -9 \\
 &= -15(x^2)+ 18x + 9x - 9 \\
 &= -15(-x+2) + 27 x - 9 \\
 &= 42 x -39
\end{align}
$$
A: The solution is easy if we employ $\, gf\bmod gh\, =\, g(f\bmod h)\ \ $ [mod Distributive Law]
$$\begin{align}f(x)\!-\!f(a)\bmod (x\!-\!a)(x\!-\!b) &= (x\!-\!a)\left(\dfrac{f(\color{#C00}x)\!-\!f(a)}{x\!-\!a}\bmod \color{#C00}{x\!-\!b}\right)\\
&= (x\!-\!a)\left(\dfrac{f(\color{#C00}b)\!-\!f(a)}{b\!-\!a}\right)\ \ {\rm if}\ \ a\neq b\\
&= (x\!-\!a)\,\ f'(a)\qquad\qquad\ \ \,  {\rm if}\ \ a = b
\end{align}$$
In the OP $\,a=1,b=-2\,$ so above is $\:\!f(x)\!-\!3 \equiv (x\!-\!1)(42)\ $ so $\ \bbox[5px,border:1px solid #c00]{f(x) \equiv 42x-39}$

Note $ $ Above we used the Factor Theorem $\,x-a\mid f(x)-f(a),\,$ i.e. $\,f(x)\equiv f(a)\pmod{\!x-a}.\,$
The above  method does not require solving a system of equations - as some other methods do.
Below is a simple example - which may help to clarify the essence of the matter.
$\,\ \underbrace{x\!+\!2\mid f}_{\large f(-2)\ =\ 0\ }\Rightarrow\, f\bmod x^2\!-\!4\,$ $=\, (x\!+\!2)\Bigg[\dfrac{f}{x\!+\!2}\bmod x\!-\!\color{#c00}2\Bigg]$ $ =\, \underbrace{(x\!+\!2)\left[\dfrac{f(\color{#c00}{2})}{\color{#c00}2\!+\!2}\right] =\, 2(x\!+\!2)}_{\large f\bmod x-\color{#c00}2\,\ =\,\ f(\color{#c00}{2})\,\,\ =\,\ 8}$

Alternatively, if modular arithmetic is unfamiliar we can eliminate it.
Write $\ f = f(a) + (x\!-\!a) g\,\ $ by dividing $\,f\,$ by $\,x\!-\!a.\,$ Dividing $\,g\,$ by $\,x\!-\!b\,$ yields
that $\,\ \ \ f = f(a) + (x\!-\!a)(g(a)+(x\!-\!b)h)$
So $
\ f(b) = f(a) \:\!+\:\! (b\!-\!a)\,g(a)\,$ by eval at $\,x=b.\,$ Solving for $\,\color{#c00}{g(a)}\,$ & substituting in above
$$ f(x)\, =\,  \underbrace{f(a)\,+\,\color{#c00}{\dfrac{f(b)-f(a)}{b-a}} (x\!-\!a)}_{\large f(x)\,\bmod\, \color{#0a0}{(x-a)(x-b)}}\, +\, \color{#0a0}{(x\!-\!a)(x\!-\!b)} h(x)$$
The above Newton / Lagrange interpolant is precisely the Easy CRT solution of the system
$$\begin{align} f(x) \equiv f(a) &\pmod{x\!-\!a}\\ f(x)\equiv f(b)&\pmod{x\!-\!b}\end{align}\qquad$$
Generally Lagrange interpolation is a special case of CRT = Chinese Remainder Theorem. The first solution amounts to using the mod distributive law to derive Easy CRT as explained  here.
Specializing $\,b = a\,$ yields first order Taylor series expansion. For polynomials this can be done purely algebraically (no limits) - see this purely algebraic definition of the derivative.
The $\!\bmod\!$ Distributive Law can be viewed as an equivalent "shifty" operational reformulation  of  CRT = Chinese Remainder Theorem, as I explain in the end of the Remark here. It is often more convenient to apply in practice because of its operational nature, e.g. here are many examples.
A: You can mimic the proof of the remainder theorem. We want to find $r(x)$, where
$$
p(x)=(x-1)(x+2)q(x)+r(x)
$$
and $r(x)$ has degree at most $1$. From this equation, it follows that $r(1)=p(1)=3$, and $r(-2)=p(-2)=-123$. Since $r$ has degree at most $1$, 
it is linear with slope $\frac{3-(-123)}{1-(-2)}=42$, and then the point-slope formula tells us that its equation is
$$
y=42(x-1)+3=42x-39
$$
