Calculus – Is Supremum Over a Compact Domain of Separately Continuous Function Continuous?

calculuscontinuitymetric-spacesmultivariable-calculusreal-analysis

Let $(X,d_X)$ and $(Y,d_Y)$ be metric spaces, and consider the product metric space $(X\times Y,d)$ with a product metric $d$.

Let $f(x,y):X\times Y\to \mathbb{R}$ be a separately continuous function.

Suppose $X$: compact.

Is $g(y)=\sup\limits_{x\in X}f(x,y)$ continuous?

What if $Y$ is also compact?


++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++

Suppose $X$ is not compact. Then, it fails even when $f$ is (jointly) continuous.
A counter example is given http://at.yorku.ca/cgi-bin/bbqa?forum=ask_an_analyst_2005&task=show_msg&msg=4110.0001.
That $x$ can go as far as possible does bad.

Another counter example where $X$ is not compact is Supremum of continuous functions is continuous?.

Suppose $X$ and $Y$ are compact, and $f$ is (jointly) continuous. Following the argument here:
How prove this $g(x)=\sup{\{f(x,y)|0\le y\le 1\}}$ is continuous on $[0,1]$
it seems to hold, using $f$ being uniformly continuous on $X\times Y$.

Go back to my question. In this case, we cannot use the uniform continuity. I tried doing the following and got stuck. From the compactness of $X$ and continuity in $x$, we can take $x^*_j\in\mathrm{argmax}_x f(x,y_j)$, ($j=1,2$), and
$$
|g(y_1)-g(y_2)|\le |f(x_1^*,y_1)-f(x_1^*,y_2)|+|f(x_1^*,y_2)-f(x_2^*,y_2)|.
$$
The first term is good as $f(x_1^*,\cdot)$ is continuous, but I could not do anything with the second term, and started to think maybe this is not true.

Best Answer

Here is a counterexample.

Take $f\colon [0,1]\times[0,1]\to \mathbb R$ defined by: $$ f(x,y) = \frac{2xy}{x^2+y^2},\quad f(0,0)=0. $$ Notice that $2xy = x^2 + y^2 - (x-y)^2 \le x^2+y^2$ hence $f(x,y)\le 1$. While $f(y,y) = 1$.

Of course $f$ is separately continuous, but for $y>0$ one has: $$ \sup_x f(x,y) = f(y,y) = 1 $$ while $f(x,0)=0$ hence $\sup_x f(x,0) = 0$.