Can a set of critical values be dense?

The set of critical values can certainly be dense. For example, let $g: \mathbb{Z} \to \mathbb{Q}$ be any bijection, and let $f: \mathbb{R} \to \mathbb{R}$ be any smooth function such that $f(x) = g(m)$ for all $m \in \mathbb{Z}$ and $x \in (m - \frac{1}{4}, m + \frac{1}{4})$. (Such functions can be constructed using suitable smooth partitions of unity.) Of course, $\mathbb{Q}$ can be replaced with any countable subset of $\mathbb{R}^n$.

Going further, can the set of critical values be uncountable? Can it have positive Hausdorff dimension (e.g., could it be the Cantor set)? This answer discusses the latter question, going into detail on what Sard actually proved — which, if I understand correctly (and I'm not certain I do), includes the statement that the set of critical values must have Hausdorff dimension zero for $C^\infty$ functions, but not for $C^k$ functions for $k < \infty$.


The set of critical values can be dense. For a simple case, let $f:\mathbb R\to \mathbb R$ be any $C^\infty$ function with support in $[-1/2,1/2]$ satisfying $f(0)=1,f'(0)=0.$ Let $q_1.q_2, \dots $ be the rationals. Then the set of critical points of

$$\sum_{n\in \mathbb {N}} q_nf(x-n)$$

contains $\mathbb {N},$ and $f(\mathbb {N})=\mathbb Q.$


Added two years later: To give a simple answer to a question in Daniel Hast's post: Yes, the set of critical values can be uncountable: Let $K$ be the Cantor set. Then as is well known, there exists $f\in C^\infty(\mathbb R)$ such that $f=0$ on $K,$ $f>0$ elsewhere. Set

$$g(x) = \int_{-\infty}^x f(t)\,dt.$$

Then $g\in C^\infty(\mathbb R),$ $g$ is strictly increasing, and $g'(x)=0$ precisely when $x\in K.$ It follows that the set of critical values of $g$ is $g(K),$ which is uncountable.