While preparing for my Real Analysis exam I tried to solve the following problem I found:
Problem:
Let $A \subseteq \mathbb{R}$ and suppose that $f: A \rightarrow \mathbb{R}$ has the following property: for each $\varepsilon>0$ there exists a function $g_{\varepsilon}: A \rightarrow \mathbb{R}$ such that $g_{\varepsilon}$ is uniformly continuous on $A$ and $\left|f(x)-g_{\varepsilon}(x)\right|<\varepsilon$ for all $x \in A .$ Prove that $f$ is uniformly continuous on $A$.
Attempt:
Given $A \subset \mathbb{R}$, $f: A \rightarrow \mathbb{R}$ and $\epsilon > 0$ one can obtain a function $g_{\varepsilon}$ which is uniformly continuous on $A$ such that: $$ |f(x)-g_{\varepsilon}(x)|<\frac{\epsilon}{3}, \forall x \in A $$
Given $y \in A$, one can also obtain that: $$ |f(y)-g_{\varepsilon}(y)|<\frac{\epsilon}{3}, \forall y \in A $$
Additionally, since $g_{\varepsilon}$ is uniformly continuous, $\forall \epsilon^{'} > 0$ $\exists \delta > 0$ such that $\forall x, y \in A$ $$ \left|g_{\varepsilon}(x)-g_{\varepsilon}(y)\right|<\varepsilon / 3 $$ whenever $|x - y| < \delta$
Now, considering that $$|f(x) - f(y)| = $$ $$= |f(x) - g_{\varepsilon}(x) + g_{\varepsilon}(x) - g_{\varepsilon}(y) + g_{\varepsilon}(y) - f(y)| \leq $$
$$\leq |f(x) - g_{\varepsilon}(x)| + |g_{\varepsilon}(x) - g_{\varepsilon}(y)| + |g_{\varepsilon}(y) - f(y)| < \frac{\varepsilon}{3}+\frac{\varepsilon}{3}+\frac{\varepsilon}{3}$$ $$= \epsilon$$
whenever $|x - y| < \delta$
Therefore, we conclude that f is uniformly continuous.
Questions:
1. Is the solution correct?
2. If the solution is indeed correct, is it well written?
3. If the solution is incorrect, can someone gently me explain why and provide a solution?
Thanks in advance, Lucas!