# Non-uniform convergence in a compact metric space

$K$ is a compact metric space and we are given a pair of continuous functions f and g: $K \rightarrow \mathbb{R}$ such that f(x) is greater than g(x) for all $x \in X$; Prove that there exists an $\epsilon$ such that $f(x)$ is greater than $g(x) + \epsilon$ for all $x \in X$

I was going to construct two sequences of continuous functions $f_n$ and $g_n$ and somehow show that they don't converge uniformly to the same point but then I got lost

-

Let $h(x):=f(x)-g(x)$ for all $x\in K$. Then $h$ is continuous and positive. Since we work on a compact space, the minimal value of $h$ is reached at say $x_0\in K$. So we can put $\varepsilon:=\frac{h(x_0)}2>0$: $f(x)\geq g(x)+h(x_0)>g(x)+\varepsilon$.

-

Here's a different approach.

Let $U_n =\{x\in X\mid$ $f(x) > g(x) + \frac{1}{n}\}$.

First, prove $U_n$ is open for each $n$ and $U_m\subseteq U_n$ when $m\leq n$. Then prove $\bigcup_n U_n = X$. Finally, use compactness of $X$ to show that $\bigcup_n U_n = U_k$ for some $k$. Then $\epsilon = \frac{1}{k}$ works.

-
Just for fun, here's a "third approach". (Although, this one may be slightly over-complicated and/or needs quite a bit of justification.) Since $f$ and $g$ are continuous functions $K\to\mathbb R$ and $K$ is compact, their graphs $\Gamma_f$ and $\Gamma_g$ must be compact. Now, because $f$ is always greater than $g$, $\Gamma_f$ and $\Gamma_g$ are also disjoint. But then $\Gamma_f$ and $\Gamma_g$ must be a positive distance apart, which proves the claim.
Added: to avoid confusion I shall add some further remarks. The graphs $\Gamma_f$ and $\Gamma_f$ are subsets of $K\times\mathbb R$. There are many ways to equip a product of two metric spaces with a product metric. So, $K\times\mathbb R$ is itself a metric space. Since the product metric gives rise to the product topology on $K\times\mathbb R$, the maps $(id_K,f):K\to K\times\mathbb R$ and $(id_K,g):K\to K\times\mathbb R$ are continuous, so their images, which are precisely $\Gamma_f$ and $\Gamma_g$, must are compact. Now, if $X$ is a metric space and $A,B\subseteq X$ it makes sense to define $d(A,B)=\inf\limits_{a\in A, b\in B}d(a,b)$. This usually isn't a metric, but we can prove that if $A$ and $B$ are compact and disjoint, $d(A,B)$ is positive. (Although this last fact is about as hard to prove as the original problem, which is why I am saying that this approach may be slightly over-complicated.)