Do \(P\left(x\right)\) chia \(x-1;x-2;x-3\) đều dư 6
\(\Rightarrow P\left(x\right)-6\) chia hết cho cả \(x-1;x-2;x-3\)
Mà \(P\left(x\right)\) bậc 3 \(\Rightarrow P\left(x\right)-6\) cũng bậc 3
\(\Rightarrow P\left(x\right)-6=k\left(x-1\right)\left(x-2\right)\left(x-3\right)\) với \(k\ne0\)
\(\Rightarrow P\left(x\right)=k\left(x-1\right)\left(x-2\right)\left(x-3\right)+6\)
Lại có \(P\left(-1\right)=-18\Leftrightarrow k\left(-2\right)\left(-3\right)\left(-4\right)+6=-18\)
\(\Rightarrow k=1\)
Vậy \(P\left(x\right)=\left(x-1\right)\left(x-2\right)\left(x-3\right)+6\)