\(x\left(x-z\right)+y\left(y-z\right)=0\Leftrightarrow z\left(x+y\right)=x^2+y^2\)
\(P=x-\frac{xz^2}{x^2+z^2}+y-\frac{yz^2}{y^2+z^2}+\frac{x^2+y^2+4}{x+y}\)
\(P\ge x+y-\frac{xz^2}{2xz}-\frac{yz^2}{2yz}+\frac{x^2+y^2+4}{x+y}\)
\(P\ge x+y-z+\frac{x^2+y^2+4}{x+y}=x+y+\frac{x^2+y^2+4-z\left(x+y\right)}{x+y}=x+y+\frac{4}{x+y}\)
\(P\ge2\sqrt{\frac{4\left(x+y\right)}{x+y}}=4\)
\(P_{min}=4\) khi \(x=y=z=1\)