TITLE: Continuity of function given as a maximum
QUESTION [7 upvotes]: Let $f(x,y)$ is continuous in $[a,b]\times[c,d]$, and we define the function $g(y)$ as follows $$g(y):=\max_{x\in[a,b]}f(x,y),\quad\forall y\in[c,d].\tag{1}$$
The question is when we can conclude that $g\in C[c,d]$, or provide a counterexample to show $g$ is not a continuous function again? Any answer will be appreciated!

REPLY [5 votes]: We first note that $f$ is uniformly continuous, because it is a continuous functions defined in a compact set. This implies that for given $\alpha\in [c,d]$ and $\epsilon>0$, we can find some $\delta>0$ such that $$\tag{1}f(x,\alpha)-\epsilon\leq f(x,y)\leq f(x,\alpha)+\epsilon,\ \forall\ x\in [a,b]$$
We conclude from $(1)$ that $$\tag{2}g(y)\geq\max_{x} \{f(x,\alpha)-\epsilon\}$$
On the other hand $$\tag{3}f(x,y)\leq f(x,\alpha)+\epsilon\leq g(\alpha)+\epsilon $$
Hence, from $(3)$, we have that $$\tag{4}g(y)\leq g(\alpha)+\epsilon$$
By combining $(2)$ and $(4)$ we get the result.