A smooth function separating two disjoint closed subsets

320 Views Asked by At

I'm trying this problem (2.14) in John M Lee's book on smooth manifolds:

For any two disjoint closed sets $A$ and $B$ we can find a smooth function such that $f^{-1}(1)=A$ and $f^{-1}(0)=B$.

Can someone give a hint on how to do this?

I tried to use normality and partition of unity and the fact that for any closed set $K$ there is a smooth function $g$ such that $g^{-1}(0)=K$. But none of these seem to work.