a,\(P=\dfrac{x^2+x}{x^2-2x+1}:\left(\dfrac{x+1}{x}+\dfrac{1}{x-1}+\dfrac{2-x^2}{x^2-x}\right)\)\(=\dfrac{x\left(x+1\right)}{\left(x-1\right)^2}:\left(\dfrac{\left(x+1\right)\left(x-1\right)}{x\left(x-1\right)}+\dfrac{x}{x\left(x-1\right)}+\dfrac{2-x^2}{x\left(x-1\right)}\right)\)\(=\dfrac{x\left(x+1\right)}{\left(x-1\right)^2}:\left(\dfrac{x^2-1+x+2-x^2}{x\left(x-1\right)}\right)\)
\(=\dfrac{x\left(x+1\right)}{\left(x-1\right)^2}:\left(\dfrac{x+1}{x\left(x-1\right)}\right)\)
\(=\dfrac{x\left(x+1\right)}{\left(x-1\right)^2}.\dfrac{x\left(x-1\right)}{x+1}\)
\(=\dfrac{x^2}{x-1}\)
\(b,\) Để \(P=-\dfrac{1}{2}\) hay \(\dfrac{x^2}{x-1}=-\dfrac{1}{2}\)
\(\Leftrightarrow2x^2=-\left(x-1\right)\)
\(\Leftrightarrow2x^2=-x+1\)
\(\Leftrightarrow2x^2+x-1=0\)
\(\Leftrightarrow2x^2+2x-x-1=0\)
\(\Leftrightarrow2x\left(x+1\right)-\left(x+1\right)=0\)
\(\Leftrightarrow\left(2x-1\right)\left(x+1\right)=0\)
\(\Rightarrow\left[{}\begin{matrix}2x-1=0\\x-1=0\end{matrix}\right.\Rightarrow\left[{}\begin{matrix}x=\dfrac{1}{2}\\x=-1\end{matrix}\right.\)