Answer
The maximum of $f$ is $5$ on the square $0 \le x \le 2$, $0 \le y \le 2$.
Work Step by Step
We have $f\left( {x,y} \right) = {y^2} + xy - {x^2}$ and the domain is the square $0 \le x \le 2$, $0 \le y \le 2$.
Step 1. Find the critical point on the square and evaluate $f$ at this point
The partial derivatives are
${f_x} = y - 2x$, ${\ \ \ }$ ${f_y} = 2y + x$
To find the critical points we solve the equations ${f_x} = 0$ and ${f_y} = 0$:
${f_x} = y - 2x = 0$, ${\ \ \ }$ ${f_y} = 2y + x = 0$
From the first equation we get $y=2x$.
Substituting it in the second equation gives
$5x=0$
So, the solutions are $x=0$ and $y=0$.
There is only one critical point at $\left( {0,0} \right)$. We have the value: $f\left( {0,0} \right) = 0$.
Step 2. Check the boundaries
1. On the bottom edge of the square, $y=0$.
Write $g\left( x \right) = f\left( {x,0} \right) = - {x^2}$.
Find the extreme values of $f$ on the bottom edge.
The critical points of $g$ can be found by solving the equation $g'\left( x \right) = 0$.
$g'\left( x \right) = - 2x = 0$
$x=0$
So, the extreme values of $f$ on the bottom edge is $g\left( 0 \right) = f\left( {0,0} \right) = 0$. This result is the same with the one we have obtained previously. This is the maximum value of $g$ along the bottom edge since $g \le 0$.
2. On the top edge of the square, $y=2$.
Write $h\left( x \right) = f\left( {x,2} \right) = 4 + 2x - {x^2}$.
Find the extreme values of $f$ on the top edge.
The critical points of $h$ can be found by solving the equation $h'\left( x \right) = 0$.
$h'\left( x \right) = 2 - 2x = 0$
$x=1$
So, the extreme value of $f$ along $y=2$ is $h\left( 1 \right) = f\left( {1,2} \right) = 5$.
3. On the left edge of the square, $x=0$.
Write $m\left( y \right) = f\left( {0,y} \right) = {y^2}$.
Find the extreme values of $f$ on the left edge.
The critical points of $m$ can be found by solving the equation m'(y)=0.
$m'\left( y \right) = 0$
$y=0$
So, the extreme value of $f$ along $x=0$ is $m\left( 0 \right) = f\left( {0,0} \right) = 0$. This has been accounted for in our previous result. The maximum value of $m$ is $m\left( 2 \right) = f\left( {0,2} \right) = 4$.
4. On the right edge of the square, $x=2$.
Write $n\left( y \right) = f\left( {2,y} \right) = {y^2} + 2y - 4$.
Find the extreme values of $f$ on the right edge.
The critical points of $n$ can be found by solving the equation $n'\left( y \right) = 0$.
$n'\left( y \right) = 2y + 2 = 0$
$y=-1$
So, the extreme value of $f$ along $x=2$ is $n\left( { - 1} \right) = f\left( {2, - 1} \right) = - 5$. The maximum value of $n$ along the right edge is $n\left( 2 \right) = f\left( {2,2} \right) = 4$.
Step 3. Compare the values of $f$
The largest value of $f$ among the values computed previously is $f\left( {1,2} \right) = 5$.
Hence, the maximum of $f$ is $5$ on the square $0 \le x \le 2$, $0 \le y \le 2$.