Suppose $S\subset \mathbb R$ is a arbitrary subset and function $d_S(x):\mathbb R\to \mathbb R$ $$d_S(x)=\inf\{|x-a|:a\in S\} $$ prove this function is uniformly continuous
Since I know the definition of uniformly continuous $$ \forall \epsilon >0 ,\exists \delta>0, \forall x,y\in \text{dom}f: |x-y|<\delta \implies |f(x)-f(y)|<\epsilon$$
I want to prove this function from the definition. My attempt was to write down $$|d_S(x)-d_S(y)|<\epsilon$$Then find the suitable $\delta$ to make this be true
However $$|d_S(x)-d_S(y)|=|\inf\{|x-a|:a\in S\}-\inf\{|y-a|:a\in S\}|$$
I don't know how to deal with this. Then I try to let $a(x),a(y)\in S$ such that $$d_S(x)=|x-a(x)| \\ d_S(y)=|y-a(y)|$$
Then $|d_S(x)-d_S(y)|$ can be rewritten as $$ |\ |x-a(x)| -|y-a(y)| \ |\leq |x-a(x)-y+a(y)|\leq |x-y|+|a(x)-a(y)|$$.
Then I still don't have too much idea about dealing with this. If I just let $|x-y|<\delta=\epsilon$, the first term will be less than $\epsilon$ but the second term remains tricky for me.
Any help on this? Or maybe my method is the wrong idea for solving this problem? Thank!
The function you deal with is $d(\cdot,S)$, so I'll note it like this (in fact, this result is valid for metric space $(X,d)$).
Let $\varepsilon>0$ and $x,y\in \mathbb{R}$. By characterization of the infimum, there exists $a\in S$ such that $$d(x,a)\leq d(x,S)+\varepsilon.$$ Therefore, $$d(y,S)\leq d(y,a)\leq d(y,x)+d(x,a)\leq d(x,y) + d(x,S)+\varepsilon.$$ Since $\varepsilon$ is arbitrary, we get $$d(y,S)-d(x,S)\leq d(x,y).$$ In the same way, you show that $$d(x,S)-d(y,S)\leq d(x,y).$$ Thus, $$|d(x,S)-d(y,S)|\leq d(x,y).$$ You can easily conclude by taking $\delta=\varepsilon$ in the definition of uniform continuity.