\(\dfrac{P}{x+2}=\dfrac{2x^3-3x^2+ax+b}{x+2}\)
\(=\dfrac{2x^3+4x^2-7x^2-14x+\left(a+14\right)x+2a+28-2a-28+b}{x+2}\)
\(=2x^2-7x+a+14+\dfrac{-2a-28+b}{x+2}\)
Để dư là -18 thì -2a-28+b=-18
=>-2a+b=-18+28=10
=>b=2a+10
Vậy: \(\left\{{}\begin{matrix}a\in R\\b=2a+10\end{matrix}\right.\)