# Find global maximum / minimum over a rectangular area

Find all the global maximum/minimum points of this function:

$$f(x,y) = (x-3)^2 + (y-4)^2 + 100$$
In a rectangle with vertices:

$$(-2,-1), (3,-1), (-2,1) , (3,1)$$

I tried to draw this rectangle, and I got it is:

$$[-2,3] \times [-1, 1]$$

I calculated the partial derivatives:

$$f_x = 2(x-3) = 0 \Rightarrow x = 3$$
$$f_y = 2(y-4) = 0 \Rightarrow y = 4$$

And so I got that the only point is $$(3,4)$$

Which is not on the rectangle... so there are no global max/min points ? I feel this is a wrong approach, I would appreciate your help!

Thank you!

The fact that the point you found is not in the rectangle means that, if look at the overall function, the maximum/minimum point is not in the rectangle. However, we are looking at just a small region of the function - the one which is bounded by the rectangle.

If you can imagine the graph of any function bounded by that rectangle, you will notice that it certainly has a maximum and a minimum somewhere in the border. In single variable calculus, this is explained by the extreme value theorem.

So, you should find the maximum and minimum points of the four lines which result from the intersection of the function and the planes y =1, y = -1, x = -2, and x = 3. This planes are the extension of the sides of the rectangle.

Should you have more questions I am happy to help.

Finding points where $$f_x = 0$$ and $$f_y = 0$$ gives you all of the local extrema in the interior of the region $$[-2, 3] \times [-1, 1]$$, i.e. the open rectangle $$(-2, 3) \times (-1, 1)$$. What you've shown is that there are no local extrema in the interior. However, there still might be maxima / minima on the boundary of the rectangle. (In fact, because $$[-2, 3] \times [-1, 1]$$ is compact, analysis tells us that we can find a global maximum and minimum.)

To find these global maxima and minima, you need to look at what values $$f$$ takes on the boundary of the rectangle $$[-2, 3] \times [-1, 1]$$. When is it smallest / largest?

For example, we might first look at the bottom edge of the rectangle. This is the set of points $$\{ (a, -1): a \in [-2, 3] \}$$. On this region our function $$f$$ takes on the values

$$f(x, -1) = (x- 3)^2 + (-1 - 4)^2 + 100 = x^2 - 6x^2 + 134$$

since $$y$$ is always $$-1$$ on the bottom edge of the rectangle. From here, you can use single-variable calculus to compute the value(s) of $$x$$ in $$[-2, 3]$$ for which $$f$$ is minimal / maximal.

Then, do the same thing for the other sides.

(Edit: just as you have to check the edges of the rectangle in addition to its interior, you have to check the "edges" of the sides (i.e. the four corners) in addition to the sides themselves! In other words, don't forget whether to compute f at each of the four corners and see whether it gives an extremal point.)

• By other sides you mean that we do $f(x, 1), f(-2, y), f(3,y)$ (just like you did for $f(x,-1)$)? Thanks! Aug 16 '20 at 20:30
• @StackOMeow Yes, exactly.
– aras
Aug 16 '20 at 20:30
• hey, thanks for the answer! I got there are no maximum, because each second derivative I took was a positive number (positive number -> minimum) but I wanted to ask: when I substitute these functions: $f(-2,y)$ and $f(3,y)$ I get $y=4$ for both, which is not in the rectangle, so they count? Aug 16 '20 at 20:51
• @StackOMeow Yeah, just like how $(3,4)$ doesn't apply since it's not in the domain, it looks like you have a similar situation with the left and right sides. Also, I should add—just as you have to check the edges of the rectangle in addition to its interior, you have to check the "edges" of the sides (i.e. the four corners) in addition to the sides themselves! In other words, compute $f$ at each of the four corners and see whether it gives an extremal point.
– aras
Aug 16 '20 at 21:27
• I calculated only $f(x,-1) , f(x,1) , f(-2,y) , f(3,y)$ and found the only points that match are: $(3,-1) , (3,1) \text{Minimum}$ are there any more I need to check? I am confused :( Thanks! Aug 16 '20 at 21:39

You are in the classical case where the extrema are situated on the border, therefore, it's indeed of no use to annihilate partial derivatives.

Think geometricaly: your problem deals with the intersection of a paraboloid $$P$$ whose apex is in $$(3,4,100)$$ and axis defined by $$x=3,y=4$$ and a box $$B$$ whose intersection with Oxy plane is the one you have found.

Remark : The intersection $$I=B \cap P$$ is a union of parabolic arcs.

• The lowest point of I will be along the vertical axis $$(x=3, y=1)$$ (which is the closest to P's axis). Plug these values into the equation to get $$z_{min}=109$$.

• The highest point of I will be obtained on the vertical edge of the box which is the farthest from P's axis, i.e., with coordinates $$(x=-2,y=-1)$$. Once again, plug these values into the equation to get $$z_{max}=150$$.

• Thanks for the answer! Aug 16 '20 at 20:32
• Thanks for the amazing answer !! I appreciate it very much! :-) Aug 16 '20 at 23:13