Concerning continuity The following is a question which I need some help to solve. (Indiana University Qual 1999)
Question
Let $f : [0,1]\times[0,1] \rightarrow \mathbb{R}$ be a continuous function and define $g : [0,1] \rightarrow \mathbb{R}$ by $$g(x)=\max_{y\in [0,1]} f(x,y).$$Show that $g$ is continuous.
End of question.
This is what I have tried. Because of continuity (detail is routine and is obmitted here), for $x_0\in [0,1]$, there is a $y_0\in [0,1]$ such that $g(x_0)=f(x_0,y_0)$, then for $x\in[0,1]$,
$|g(x)-g(x_0)|=|\max_{y\in [0,1]} f(x,y)-f(x_0,y_0)|$
$\leq |\max_{y\in [0,1]} f(x,y)-f(x, y_0)|+|f(x,y_0)-f(x_0,y_0)|$
I can made this term $|f(x,y_0)-f(x_0,y_0)|$ small, but I don't seems to have control over
$|\max_{y\in [0,1]} f(x,y)-f(x, y_0)|$, any comment? 
 A: I'm not sure if your approach is the most natural here. However, it should be possible to control that term, but I would instead attempt a direct approach. There is always a danger that when you do the adding-subtracting trick with triangle inequalities, you end up doing more estimation than is necessary. Anyways, I would instead notice that $g(x) < g(x_0) + \epsilon$, and then also that $g(x)$ can't be too much less than $g(x_0)$ either since $f(x,y_0)$ can only be $\epsilon$ away from $f(x_0,y_0)$. Below is the more fleshed out approach:

As $f$ is uniformly continuous, then for any $\epsilon > 0$ we can pick $\delta > 0$ so then $|x - x_0| < \delta$ implies $|f(x,y) - f(x_0,y)| < \epsilon$ for every fixed $y$. Let $g(x_0) = f(x_0, y_0)$. Then for any $x$ with $|x - x_0| < \delta$, we have
  $$ f(x,y) < f(x_0, y) + \epsilon < g(x_0) + \epsilon$$
  Furthermore, when we fix $y =y_0$, we have that
  $$ f(x,y_0) > f(x_0, y_0) - \epsilon = g(x_0) - \epsilon$$
  Since $f(x,y_0) > g(x_0) - \epsilon$, then maximizing over all $y$ yields $g(x) > g(x_0) - \epsilon$ as well, hence we have
  $$ g(x_0) - \epsilon < g(x) < g(x_0) + \epsilon$$
  or $|g(x) - g(x_0)| < \epsilon$, as desired.

A: Here's another approach, based on sequences. Suppose $x_n \to x$; we will show $g(x_n) \to g(x)$.  
Since $f(x, \cdot)$ is a continuous function on a compact set, there exists $y_0$ with $g(x) = f(x,y_0)$.  Now $g(x_n) \ge f(x_n, y_0)$ so passing to the limit we have $\liminf_{n \to \infty} g(x_n) \ge g(x)$.
To bound the limsup, choose a subsequence $\{x_{n_k}\}$ such that $g(x_{n_k}) \to \limsup_{n \to \infty} g(x_n)$.  For each $k$ there exists $y_k$ such that $g(x_{n_k}) = f(x_{n_k}, y_k)$.  By compactness $y_k$ has a subsequence $y_{k_i}$ converging to some $y \in [0,1]$.  Now
$$g(x_{n_{k_i}}) = f(x_{n_{k_i}}, y_{k_i}) \to f(x, y) \le g(x).$$
Passing to the limit, $\limsup_{n \to \infty} g(x_n) = \lim_{i \to \infty} g(x_{n_{k_i}}) \le g(x)$.
Combining these two statements shows $g(x_n) \to g(x)$.
