\(P=-\left(x+5\right)^2-\left|x-y+1\right|+2018\le0-0+2018=2018\)
\(ĐTXR\Leftrightarrow\left\{{}\begin{matrix}x=-5\\y=-4\end{matrix}\right.\)
Ta có: \(\left(x+5\right)^2\ge0\forall x\)
\(\left|x-y+1\right|\ge0\forall x,y\)
Do đó: \(\left(x+5\right)^2+\left|x-y+1\right|\ge0\forall x,y\)
\(\Leftrightarrow-\left(x+5\right)^2-\left|x-y+1\right|\le0\forall x,y\)
\(\Leftrightarrow-\left(x+5\right)^2-\left|x-y+1\right|+2018\le2018\forall x,y\)
Dấu '=' xảy ra khi \(\left\{{}\begin{matrix}x+5=0\\x-y=-1\end{matrix}\right.\Leftrightarrow\left\{{}\begin{matrix}x=-5\\y=x+1=-5+1=-4\end{matrix}\right.\)