Let $(X,d)$ be a metric space. Then
- The space of bounded uniformly continuous functions is dense in that of bounded continuous functions w.r.t. the supremum norm. ref
- The space of bounded Lipschitz continuous functions is dense in that of bounded uniformly continuous functions w.r.t. the supremum norm. ref
Does the following relaxation hold?
- The space of uniformly continuous functions is dense in that of continuous functions w.r.t. the supremum norm.
- The space of Lipschitz continuous functions is dense in that of uniformly continuous functions w.r.t. the supremum norm. ref
Update 1: In the paper "Approximation of Continuous Functions by Lipschitz Functions", the author Radu Miculescu said that
- A continuous function $f: X \rightarrow \mathbb{R}$, where $X$ is a metric space, is a uniform limit of a sequence of locally Lipschitz maps from $X$ to $\mathbb{R}$.
- There exist continuous functions that cannot be the uniform limit of a sequence of Lipschitz functions.
Update 2: I write the counter-example of the second statement suggested by Mindlack here.
Let $d(x,y) := \min\{|x-y|,1\}$ be metric on $\mathbb R$. Assume $f: (\mathbb R, d) \to (\mathbb R, |\cdot|)$ is any $L$-Lipschitz-continuous. Then $|f(x)-f(0)| \le Ld(x,0) \le L$ for all $x\in \mathbb R$. So $f$ is bounded.
Let $g: (\mathbb R, |\cdot|) \to (\mathbb R, |\cdot|)$ be uniformly continuous and unbounded (for example, $x \mapsto x$). Fix $\varepsilon>0$. There is $\delta<1$ such that $|g(x)-g(y)| < \varepsilon$ for all $x,y\in \mathbb R$ such that $|x-y|<\delta$. Then $|g(x)-g(y)| < \varepsilon$ for all $x,y\in \mathbb R$ such that $d(x,y)<\delta$. This implies $g: (\mathbb R, d) \to (\mathbb R, |\cdot|)$ is also uniformly continuous.
So $\sup_{x\in \mathbb R} |f(x)-g(x)| = \infty$, let alone approximation.
As written in my comment, the first point is false: any uniformly continuous function on $\mathbb{R}$ is $O(|x|)$ at infinity, so is not at finite distance from, say, $x \longmapsto x^2$.
The second point seems to be true for “reasonable” metric spaces. Specifically, we assume that for any small enough $\eta>0$, there is a constant $C \geq 1$ such that for any pair of points $x,y$ at distance at most $N\eta$ ($N \geq 1$), there is a sequence of at most $CN$ points with “jumps” of size at most $\eta$ starting from $x$ and arriving to $y$.
This happens (if I’m not mistaken) when there exists a map $\omega: (0,1] \rightarrow \mathbb{R}$ such that for all $x,y \in X$, there is a path $[0,d(x,y)] \rightarrow X$ from $x$ to $y$ for which $\omega$ is a modulus of uniform continuity. So, for instance, any convex in a normed space works, or any complete Riemannian manifold.
The practical consequence is as follows: let $\omega$ be the modulus of uniform continuity of $f$. Then for any $\eta>0$ small enough, there is a constant $D < \eta$ ($D=\eta/C$) such that for any $x,y \in X$, $|f(x)-f(y)|$ is at most $\omega(\eta)$ times the smallest integer above $d(x,y)/D$.
Up to considering $f=f^+-f^-$ we may assume $f \geq 0$. Then define, for every $M \geq 0$, $f_M(x)=\inf_y\, f(y)+Md(x,y)$. $f_M$ is clearly a positive $M$-Lipschitz function on $X$ and $f_M \leq f$.
Now, let $\eta >0$ be small, $D$ as above, $M>0$ and $M’=M/\omega(\eta)$. Choose $M$ large enough so that $M’D >2$.
Let $x,y\in X$. Suppose that $f(y) + Md(x,y) < f(x)$. Then $M’d(x,y)$ is less than the smallest integer $t$ above $d(x,y)/D$. In particular, if $d(x,y) > D$, then $M’d(x,y)< t < 2d(x,y)/D$, a contradiction, so that $d(x,y) \leq D \leq \eta$ and thus $f(y)+Md(x,y) \geq f(y) \geq f(x)-\omega(\eta)$.
Therefore, $\|f_M-f\|_{\infty} \leq \omega(\eta)$. This concludes.