a: \(P=\left[\left(x-2\right)\left(x^2+2x+4\right)\cdot\dfrac{x+2}{x^2+2x+4}-\dfrac{\left(x-2\right)\left(x+2\right)}{x^2+2x+4}\cdot\dfrac{\left(x-2\right)\left(x^2+2x+4\right)}{x+2}\right]:\left(x-1\right)\)
\(=\dfrac{\left[x^2-4-\left(x-2\right)^2\right]}{x-1}\)
\(=\dfrac{x^2-4-x^2+4x-4}{x-1}=\dfrac{4x}{x-1}\)
b: Để P là số nguyên thì \(4x-4+4⋮x-1\)
\(\Leftrightarrow x-1\in\left\{1;-1;2;-2;4;-4\right\}\)
hay \(x\in\left\{0;3;-1;5;-3\right\}\)