If $f(x)=\sup_{y\in K}g(x, y)$a continuous function on topological space Let X a topological space and   $K$ a compact subset on X. Consider a continuous function $g:K\times K\longrightarrow \mathbb R$. Define $f:K\longrightarrow \mathbb R$ by, $$f(x)=\sup_{y\in K}g(x, y).$$ Is $f$ a continuous function?
if X is metric space we can use uniform continuity as here
 A: The space $X$ is unnecessary. Let us prove the following more general theorem:
Let $Y$ be any space and $K$ be a compact space. Let $g : Y \times K \to \mathbb R$ be continuous. Then
$$f : Y \to \mathbb R, f(y) = \sup_{k \in K} g(y,k)$$
is continuous.
Proof: Let $y_0 \in Y$ and $t_0 = f(y_0)$. Consider $\epsilon > 0$.

*

*Choose $k_0 \in K$ such that $g(y_0,k_0) > t_0 - \epsilon$. There exist open neighborhoods $U$ of $y_0$ in $Y$ and $V$ of $k_0$ in $K$ such that $g(U \times V) \subset  (t_0 - \epsilon,  t_0 + \epsilon)$. For $y \in U$ we get
$$f(y) \ge g(y,k_0) >  t_0 - \epsilon .$$


*$W = g^{-1}((-\infty, t_0 + \epsilon/2))$ is open in $Y \times K$. For $k \in K$ we have $g(y_0,k) \le f(y_0) = t_0 < t_0 +  \epsilon/2$, thus $g(\{y_0\} \times K) \subset (-\infty, t_0 + \epsilon/2)$. This means $\{y_0\} \times K \subset W$. Since $K$ is compact, the tube lemma shows that there exists an open neighborhood $U'$ of $y_0$ in $Y$ such that $U' \times K \subset W$. For $y \in U'$ we get
$$f(y) = \sup_{k \in K} g(y,k) \le t_0 + \epsilon/2 < t_0 + \epsilon .$$
Thus $U'' = U \cap U'$ is an open neighborhood of $y_0$ in $Y$ such that $f(U'') \subset (t_0 - \epsilon,  t_0 + \epsilon)$.
