How prove this $g(x)=\sup{\{f(x,y)|0\le y\le 1\}}$ is continuous on $$

let $f(x,y):[0,1]\times[0,1]\to R$ is continuous real function.

show that
$$g(x)=\sup{\{f(x,y)|0\le y\le 1\}}$$ is continuous on $[0,1]$

My try: since $f(x,y)$ is continuous on $D=[0,1]\times [0,1]$, so $f(x,y)$ is Uniformly continuous on $D$,so
$\forall\varepsilon>0$,then exist $\delta>0$,such $|x_{1}-x_{2}|<\delta,|y_{1}-y_{2}<\delta$,then we have
$$g(x_{1})-g(x_{2})=|\sup f(x_{1},y)-\sup f(x_{2},y)|<\sup|f(x_{1},y)-f(x_{2},y)|$$

Now maybe follow is not true?

$$|\sup f(x_{1},y)-\sup f(x_{2},y)|<\sup|f(x_{1},y)-f(x_{2},y)|$$

Solutions Collecting From Web of "How prove this $g(x)=\sup{\{f(x,y)|0\le y\le 1\}}$ is continuous on $$"

Since $f(x,y)$ is continuous on $D=[0,1]\times [0,1]$, so $f(x,y)$ is uniformly continuous on $D$,so for a given $\varepsilon>0$,there exsits $\delta>0$, s.t. $$|f(x_{1},y_{1})-f(x_{2},y_{2})|<\frac{\varepsilon}{2}$$whenever $\sqrt{(x_{1}-x_{2})^2+(y_{1}-y_{2})^2}<\delta$.

Given $x_0\in[0,1]$, for all $x$ satisfy $|x-x_0|<\delta$ and $x\in[0,1]$, we have\[f(x,y)\leqslant f(x_0,y)+\frac{\varepsilon}{2}\leqslant g(x_0)+\frac{\varepsilon}{2}\Longrightarrow g(x) < g(x_0)+\varepsilon.\]Similarly, we have\[g(x_0) < g(x)+\varepsilon.\]Consequently, $|g(x_0)-g(x)|<\varepsilon$ whenever $|x-x_0|<\delta$, which implies $g(x)$ is continuous at $x=x_0$. As $x_0$ is choosed randomly, so $g(x)$ is continuous on $[0,1]$.

Let $x \in [0,1]$ be given. Then $\sup_{0 \le y \le 1}f(x,y)=f(x,y_{x})$ for some $y_{x}$ because, for a fixed x, the function $y\mapsto f(x,y)$ is continuous and, hence, achieves its maximum value.

Let $\epsilon > 0$ be given. Because $f$ is uniformly continuous on $[0,1]\times[0,1]$, there exists $\delta > 0$ such that $|f(x,y)-f(x’,y’)| < \epsilon/2$ for any points $(x,y), (x’,y’) \in [0,1]\times[0,1]$ for which $|x-x’| < \delta$ and $|y-y’| < \delta$. It follows that, if $|x-x’| < \delta$, one has $|f(x,y_{x})-f(x’,y_{x})| < \epsilon$, thereby guaranteeing that
\sup_{0\le y\le 1}f(x’,y) \ge f(x’,y_{x}) > f(x,y_{x})-\epsilon = \sup_{0\le y\le 1}f(x,y)-\epsilon.
Likewise, for $|x-x’| < \delta$,
\sup_{0 \le y \le 1}f(x,y) > \sup_{0\le y\le 1}f(x’,y)-\epsilon.
So, whenever $|x-x’| < \delta$,
\sup_{0\le y \le 1}f(x’,y)+\epsilon > \sup_{0\le y\le 1}f(x,y) > \sup_{0\le y \le 1}f(x’,y)-\epsilon,
|\sup_{0\le y \le 1}f(x,y)-\sup_{0\le y\le 1}f(x’,y)| < \epsilon.
Because $\epsilon > 0$ was arbitrary, then it follows that $x\mapsto \sup_{0\le y\le 1}f(x,y)$ is a uniformly continuous function of $x$ on $[0,1]$ and, hence, is continuous.