$f:[0,1] \times [0,1] → \mathbb R$ is continuous. Prove that $g(x) = \max\{f(x,y) : y \in [0,1]\}$ is defined and continuous.

Let $$f:[0,1] \times [0,1] → \mathbb R$$ be a continuous function. Prove that $$g(x) = \max\{f(x,y) : y \in [0,1]\}$$ makes sense (in that the maximum exists) and is continuous.

I said that for each $$x$$, we can consider $$A_x = \{x\} \times [0,1] \subset \text{dom } f$$. $$A_x$$ is compact, and since $$\max$$, which is acting on a continuous function $$f$$, is itself continuous,we know that (a) $$g$$ is continuous, and (b) the image $$g(A_x)$$ is compact, which means it attains a maximum and minimum. Therefore the maximum exists for each $$x$$, and by (a) $$g$$ is continuous.

Edit: It seems that the fact that $$A_x$$ isn't fixed makes the proof fail. What would a working proof look like?

• No, this reasoning is not entirely valid since $A$ is not a fixed compact set (it varies with $x$ ; you should denote it by $A(x)$ or $A_x$). So your argument does show that $g$ is well-defined but not that $g$ is continuous. – Ewan Delanoy Nov 14 '18 at 11:01
• @EwanDelanoy Fixed the notation. What part of the proof does $A$'s non-constancy cause to fail? – Tiwa Aina Nov 14 '18 at 11:03
• I already answered that in my former comment : it's the part that says that $g$ is continuous. $g$ is not defined on $A_x$, it is defined on $[0,1]$. $f$ is defined on all of $[0,1]^2$, and also by restriction on $A_x$. Note that $f$ is a two-variables function while $g$ is a one-variable function. – Ewan Delanoy Nov 14 '18 at 12:10
• Uniform continuity of $f$ can be shown to imply continuity of $g$. – random Nov 14 '18 at 12:34
• This question is relevant (math.stackexchange.com/questions/2740283/…). You can show that the family $\{f_x\}$ is equicontinuous (using uniform continuity of $f$), and note $g$ is the supremum of $\{f_x\}$ – user25959 Nov 14 '18 at 14:52

The continuity with respect to $$y$$ is irrelevant as long as the functions $$x\mapsto f(x,y)$$ are equicontinuous with respect to $$y$$: Given $$x_0$$ and an $$\epsilon>0$$, there is a $$\delta>0$$ such that $$|x-x_0|<\delta\qquad\Rightarrow\qquad|f(x,y)-f(x_0,y)|<\epsilon\quad\forall y\ .\tag{1}$$
Let an $$x_0\in[0,1]$$ and an $$\epsilon>0$$ be given. Choose a $$\delta>0$$ such that $$(1)$$ holds. If $$|x-x_0|<\delta$$ then $$f(x,y)\leq f(x_0,y)+\epsilon \leq g(x_0)+\epsilon \qquad\forall y\ .$$ It follows that $$g(x)\leq g(x_0)+\epsilon$$. Similarly $$f(x_0,y)\leq f(x,y)+\epsilon\leq g(x)+\epsilon\quad\forall y\ ,$$ and therefore $$g(x_0)\leq g(x)+\epsilon$$. In all we have proven that $$|x-x_0|<\delta$$ implies $$|g(x)-g(x_0)|\leq\epsilon$$, as required.