a: \(P=\left(\dfrac{x-\sqrt{x}+2}{x-\sqrt{x}-2}-\dfrac{x}{x-2\sqrt{x}}\right):\dfrac{1-\sqrt{x}}{2-\sqrt{x}}\)
\(=\left(\dfrac{x-\sqrt{x}+2}{\left(\sqrt{x}-2\right)\left(\sqrt{x}+1\right)}-\dfrac{\sqrt{x}}{\sqrt{x}-2}\right)\cdot\dfrac{\sqrt{x}-2}{\sqrt{x}-1}\)
\(=\dfrac{x-\sqrt{x}+2-\sqrt{x}\left(\sqrt{x}+1\right)}{\left(\sqrt{x}-2\right)\left(\sqrt{x}+1\right)}\cdot\dfrac{\sqrt{x}-2}{\sqrt{x}-1}\)
\(=\dfrac{x-\sqrt{x}+2-x-\sqrt{x}}{\left(\sqrt{x}+1\right)\left(\sqrt{x}-1\right)}=\dfrac{-2\sqrt{x}+2}{\left(\sqrt{x}+1\right)\left(\sqrt{x}-1\right)}\)
\(=\dfrac{-2}{\sqrt{x}+1}\)
b: Để P là số nguyên thì \(-2⋮\sqrt{x}+1\)
=>\(\sqrt{x}+1\in\left\{1;-1;2;-2\right\}\)
=>\(\sqrt{x}\in\left\{0;-2;1;-3\right\}\)
=>\(\sqrt{x}\in\left\{0;1\right\}\)
=>\(x\in\left\{0;1\right\}\)
Kết hợp ĐKXĐ, ta được: \(x\in\varnothing\)