<s>[INST] Where did I go wrong in applying the remainder theorem? 
When the expression $3x^3 + px^2 + qx + 8$ is divided by $x^2 - 3x + 2$, the remainder is $5x + 6$. Find the values of $p$ and $q$.

I tried to answer this question using the factor theorem (remainder theorem in this case), but got the answer wrong:
$$ \text{Let} f(x) = 3x^3 + px^2 + qx + 8 $$
$$ \text{Using remainder theorem,}$$
\begin{align}
f(x) &= (x^2 - 3x + 2)Q(x) + (5x + 6) \\
f(x) &= (x - 2)(x - 1)Q(x) + (5x + 6)
\end{align}
$$ \text{When } x = 2, $$
\begin{align}
f(2) &= (2 - 2)(2 - 1)Q(2) + (5(2) + 6) \\
3(2)^3 + p(2)^2 + q(2) + 8 &= 10 + 6 \color{red}{\leftarrow (1)}
\end{align}
$$ \text{When } x = 1, $$
\begin{align}
f(1) &= (1 - 2)(1 - 1)Q(x) + (5 + 6) \\
3(1)^3 + p(1)^2 + q(1) + 8 &= 5 + 6 \color{limegreen}{\leftarrow (2)}
\end{align}
$$ \text{From } \color{red}{(1)}: $$
\begin{align}
3(8) + p(4) + 2q + 8 &= 16 \\
24 + 4p + 2q + 8 &= 16 \\
12 + 2p + q + 4 &= 16 \\
q &= 16 - 16 - 2p \\
q &= -2p \color{blue}{\leftarrow (3)}
\end{align}
$$ \text{From } \color{limegreen}{(2)}: $$
\begin{align}
3 + p + q + 8 &= 11 \\
p + q + 11 &= 11 \\
p &= 11 - 11 - q \\
p &= -q \\
-q &= p \\
q &= -p \color{mediumpurple}{\leftarrow (4)}
\end{align}
$$ \color{mediumpurple}{(4)} + \color{blue}{(3)}: $$
\begin{align}
-p &= -2p \\
2p - p &= 0 \\
\therefore p &= 0
\end{align}
$$ \text{Substitute } p = 0 \text{ into } \color{mediumpurple}{(4)}: $$
\begin{align}
q &= -0 \\
\therefore q &= 0
\end{align}
The answers were $ p = -8, q = 8 $.
Where did I go wrong?
 [/INST] It's difficult to keep track of all the lines, but you have the correct idea. In one case we have
$$f(2)=5\cdot 2+6\Rightarrow 24+4p+2q+8=16\Rightarrow2p+q=-8$$
and in the other case we have
$$f(1)=5\cdot(1)+6\Rightarrow 3+p+q+8=11\Rightarrow p+q=0$$
From the second equation we get $q=-p$ so by plugging that in into the first equation we get $2p-p=-8$ which gives $p=-8$ and therefore $q=8$.
Since you got $p=-q$, the error must be related to your equation (1), and here it is: after the line
$$24+4p+2q+8=16$$
you've divided by two to get $12+2p+q+4$ on the left, but didn't divide $16$ with $2$ to get $8$ on the right.
</s>