\(B=5-x^2+2x-4y^2-4y\)
\(=-\left(x^2-2x+1\right)-\left(4y^2+4y+1\right)+7\)
\(=-\left(x-1\right)^2-\left(2y+1\right)^2+7\)
Vì: \(-\left(x-1\right)^2-\left(2y+1\right)^2\le0\)
=> \(-\left(x-1\right)^2-\left(2y+1\right)^2+7\le7\)
Dấu "=" xảy ra khi \(\begin{cases}x-1=0\\2y+1=0\end{cases}\)\(\Leftrightarrow\begin{cases}x=1\\y=-\frac{1}{2}\end{cases}\)
Vậy GTLN của B là 7 khi \(x=1;y=-\frac{1}{2}\)