\(P=sin^4x+\left(sin^2\left(x+\frac{\pi}{4}\right)\right)^2+cos^4x+\left(cos^2\left(x+\frac{\pi}{4}\right)\right)^2\)
\(=\left(\frac{1}{2}-\frac{1}{2}cos2x\right)^2+\left(\frac{1}{2}-\frac{1}{2}cos\left(2x+\frac{\pi}{2}\right)\right)^2+\left(\frac{1}{2}+\frac{1}{2}cos2x\right)^2+\left(\frac{1}{2}+\frac{1}{2}cos\left(2x+\frac{\pi}{4}\right)\right)^2\)
\(=\frac{1}{4}-\frac{1}{2}cos2x+\frac{1}{4}cos^22x+\frac{1}{4}+\frac{1}{2}sin2x+\frac{1}{4}sin^22x+\frac{1}{4}+\frac{1}{2}cos2x+\frac{1}{4}cos^22x+\frac{1}{4}-\frac{1}{2}sin2x+\frac{1}{4}sin^22x\)
\(=1+\frac{1}{2}\left(sin^22x+cos^22x\right)=\frac{3}{2}\)