I'm trying to prove Lemma 8.2. from this lecture note.
Lemma 8.3. Let $M$ be an $m$-manifold, $W$ an open set in $M$, and $f: W \to \mathbb{R}$ a smooth function. Suppose that $x \in W$. Then there is a smooth function $g: M \longrightarrow \mathbb{R}$ which agrees with $f$ on some neighbourhood of $x$ in $W$.
Could you verify if my understanding is fine?
Proof. We need the following result, i.e.,
Lemma 8.2. Let $M$ be an $m$-manifold and $W'$ an open set in $M$. Let $x \in W'$. Then there is a smooth function $\theta: M \longrightarrow[0,1]$ such that $\theta =0$ on $M \setminus W'$ and that $\theta = 1$ on some neighbourhood of $x$.
Let $W'$ be an open neighbourhood of $x$ in $M$ such that $\overline{W'} \subset W$. Such $W'$ exists because $M$ is locally homeomorphic to $\mathbb R^m$. By Lemma 8.2., there is a smooth function $\theta: M \longrightarrow[0,1]$ such that $\theta =0$ on $M \setminus W'$ and that $\theta = 1$ on some neighbourhood of $x$. Let $g (y) := f(y) \theta (y)$ if $y \in W$ and $0$ otherwise. Then $g=f$ on some neighbourhood of $x$.
Let's prove that $g$ is smooth. Fix $y\in M$. If $y\in W$, then $g$ is smooth at $y$ by chain rule. Let $y \notin W$. It suffices to prove $g=0$ on a neighbourhood $O$ of $y$ in $M$. We have $$ y \in M \setminus W \subset O ':=M \setminus \overline{W'}. $$
Notice that $\theta=0$ on $O'$ and $O'$ is open in $M$. So we can pick $O$ such that $y \in O \subset O'$. This completes the proof.