Problem 2.26 - d) If $A \subset \mathbb{R}^n$ is open and $C \subset A$ is compact, show that there is a non-negative $C^{\infty}$ function $f: A \longrightarrow \mathbb{R}$ such that $f(x) > 0$ for $x \in C$ and $f = 0$ outside of some closed set contained in $A$.
This is what I think at the moment:
$A$ is open, so there is $\delta_x > 0$ for each $x \in A$ such that $B(x,\delta_x) \subset A$, then $\{ B(x,\delta_x) \ ; \ x \in A \}$ is an open cover for $C$ and there is a finite subcollection $\{ B(x_i,\delta_{x_i}) \ ; \ i = 1, \cdots, n \}$ that covers $C$ by the compactness of $C$. Analogously, we obtain a finite subcollection $\{ B(x_i,\delta_{x_i}/2) \ ; \ i = 1, \cdots, n \}$ that covers $C$ by the compactness of $C$, so the set $D := \bigcup_{i=1}^{i=n} \overline{B(x_i,\delta_{x_i}/2)} \subset A$. I would like to define $f:A \longrightarrow \mathbb{R}$ such that $f(x) > 0$ for $x \in C$ and $f = 0$ for $x \in A - D$.
I would like to know if I'm the right way and to receive a hint about how construct this function. Thanks in advance!
I am now reading the proof of Theorem 3-11 in the section "PARTITIONS OF UNITY" in this book ("Calculus on Manifolds" by Michael Spivak).
And the author uses the result of Problem 2-26 in the proof of Theorem 3-11.
So I forced to solve Problem 2-26.
My solution:
I used the result of Problem 1-22 on p.10 in this book ("Calculus on Manifolds" by Michael Spivak).
Let $D$ be a closed (it is not necessary to be compact) set such that $C\subset\text{interior }D$ and $D\subset A$.
For each $x\in C\subset\text{interior }D$, there is an open rectangle $I_x$ such that $x\in I_x\subset \text{interior }D$ since $\text{interior }D$ is open.
Since $C$ is compact there is a collection $\{I_{x_1},\dots,I_{x_m}\}$ such that $C\subset I_{x_1}\cup\cdots\cup I_{x_m}\subset\text{interior }D$.
Let $B$ be the closure of $I_{x_1}\cup\cdots\cup I_{x_m}$.
Then $B\subset D\subset A$.
Let $g_{x_i}:\mathbb{R}^n\to\mathbb{R}$ be a $C^\infty$ function which is positive on $I_{x_i}$ and zero elsewhere for each $i\in\{1,\dots,m\}$. (such $g_{x_i}$ exists by the result of Problem 2-26(c) on p.29 in this book ("Calculus on Manifolds" by Michael Spivak)).
Let $f=g_{x_1}+\cdots+g_{x_m}$.
Then, $f$ is a $C^\infty$ function and $f(x)>0$ for $x\in C$ and $f=0$ outside of $B$ which is a closed set contained in $A$.