Let $F\subset \Bbb{R}^d$ be a closed subset. Let us define $f(x)=\Bbb{1}_F(x)$. I want to approximate this function by a continuous function.
If $d=1$ I know how to solve this problem, but if $d$ is arbitrary I have some problems. In internet I found someone who defined $f_m(x)=\max\{0,1-m\cdot d(x,F)\}$ and claimed that $f_m$ approximates $f$. The problem is that I don't see how it works. Is there some intuition behind this?
It would be nice if someone could explain me the inuition.
Maybe look at it from this point of view: The distance function $x\longmapsto d(x,F)$ is intuitively useful when it comes to encoding information about a set $F\subset\mathbb{R}^n$.
For the characteristic function $f = 1_F$, one has $f(x)=1$ for all $x\in F$, while $d(x,F)=0$ for all $x\in F$... so naturally, $1-d(x,F)$ looks promising, since one has $f(x) = 1-d(x,F)$ for all $x\in F$.
However, one would also like to emulate the property $f(x)=0$ for all $x\notin F$, which is not given by $1-d(x,F)$, since this function can become arbitrarily negative if one moves far enough away from $F$.
So in order to not get below zero, one instead looks at $\max\{0,1-d(x,F)\}$. Now, this function is the same as $f$ for all $x\in\mathbb{R}^n$ that either lie in $F$, or lie in $F^c$ and have distance $d(x,F)\geq 1$.
This means that we have to look at a sequence of continuous functions $$f_m := \max\{0,1-m d(x,f)\}$$ for $m\in\mathbb{N}$, since they coincide with $f$ for all $x\in\mathbb{R}^n$ that either lie in $F$, or lie in $F^c$ and have distance $d(x,F)\geq\frac{1}{m}$. So $(f_m)_{m\in\mathbb{N}}$ converges pointwise against $f$, since for every $x\in\mathbb{R}^n$, there exists a $M\in\mathbb{N}$, so that $f(x) = f_m(x)$ for all $m\geq M$.