Evaluate $P(x) \bmod (x^2-x-2)$ 
Let $P(x)$ be a polynomial.
If $P(x) \bmod (x+1)=0$ and $P(x) \bmod (x-2)=6$, then evaluate $P(x) \bmod (x^2-x-2)$.

My attempt:
$$P(x)=k(x)(x-2)+6=k(x)(x+1)-3(k(x)-2)$$
$$\Longrightarrow (k(x))-2) \bmod (x+1)=0$$
$$\Longrightarrow \left(\dfrac{P(x)-6}{x-2}-2\right) \bmod (x+1)=0$$
$$\Longrightarrow (P(x)-2x-2) \bmod ((x+1)(x-2)) =0$$
$$\Longrightarrow P(x) \bmod (x^2-x-2) \equiv (2x+2) \bmod ((x+1)(x-2)) = (2x+2) \bmod (x^2-x-2)=2x+2 $$
Is my solution correct?
 A: Your solution is correct, but here is a different way to approach it. Though not stated, I'll assume we are working in $\mathbb{Q}[x]$. Notice that $(x^2 - x - 2) = (x-2)(x+1)$, i.e. it is the product of the moduli in your first two congruence equations. A quick check shows that indeed these moduli, $x+1$ and $x-2$, are coprime. This should immediately make you think of Chinese Remainder Theorem.
Let $p(x) = x+1$ and $q(x) = x-2$. We need to find the "inverses" of these, i.e. $p^{-1}(x)$ and $q^{-1}(x)$ such that:
$$
p(x)p^{-1}(x) \equiv 1 \mod q(x), \; \; \; \; \; q(x)q^{-1}(x) \equiv 1 \mod p(x).
$$
With this, the theorem gives the solution to be:
$$
P(x) \equiv a\:q(x)q^{-1}(x) + b\:p(x)p^{-1}(x) \mod (x^2-x-2). 
$$
In this case, $a=0$ and $b=6$, so we only need to find $p^{-1}(x)$. A quick computation reveals:
$$
p^{-1}(x) = x-\frac{5}{3}
$$
as:
$$
(x+1)\Big(x-\frac{5}{3}\Big) - 1= x^2 - \frac{2}{3}x - \frac{8}{3} = (x-2)\Big(x+\frac{4}{3}\Big),
$$
i.e. $p\: p^{-1} \equiv 1 \mod q$. So this gives the solution,
$$
P(x) = 6(x+1)\Big(x-\frac{5}{3}\Big) = (x+1)(6x-10) = 6x^2 -4x - 10 = 6(x^2 - x - 2) + 2x+2,
$$
which is to say:
$$
P(x) \equiv 2x+2 \mod (x^2 - x -2). 
$$
A: In as simple a case as this we can just proceed this way.
We have $P(x)= ax+b \mod (x^2-x-2)$ for some $a,b$.
That is $P(x)=ax+b+ q(x)(x+1)(x-2)$.
Putting $x=-1$ and $x=2$ gives us $-a+b=0$ and $2a+b=6$.
Hence $a=b=2$.
But in general I'd suggest that the Extended Chinese Remainder Algorithm is the way to go.
