\(P=\left(x+1\right)\left(x+5\right)\left(x-2\right)\left(x+8\right)\)
\(=\left(x^2+6x+5\right)\left(x^2+6x-16\right)\)
\(=\left(x^2+6x-16\right)^2+21\left(x^2+6x-16\right)\)
\(=\left(x^2+6x-16+\frac{21}{2}\right)^2-\frac{441}{4}\ge-\frac{441}{4}\)
\(P_{min}=-\frac{441}{4}\) khi \(x^2+6x-16+\frac{21}{2}=0\)
\(Q=\left(x^2+\frac{y^2}{4}+\frac{9}{4}+xy-3x-\frac{3}{2}y\right)+\frac{3}{4}\left(y^2-2y+1\right)+2017\)
\(Q=\left(x+\frac{y}{2}-\frac{3}{2}\right)^2+\frac{3}{4}\left(y-1\right)^2+2017\ge2017\)
\(Q_{min}=2017\) khi \(x=y=1\)