Milnor's exercise: for any manifold $M$, $\mathrm{Hom}(C^\infty(M,\mathbb{R}),\mathbb{R})\cong M$

First we observe that what we really need in the proof is that $\bigcap_{f \in \operatorname{ker}(\phi)} V(f)\ne \emptyset$. The proof follows from that just as you written it. Now $$V(f^*) \supset \bigcap_{f \in \operatorname{ker}(\phi)} V(f)=\bigcap_{f \in \operatorname{ker}(\phi)} V(f)\cap V(f^*),$$ so we can use the following characterization of compactness: Any collection of closed subsets of $V(f^*)$ with the finite intersection property has nonempty intersection.

Now we prove that each finite subset $\{V(f_i)\}_{i=1}^n\subset \ker \phi$ has non empty intersection. Otherwise $g:=\sum_i f_i^2>0$ and $g\in \ker \phi$. This can't be true because if $g$ is an invertible element then $1_\mathbb{R} \in \ker \phi$( Contradiction to $\ker \phi$ has codimension $1$).

We can conclude that $\bigcap_{f \in \operatorname{ker}(\phi)} V(f)=\bigcap_{f \in \operatorname{ker}(\phi)} V(f)\cap V(f^*)$ has a non empty intersection by the compactness of $V(f^*)$.

Some observations:

The hard part is to construct $f^*$ as this shows that ${f^*}^{-1}(0)$ is compact.

Another equivalent definition of compactness of a space $X$ is: Every filter on $X$ has a cluster point. You could probably use that for the proof. We have seen in the proof that I imitate the same reasoning used ot show $\{V(f) \mid(M \stackrel{f}{\rightarrow} \mathbb{R}) \in \operatorname{ker}(\phi)\}$ is a filter. I was not confident enough with the definitions of filters to go in that direction.


This is a proof of the "hard part" mentioned in @Elad's answer.

Lemma. A smooth manifold $M$ admits a smooth real valued function $f$ such that $$ \lim_{x\to \infty }f(x) = \infty , $$ (in the sense that for every $a>0$, there exists a compact subset $K\subseteq M$, such that $f(x)>a$, for every $x\in M\setminus K$) if and only if $M$ is $\sigma $-compact.

Proof. For the "only if" part notice that, given $f$ as above, one has that $f^{-1}((-\infty,a])$ is compact for every real number $a$, and $$ M= \bigcup_{n\in \mathbb N}f^{-1}((-\infty,n]). $$

Conversely, let $\{K_n\}_{n\in \mathbb N}$ be a family of compact subsets of $M$ such that $M= \bigcup_{n\in \mathbb N}K_n$. By a well known trick, based on the local compactness of $M$, we may assume WLOG that each $K_n$ is contained in the interior of $K_{n+1}$.

By Lemma (1.3.2) in https://www.math.ucla.edu/~petersen/manifolds.pdf (Smooth Urysohn Lemma), for each $n$ in $\mathbb N$ we may choose a nonegative smooth function $f_n$ vanishing on $K_n$ and taking on the value 1 on $M\setminus \text{int}(K_{n+1})$ (and hence also on $M\setminus K_{n+1}$).

Defining $$ f(x) = \sum_{n=1}^\infty f_n(x), \quad \forall x\in M, $$ we claim that, for every $x$ in $M$, there exists a neighborhood $V$ of $x$, and a natural number $m$, such that $f_n=0$ on $V$, for every $n\geq m$.

To see this, find some $i$ such that $x\in K_i$. It then suffices to take $V=\text{int}(K_{i+1})$ and $m=i+1$.

This said, it is clear that the above function $f$ is well defined and smooth.

To see that $\lim_{x\to \infty }f(x) = \infty $, observe that if $x\not\in K_{m+1}$, then surely $x\not\in K_{n+1}$, for every $n\leq m$, whence $$ f(x) \geq \sum_{n=1}^m f_n(x) = m. $$ This completes the proof of the Lemma. QED


Back to the question, let us assume that $M$ is $\sigma $-compact, so we may pick $f$ as in the Lemma.

Setting $$ f^*=f-\phi(f)1, $$ one has that $f^*\in \text{Ker}(\phi)$, and clearly also $\lim_{x\to \infty }f^*(x) = \infty $, so we have that $$ V(f^*) = {f^*}^{-1}(0) $$ is compact, as desired.