# Extreme values of a two-variable continuous function on a connected closed domain

I wonder if there exists a continuous two-variable function on a connected closed domain which has only two extreme values, one of them is local maximum and another is local minimum but the local minimum is strictly greater than the local maximum. I think there may exist a counterexample but I don't know how to find it. Thank John for giving a nice example!

$f(x, y) = x + 2 \sin x + x y^2$ (on a properly chosen domain)

• It seems like if you can do it in two variables then by taking a slice you would have an example in one variable. But thinking about this in one variable, it seems there cannot be any such function. Just my intuition but my intuition tells me this should not be hard to prove, probably follows from the intermediate value. – Gregory Grant May 26 '15 at 9:28
• @GregoryGrant The further local extrema of the slice would need to be saddle points of the 2-d function. It could be possible. – Daniel Fischer May 26 '15 at 9:29
• @DanielFischer Right, now that I think about saddle points, I can picture an example. I wouldn't know how to define such a function explicitly though. Just take the basic saddle and put a dimple down somewhere on the way up and a dimple up somewhere on the way down. – Gregory Grant May 26 '15 at 9:35

Let $f(x) = x + 2\sin x$. It looks something like this:
It has a local maximum at $a$, $-b$ and local minimum at $b, -a$, where $0<a<b$. Then the function (defined in a suitable domain) $$F(x, y) = f(x) + x y^2 = x + 2 \sin x + x y^2$$