Ta có: (x-y+x)2 + (z-y)2 + 2(x-y+z)(y+z)
= x2+y2+x2-2xy-2xy+2x2+z2-2zy+y2+2xy+2xz-2y2-2yz+2yz+2z2
= 4x2-2xy+2xz+3z2
\(\left(x-y+x\right)^2+\left(z-y\right)^2+2\left(x-y+z\right)\left(y+z\right)\)
\(=\left(2x-y\right)^2+z^2-2zy+y^2+2\left(x-y+z\right)y+2\left(x-y+z\right)z\)
\(=4x^2-4xy+y^2+z^2-2zy+y^2+2xy-2y^2+2yz+2xz-2yz+2z^2\)
\(=4x^2+\left(y^2+y^2-2y^2\right)+\left(z^2+2z^2\right)+\left(-4xy+2xy\right)+\left(2yz-2yz-2yz\right)+2xz\)
\(=4x^2+3z^2-2xy-2yz+2xz\)