Math Help - Dividing polynomials

1. Dividing polynomials

If a polynomial is divided by (x+2), the remainder is -19. When the same polynomial is divided by (x-1), the remainder is 2. Determine the remainder when the polynomial is divided by (x-1)(x+2).

2. Hi!
We know that $p(x)=k_1 (x)(x+2)-19$ and $p(x)=k_2 (x)(x-1)+2$ where $k_1 (x)$ and $k_2 (x)$ are two polynomials such that $deg(k_1 (x))=deg(k_2(x))$.
Thus, $p(1)=2$ and $p(-2)=-19$.

The remainer, when dividing $p(x)$ by $(x-1)(x+2)$ can be of degree 1 at most since $(x-1)(x+2)$ is a polynomial of degree 2.
This is, $r(x)=ax+b$ and
$p(x)=k_3(x)(x-1)(x+2)+r(x)=k_3(x)(x-1)(x+2)+ax+b$ where $k_3(x)$ is a polynomial of degree $deg(k_1(x))-1$

We see that $p(1)=a+b$ and $p(-2)=-2a+b$ but we know that $p(1)=2$ and $p(-2)=-19$ so we've to solve a linear system of equations in the unknowns a and b. It's easy to solve this system and the solution is $\begin{cases} -2a+b=-19 \\ a+b=2 \end{cases} \, \, \, \, \, \, \, \, \, \Longrightarrow \, \, \, \, \, \, \, \, \, \begin{cases} a=7 \\ b=-5 \end{cases}$

Therefore, the reaminder when $p(x)$ is divided by $(x-1)(x+2)$ is $r(x)=7x-5$