This question appeared on an old qualifying exam:
Let $X$ be any subset of $\mathbb{R}^n$ and $f\colon X\to\mathbb{R}$ a function with the following property. For every $x\in X$ there is a neighborhood $U_x$ of $x$ in $\mathbb{R}^n$ and a smooth function $f_x\colon U_x \to\mathbb{R}$ such that $f = f_x$ on $X\cap U_x$. Show that there is an open set $U\in\mathbb{R}^n$ containing $X$ and a smooth function $g\colon U\to\mathbb{R}$ such that $g|X = f$.
My initial reaction was that this statement is probably not true without any conditions on the subset $X$. However, I haven't been able to come up with a counterexample.
I know how to solve this problem for $X$ a closed subset. It seems to me that if we can prove $\{U_x\}_{x\in X}$ has a locally finite refinement, then we can take $U$ as the union of the refinement. Then we take a partition of unity and construct our function $g$ on that refinement by averaging all the $\{f_x\}$ for the refinement. I just don't know how to prove that there exists such a refinement (or even if one exists). Thanks.