In Lee's Introduction to Smooth Manifolds, I'm attempting to solve problem 6-4(a). It states:
Let $M$ be a smooth manifold, let $B$ be a closed subset of $M$, and let $\delta : M \to \mathbb{R}$ be a positive continuous function. Given any continuous function $f : M \to \mathbb{R}^k$, show that there is a continuous function $\widetilde{f} : M \to \mathbb{R}^k$ that is smooth on $M \setminus B$, agrees with $f$ on $B$, and is $\delta$-close to $f$. [Hint: use Problem 6-3.]
(Two functions $f$ and $\widetilde{f}$ are $\delta$-close if $|f(x) - \widetilde{f}(x)| < \delta(x)$ for all $x \in M$.)
The result of problem 6-3 is a smooth function $\widetilde{\delta} : M \to \mathbb{R}$ which is zero on $B$ and satisfies $0 < \widetilde{\delta}(x) < \delta(x)$ for all $x \in M \setminus B$. The most obvious way to make use of this is to define $\widetilde{f}(x) = (f_1(x) + \widetilde{\delta}(x)/\sqrt{k}, \dots, f_k(x) + \widetilde{\delta}(x)/\sqrt{k})$ which agrees with $f$ on $B$ and is $\delta$-close, but isn't necessarily smooth on $M \setminus B$.
By theorem 6.21, (Whitney approximation for functions) I can find some function $\widetilde{f}$ which is smooth everywhere and $\delta$-close to f, but it doesn't necessarily agree with $f$ on $B$.
It seems to me that I should try and combine both approaches, and my first thought is to define a smooth bump function supported in some neighborhood $U$ of $B$ with which to "blend" them together by the gluing lemma. However, there's no guarantee they'll agree on $U \setminus B$, and besides it just feels needlessly complex.
I've been meditating on this for a few days now and I can't see a resolution. What am I overlooking? What should I be thinking about?
EDIT: On further contemplation, it seems as though both parts of this problem intend the reader to modify the proofs of the Whitney approximation theorems. In the first, theorem 6.21, Lee assumes $f$ is smooth on a closed subset $A$, extends $f\mid_A$ to a smooth map $f_0$ on $M$, uses $\delta$ to cleverly construct a neighborhood $U_0$ of $A$ and a countable cover $\{U_i\}$ of $M \setminus A$, and constructs the desired function with a partition of unity subordinate to $\{U_0\} \cup \{U_i\}$. In this case I assume I only need to construct a different neighborhood for $B$ and otherwise use the same $\{U_i\}$ to cover $M \setminus B$, but I'm not sure how to do this or how $\widetilde \delta$ is useful.