Let $B \subset \mathbb{R}^n$ be an open ball in $\mathbb{R}^n$. Find a $C^\infty$ function $f : \mathbb{R}^n \rightarrow \mathbb{R}$ such that:
$f^{-1}(0, \infty)$ and $f^{-1}[0, \infty)$ are $B$ and its closure $\overline{B}$ respectively.
The linear functional $f'(x) : \mathbb{R}^n \rightarrow \mathbb{R}$ is nonzero for every $x \in f^{-1}(0)$.
I have shown that a "Bump function", f(x) = e^{(-1/r^2-||x||^2)} would works
However, I kinda mess up the second part
Let $B_i$, $i = 0, 1, 2, \ldots, g$ be open balls in $\mathbb{R}^n$. Assume that $B_i \subset B_0$ for all $i = 1, 2, \ldots, g$. Assume also that $1 \leq i < j \leq g$ implies $B_i \cap B_j = \emptyset$. Find a $C^\infty$ function $f : \mathbb{R}^n \rightarrow \mathbb{R}$ such that:
1. $f^{-1}(0, \infty)$ is the complement of $B_1 \cup \ldots \cup B_g$ in $B_0$.
2. $f^{-1}[0, \infty)$ is the closure of $f^{-1}(0, \infty)$.
3. $f(x) = 0$ implies $f'(x)$ is a nonzero linear functional.
Hint: Compare the sets $f^{-1}(0)$ in parts (1) and (2).
Can Someone give me an construction? Really appreciated!