ĐKXĐ: \(\left\{{}\begin{matrix}x>0\\x\ne1\end{matrix}\right.\)
a) Ta có: \(P=\left(\dfrac{\sqrt{x}-1}{\sqrt{x}+1}-\dfrac{\sqrt{x}+1}{\sqrt{x}-1}\right)\cdot\left(\dfrac{1}{2\sqrt{x}}-\dfrac{\sqrt{x}}{2}\right)^2\)
\(=\left(\dfrac{\left(\sqrt{x}-1\right)^2}{\left(\sqrt{x}+1\right)\left(\sqrt{x}-1\right)}-\dfrac{\left(\sqrt{x}+1\right)^2}{\left(\sqrt{x}+1\right)\left(\sqrt{x}-1\right)}\right)\cdot\left(\dfrac{1}{2\sqrt{x}}-\dfrac{x}{2\sqrt{x}}\right)^2\)
\(=\dfrac{x-2\sqrt{x}+1-\left(x+2\sqrt{x}+1\right)}{\left(\sqrt{x}+1\right)\left(\sqrt{x}-1\right)}\cdot\dfrac{\left(x-1\right)^2}{4x}\)
\(=\dfrac{x-2\sqrt{x}+1-x-2\sqrt{x}-1}{x-1}\cdot\dfrac{\left(x-1\right)^2}{4x}\)
\(=\dfrac{-4\sqrt{x}\cdot\left(x-1\right)}{4x}\)
\(=\dfrac{-x+1}{\sqrt{x}}\)
b) Để P=2 thì \(-x+1=2\sqrt{x}\)
\(\Leftrightarrow-x+1-2\sqrt{x}=0\)
\(\Leftrightarrow x+2\sqrt{x}-1=0\)
\(\Leftrightarrow x+2\sqrt{x}+1-2=0\)
\(\Leftrightarrow\left(\sqrt{x}+1\right)^2=2\)
\(\Leftrightarrow\left[{}\begin{matrix}\sqrt{x}+1=\sqrt{2}\\\sqrt{x}+1=-\sqrt{2}\end{matrix}\right.\Leftrightarrow\left[{}\begin{matrix}\sqrt{x}=\sqrt{2}-1\\\sqrt{x}=-\sqrt{2}-1\left(loại\right)\end{matrix}\right.\Leftrightarrow x=3-2\sqrt{2}\)
Vậy: Để P=2 thì \(x=3-2\sqrt{2}\)