# Finding maximum and minimum – which points am i missing?

I would like to find the maximum and minimum of:

Domain: $$\Delta := \{(x,y)∈R^2:0\leq x,x-8\leq y\leq0\}$$

Function: $$f(x,y)=-x^2+4x+y^2+4y+4$$

I have checked the following points, but none of them yields the correct minimum:

$$(0,0)$$

$$(0,-8)$$

$$(0, -2)$$

$$(x, 0)$$

$$(x, x-8)$$

$$(2, -8)$$

$$(2, 0)$$

$$(2, -2)$$, which is where the gradient equals the zero vector.

What (points) am i missing, and why?

• Points on the boundary? – NickD Sep 23 '18 at 20:38
• Thought I had all of them? – Steffen Hansen Sep 23 '18 at 20:43
• I think you are missing the y axis between $0$ and $-8$. But how do you define $y^y$ for negative $y$? – NickD Sep 23 '18 at 21:20
• Oh, that's embarrassing on my behalf. It was supposed to say $y^2$ and not not $y^y$. Sorry. – Steffen Hansen Sep 23 '18 at 21:33

After staring at the domain for hours i finally figured it out. I realised that $$y=x-8=0$$ if $$x=8$$. In other words I let both boundaries of $$y$$ determine $$x$$. So I evaluated the function at $$(8,0)$$ which was the boundary point I was missing. And I found the correct minimum: $$f(8,0)=-(8)^2+(0)^2+4*(8)+4*(0)+4=-28$$.

In general, you have to find all points without a local variation. Those are going to be points where:

Interior points where the gradient is zero or undefined
Boundary points where the dot product of the gradient and the tangent to the boundary is zero or undefined
Corners

You looked for the first and last, and apparently in this case the correct answer was in the last category, but in general you also have to consider the second category.

Hint.

Attached the level curves map for the objective function as well as the stationary points obtained applying the Lagrange multipliers technique to solve this problem. In red we can observe the gradient direction for the restrictions at the stationary points as well as the gradient direction for the objective function at the same points (in black).

Points $$B, C, E, D$$ are the local extrema. Inside unlabeled, we can observe a saddle point. Point $$A$$ is not a feasible local extrema because the objective function's gradient (black) is not a positive combination of the corresponding restriction's gradient.

NOTE

The plot shows the maximum determination case.

$$\left[ \begin{array}{lrrr} & x & y & f(x,y) \\ D & 0 & -8 & 36 \\ & 0 & -2 & 0 \\ A & 0 & 0 & 4 \\ E & 2 & -2 & 4 \\ C & 8 & 0 & -28 \\ B & 2 & 0 & 8 \\ \end{array} \right]$$

Depending on maximum or minimum the objective gradient vector should be considered with opposite sign. According to that, points $$C,E$$ as shown are not feasible but considering a minimization $$-\nabla f$$ they could be feasible.