\(P=\frac{sin^2x+cos^2x+2sinx.cosx-1}{\sqrt{2}\left(cosx.cos\frac{\pi}{4}-sinx.sin\frac{\pi}{4}\right).cotx}-\frac{1}{cosx-sinx}\)
\(=\frac{2sinx.cosx}{\left(cosx-sinx\right).\frac{cosx}{sinx}}-\frac{1}{cosx-sinx}=\frac{2sin^2x}{cosx-sinx}-\frac{1}{cosx-sinx}\)
\(=\frac{2sin^2x-1}{cosx-sinx}=\frac{2sin^2x-\left(sin^2x+cos^2x\right)}{cosx-sinx}=\frac{sin^2x-cos^2x}{cosx-sinx}\)
\(=\frac{\left(sinx-cosx\right)\left(sinx+cosx\right)}{cosx-sinx}=-\left(sinx+cosx\right)\)