Let $U$ be an open subset of $\mathbb{R}^n$. Given a unital $\mathbb{R}$-algebra $\mathcal{F}$, let $|\mathcal{F}|$ be the set of surjective algebra homomorphisms $\mathcal{F}\rightarrow\mathbb{R}$. I am trying to understand a proof for bijectivity of the map $U\rightarrow|C^\infty(U)|$ given by $x\mapsto(f\mapsto f(x))$.
Injectivity is clear. Surjectivity is shown as follows: suppose $p:C^\infty(U)\rightarrow\mathbb{R}$ does not correspond to any point in $U$. Let $f_c\in C^\infty(U)$ be such that $f_c$ has compact level surfaces. Consider then the compact surface $f_c^{-1}(p(f_c))$. Since $p$ is not evaluation at any $x\in U$, for each $x\in f_c^{-1}(p(f_c))\subseteq U$, let $f_x\in C^\infty(U)$ be such that $f_x(x)\neq p(f_x)$. Then the open sets $U_x=f_x^{-1}(\mathbb{R}\setminus\{p(f_x)\}=\{a\in U:f_x(a)\neq p(f_x)\}$ constitute an open cover of $f_c^{-1}(p(f_c))$. Let $U_{x_1},\dots,U_{x_k}$ be a finite subcover.
Let $g=(f-p(f))^2+\sum_{i=1}^k(f_{x_i}-p(f_{x_i}))^2$. Then $g$ is non-vanishing on $U$, so $1/g\in C^\infty(U)$, and we have $p(g)\cdot p(1/g)=1$. On the other hand, $p(g)$ is clearly $0$, a contradiction.
This proof is very elegant and it's easy to verify $g$ satisfies the conditions required for the contradiction, but I still feel I am missing some motivation. Why did we consider this function $g$, and why were we going for the contradiction we got? On a (slightly) unrelated note, is there a constructive proof of this result?