Để \(P\in Z\) thì \(x-2⋮x+1\)
\(\Rightarrow\left(x+1\right)-3⋮x+1\)
\(\Rightarrow3⋮x+1\)
\(\Rightarrow x+1\inƯ\left(3\right)\)
\(\Rightarrow x+1\in\left\{\pm1;\pm3\right\}\)
\(\Rightarrow x\in\left\{0;-2;2;-4\right\}\)
Vậy \(x\in\left\{0;-2;-4;2\right\}\).