Đặt \(\begin{cases}f\left(x\right)=\left(x^2+y^2+z^2\right)\left(x+y+z\right)^2+\left(xy+yz+zx\right)^2\\\left(x+y+z\right)^2=t\left(1\right)\end{cases}\)
\(\Leftrightarrow x^2+y^2+z^2+2\left(xy+yz+zx\right)=t\)
\(\Leftrightarrow x^2+y^2+z^2=t-2\left(xy+yz+zx\right)\)
\(\Rightarrow f\left(x\right)=\left[t-2\left(xy+yz+zx\right)\right]t+\left(xy+yz+zx\right)^2\)
\(\Rightarrow f\left(x\right)=t^2-2t\left(xy+z+zx\right)+\left(xy+yz+zx\right)^2\)
\(\Rightarrow f\left(x\right)=\left(t-xy-yz-zx\right)^2\)
Thay (1) vào ta được \(f\left(x\right)=\left[\left(x+y+z\right)^2-xy-yz-zx\right]\)
\(f\left(x\right)=\left[x^2+y^2+x^2+xy+yz+zx\right]\)