Continuity of a very familiar function. Let $f:\left[0,1\right]\times\left[0,1\right]\rightarrow\mathbb{R}$
be continuous and let $g:\left[0,1\right]\rightarrow\left[0,1\right]$
be also a continuous function. Is the following function continuous?
\begin{eqnarray*}
h:\left[0,1\right] & \rightarrow & \mathbb{R}\\
x & \rightarrow & \sup_{g\left(x\right)\leq t\leq1}f\left(t,x\right)
\end{eqnarray*}
Thank you.
 A: Define $\phi(x,s) = f(g(x)+s(1-g(x)), x)$, then $h(x) = \max_{t \in [0,1]} \phi(x,t)$.
Suppose $x_n \to x$, then $\phi(x_n,t) \to \phi(x,t)$ for all $t$ and since
$h(x_n)\ge \phi(x_n,t)$, we see $\liminf_n h(x_n) \ge \phi(x,t)$ for all $t$ and
so $\liminf_n h(x_n) \ge h(x)$.
Let $t_n$ be such that $h(x_n) = \phi(x_n,t_n)$, then let $x_{n_k}, t_{n_k}$
be such that
$\phi(x_{n_k}, t_{n_k}) \to \limsup_n h(x_n)$ and $ t_{n_k} \to t^*$, then
$\phi(x_{n_k}, t_{n_k}) \to \phi(x,t^*) \le h(x)$ and
so
$\limsup_n h(x_n) \le h(x)$.
Hence $\lim_n h(x_n) = h(x)$ and so $h$ is continuous.
A: Note that $f$ and $g$ are uniformly continuous. Let the metric $d$ on $[0,1]\times[0,1]$ be $d((a,b),(x,y))=|x-a|+|y-b|$. This is equivalent to the usual metric. Fix $\varepsilon>0$ and pick $\delta_1,\delta_2>0$ so small that if $|a-b|<\delta_1$, then $|g(a)-g(b)|<\dfrac{\delta_2}{2}$ where if $d((a,b),(x,y))<\delta_2$, then $|f(a,b)-f(x,y)|<\varepsilon$.  Let $x_0\in[0,1]$ and $\delta=\dfrac{1}{2}\min\{\delta_1,\delta_2\}$. 
If $|x-x_0|<\delta$, then $|h(x)-h(x_0)|=\left|\sup_{g(x)\le t\le 1}f(t,x)-\sup_{g(x_0)\le t\le 1}f(t,x_0)\right|$. The sups are attained because of  compactness, so we may as well let $f(a,x)=\sup_{g(x)\le t\le 1}f(t,x)$ and $f(b,x_0)=\sup_{g(x_0)\le t\le 1}f(t,x_0)$. Note that $|f(g(x),x)-f(g(x_0),x_0)|<\varepsilon$ as we contrived that $|g(x)-g(x_0)|+|x-x_0|<\delta_2$.
First suppose that $a$ and $b$ do not lie between $g(x)$ and $g(x_0)$. Then $f(a,x)<f(a,x_0)+\varepsilon\le f(b,x_0)+\varepsilon$ and $f(b,x_0)<f(b,x)+\varepsilon\le f(a,x)+\varepsilon$. Hence, $|f(a,x)-f(b,x_0)|<\varepsilon$. 
Now suppose WLOG that $b$ is between $g(x)$ and $g(x_0)$ (the case of $a$ is identical). We have that $|f(a,x)-f(a,x_0)|<\varepsilon$ and $|f(g(x),x)-f(b,x_0)|<\varepsilon$. Hence, $f(a,x)<\varepsilon+f(a,x_0)\le \varepsilon+f(b,x_0)$ and $f(b,x_0)<\varepsilon +f(g(x),x)\le \varepsilon +f(a,x)\ldotp$ Hence, $|f(a,x)-f(b,x_0)|<\varepsilon$.
Hence, $h$ is continuous.
