Lời giải:
\(\left\{\begin{matrix} x+3z=21\\ 2x+5y=51\end{matrix}\right.\Leftrightarrow \left\{\begin{matrix} z=\frac{21-x}{3}\\ y=\frac{51-2x}{5}\end{matrix}\right.\)
\(\Rightarrow x+y+z=x+\frac{51-2x}{5}+\frac{21-x}{3}=\frac{4}{15}x+\frac{86}{5}\)
\(\Rightarrow P=(x+y+z)^2=\left(\frac{4}{15}x+\frac{86}{5}\right)^2\)
Vì \(y,z\geq 0\Rightarrow \left\{\begin{matrix} x=21-3x\leq 21\\ x=\frac{51-5y}{2}\leq \frac{51}{2}\end{matrix}\right.\Leftrightarrow x\leq 21\)
Do đó: \(P\leq \left(\frac{4}{15}.21+\frac{86}{5}\right)^2=\frac{1156}{9}\)
Dấu bằng xảy ra khi \(x=21; y=\frac{9}{5}; z=0\)