# Approximate the indicator function of an open set in a metric space by a sequence of bounded continuous functions

Let $$(E, d)$$ be a metric space and $$A$$ a non-empty subset of $$E$$. I'm trying to give an alternative proof to this result, i.e.,

Theorem: If $$A$$ is open in $$E$$, then there is a sequence $$(f_n)$$ of real-valued bounded continuous functions on $$E$$ such that $$f_n \to f$$ pointwise.

Could you have a check on my attempt?

Proof: Let $$B := E\setminus A$$ and $$f_n (x) := \sqrt[n]{\min \{d(x, B), 1\}}$$ where $$d(x, B) := \inf_{b \in B} d(x, a)$$. Notice that $$|d(x, B) - d(y, B)| \le d(x, y)$$, so $$d(\cdot, B)$$ is continuous. As such, $$\min \{d(\cdot, B), 1\}$$ is bounded continuous. Let's prove that $$f_n \to f$$ pointwise.

• Let $$x \in A$$. Then $$x \notin B$$. Because $$B$$ is closed, $$d(x, B)>0$$. Then $$\alpha := \min \{d(x, B), 1\} \in (0, 1]$$. Notice that $$\ln \alpha \le 0$$. It follows that $$f_n (x) = \alpha^{1/n} = e^{\frac{\ln \alpha}{n}} \nearrow 1 = 1_A (x) \quad \text{as} \quad n \to \infty.$$

• Let $$x \notin A$$. Then $$x \in B$$ and thus $$f_n (x) =0 =1_A (x)$$. This completes the proof.

• Looks ok to me. Oct 24, 2022 at 17:09