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.