<s>[INST] Find the remainder when $f(x)$ is divided by $x^2+x-2$ 
When $f(x)$ is divided by $x-1$ and $x+2$, the remainders are $4$ and $-2$ respectively. Find the remainder when $f(x)$ is divided by $x^2+x-2$.

Please help. The answer is $2x+2$.
I tried to understand the link between the first sentence and the second sentence but all I could make out was $f(1)=4$ ($4$ being the remainder) and $f(-2)=-2$.
I also broke down $x^2+x-2$ into $(x-1)(x+2)$ but after that, I didn't know how to continue. It seemed like there was a link as both have $x-1$ and $x+2$. I tried to attempt it myself for quite a long time but I couldn't make out anything. I'm not sure what I made out was even on the correct track though. 
 [/INST] Use the Chinese Remainder theorem (Wikipedia link) in the ring of polynomials.
You'll want to look at the polynomials $g=\frac{1}{3}(x+2)$ and $h=-\frac{1}{3}(x-1)$, which satisfy
$$\begin{align*}
g&\equiv 1\bmod (x-1) & h&\equiv 0\bmod(x-1)\\
g&\equiv 0\bmod (x+2) & h&\equiv 1\bmod (x+2)
\end{align*}$$
Thus, for any $a$ and $b$,
$$\begin{align*}
ag+bh&\equiv a\bmod (x-1)\\
ag+bh&\equiv b\bmod (x+2)
\end{align*}$$
In particular, the polynomial 
$$k=4g-2h=(\tfrac{4}{3}x+\tfrac{8}{3})+(\tfrac{2}{3}x-\tfrac{2}{3})=2x+2$$
has the property that
$$\begin{align*}
k&\equiv \hphantom{-}4\bmod (x-1)\\
k&\equiv -2\bmod (x+2)
\end{align*}$$
The Chinese remainder theorem then guarantees that $f\equiv k\bmod (x^2+x-2)$ for any $f$ such that $f(1)=4$ and $f(-2)=-2$.
</s>