Ta có : \(B=\dfrac{\left(x+z\right)^3-y^3-3xz\left(x+z\right)+3xyz}{\left(x+y\right)^2+\left(y+z\right)^2+\left(z-x\right)^2}\)
\(=\dfrac{\left(x-y+z\right)\left(x^2+z^2+2xz+yz+xy+y^2\right)-3xz\left(x-y+z\right)}{\left(x+y\right)^2+\left(y+z\right)^2+\left(z-x\right)^2}\)
\(=\dfrac{\dfrac{1}{2}\left(x-y+z\right)2\left(x^2+y^2+z^2+xy+zy-xz\right)}{\left(x+y\right)^2+\left(y+z\right)^2+\left(z-x\right)^2}\)
\(=\dfrac{\dfrac{1}{2}\left(x-y+z\right)\left[\left(x+y\right)^2+\left(y+z\right)^2+\left(z-x\right)^2\right]}{\left(x+y\right)^2+\left(y+z\right)^2+\left(z-x\right)^2}\)
\(=\dfrac{x-y+z}{2}\)