(If P(x) is linear, then you can't divide by \(\displaystyle (x-1)(x+2)\) and get a remainder, so we'll assume they meant to say that P(x) is at least quadratic).

\(\displaystyle P(x)=(x-1)(x+2)Q(x)+R(x) \quad\) (1)

where R(x) is \(\displaystyle ax+b\)

(Note you are dividing by a quadratic, so the remainder may be linear).

Now substitute \(\displaystyle x=1\) and \(\displaystyle x=-2\) into equation (1) and use the facts that you know: \(\displaystyle P(1)=1\) and \(\displaystyle P(-2)=-8\), to find \(\displaystyle a\) and \(\displaystyle b\).