# Maximize function of two variables

Let $f: X \times Y \rightarrow \mathbb{R}$ be a continuous function, where $X \subset \mathbb{R}^n$ and $Y \subset \mathbb{R}^m$ are compact sets.

Say under which conditions we have that

$$\max_{x \in X} \max_{y \in Y} f(x,y) = \max_{y \in Y} \max_{x \in X} f(x,y)$$

-
If $f$ has a unique maximum on $X \times Y$, in particular. – Sasha Aug 31 '12 at 15:43
Something less restrictive? For instance, what happens if $f$ is concave in $x$ (for fixed $y$) and also concave in $y$ (for fixed $x$)? – Adam Aug 31 '12 at 15:48
Well, $\sup_X \sup_Y f(x,y) = \sup_Y \sup_X f(x,y)$ and by continuity and compactness the extreme values are attained, so this must be true. – copper.hat Aug 31 '12 at 17:22

Since $f$ is continuous on the compact set $X\times Y$, it has a maximum $m$, say at $(x_0,y_0)$.
Now, $y\mapsto \max_x f(x,y)$ is a function which takes value $m$ at $y_0$, so $\max_y \max_x f=m$. Using this argument the other way around, we get the wanted equality.
You define $x^*(y):= \arg \max_{x \in X} f(x,y)$, so that $x^*(y_0) = m$. Now, why this implies that $\max_{y \in Y} \max_{x \in X} f(x,y) = m$? – Adam Aug 31 '12 at 16:00
This is not exactly what I do. The function I define is as follow : for a given $y$, $x\mapsto f(x,y)$ is a continuous function so I can take its maximum, which is \max_x f(x,y). If $y=y_0$, the function $x\mapsto f(x,y_0)$ has value $m$ at $x_0$ and no more anywhere else, so its maximum is $m$. Since for any other $y$, $max_x f(x,y)<max_{X\times Y} f=m$, we have the desired result. – zozoens Aug 31 '12 at 16:11
So basically we have $\max_{(x,y)\in X \times Y} f(x,y) = \max_{x \in X} \max_{y \in Y} f(x,y) = \max_{y \in Y} \max_{x \in X} f(x,y)$? – Adam Aug 31 '12 at 16:15
Indeed. Not related, I should edit my earlier comment by saying $max_x f(x,y)\leq max_{X\times Y}$ instead of $<$ (it doesn't change anything to the proof). – zozoens Aug 31 '12 at 16:22