If for every $\epsilon>0$ we obtain some continuous function $g$ such that $|f(x)-g(x)|<\epsilon$, then $f$ is also continuous The whole question: Given $f: X \rightarrow \mathbb{R}$, suppose that for every $\epsilon>0$ we can obtain some continuous function $g: X \rightarrow \mathbb{R}$ such that $|f(x)-g(x)|<\epsilon$ for any/arbitrary/whatever $x\in X$. Prove that $f$ is also continuous.
What i've tried so far: given $a\in \mathbb{R}$, manipulate 
$|f(x)-f(a)| = |f(x)-f(a)+g(a)-g(a)+g(x)-g(x)| \leq$ 
$|g(a)-f(a)|+|g(x)-g(a)|+|f(x)-g(x)|$,
and, taking some care with $\epsilon$, this would imply $|f(x)-f(a)| $ less than $\epsilon$. But i can't ensure that we are talking about the same $g$, since for every different $x$ it is possible to approximate $f$ with some $g$.
Any hints?
 A: Let $\epsilon>0$ and choose $g$ such that $|f(x)-g(x)| < {1 \over 3} \epsilon$ for all $x$.
Now choose $\delta$ such that if $x \in B(a , \delta)$ then $|g(x)-g(a)| < {1 \over 3} \epsilon$.
If $x \in B(a,\delta)$ then
$|f(x)-f(a)| \le |f(x)-g(x)| + |g(x)-g(a)| + |g(a)-f(a)| < \epsilon$.
A: For every $c>0$, there exists $g_c$ such that $|g_c(x)-f(x)|<c/3$. Let $I=[x-d,x+d]$ a closed interval containing $x$, $g_c$ is uniformly continuous on $I$, there exists $e>0$ such that $|y-z|<e$ implies $|g_c(z)-g_c(y)|<c/3, y,z\in I$.
For every $y\in [x-e/2,x+e/2]$, $|f(y)-f(x)|\leq |f(y)-g_c(y)|+|g_c(y)-g_c(x)|+|g_c(x)-f(x)|<c$.
A: Let $\epsilon>0$ be given. Hence, there exists some $g: X \rightarrow \mathbb{R}$ continuous such that $|f(x)-g(x)|<\epsilon$ for any $x\in X $. For $a \in X$, since $g$ is continuous, there is some $\delta>0$ such that $x\in X$ and $|x-a|<\delta$ implies $|g(x)-g(a)|<\epsilon/3$. In particular, for $x \in (a-\delta,a +\delta)$, the hypothesis ensures that $|f(x)-g(x)|<\epsilon/3$ and $|f(a)-g(a)|<\epsilon/3$. Thus, for $|x-a|<\delta$:
$|f(x)-g(x)|=|f(x)-f(a)+g(a)-g(a)+g(x)-g(x)|\leq |g(a)-f(a)|+|g(x)-g(a)|+|f(x)-g(x)|<\epsilon/3+\epsilon/3+\epsilon/3=\epsilon$ 
This proves that $f$ is continuous.
