Does there exist a continuous function from [0,1] to R that has uncountably many local maxima?

A strict local maximum has a punctured neighborhood in which the values are less that that value. Every neighborhood has a rational number, so each strict local maximum is associated with a rational number. The rationals are countable, thus the strict local maxima are as well.


My previous argument is not rigorous and it does have some problems. Here is a more rigorous one.

For each strict local maximum location $a\in[0,1]$ there is a $\delta>0$ such that $0<|x-a|<\delta\implies f(x)<f(a)$. Let $\delta_a$ be the least upper bound (supremum) of such $\delta$'s for the given $a$. Then $0<\delta_a\le 1$.

If $a\ne b$ are both strict maxima, then $|a-b|$, the distance between $a$ and $b$, may be less than $\delta_a$ if $f(b)<f(a)$, but then $|a-b|$ must be at least $\delta_b$. So $|a-b|\ge\min(\delta_a,\delta_b)$. The $\delta$'s are a measure of "spread" of the strict local maxima.

So for any given $n\in\Bbb Z^+$, the number of $a$ such that $\delta_a\ge\frac 1n$ is at most $n+1$.

We can now count the strict local maxima: first list all $a$ such that $\delta_a\ge \frac 11$, then those such that $\delta_a\ge\frac 12$, and so on. Each stage gives us finitely many strict local maxima, there are countably many stages, and the union gives us all strict local maxima. Therefore there are at most countably many strict local maxima.


For any local maximum $x$, there are rational numbers $r<x<s$ such that $f(a)<f(x)>f(b)$ for all $r<a<x<b<s$. If $y$ is some other local maximum satisfying this condition for the same rational numbers $r,s$, then assuming WLOG that $x<y$, the condition on $x$ implies that $f(x)>f(y)$ and the condition on $y$ implies $f(x)<f(y)$, a contradiction. Thus to any pair $(r,s)\in\Bbb Q^2$ there is at most one local maximum associated with it.

This implies that there is a surjection from a subset of $\Bbb Q^2$ to the set of local maxima, so there are countably many strict local maxima. As pointed out in the other answers, it is not necessary to assume $f$ is continuous.


This proof even extends to weak local maxima, although the theorem statement needs to be tweaked since a constant function would be a trivial counterexample. Given $f:\Bbb R\to\Bbb R$, let $M$ be the set of non-strict local maxima. Then $f(M)$ is countable. To prove it, let $x\in M_{r,s}$ if $x\in(r,s)$ and $f(a)\le f(x)$ for all $a\in(r,s)$. Then if $x,y\in M_{r,s}$ then $f(x)\le f(y)$ and $f(y)\le f(x)$, so $f(M_{r,s})$ is a subsingleton. Since $M=\bigcup_{r,s\in\Bbb Q}M_{r,s}$, it follows that $f(M)=\bigcup_{r,s\in\Bbb Q}f(M_{r,s})$ is countable.


If you want a local maxima that is a weak inequality, i.e. $f(x_0)\geq f(x)$ for all $x$ near $x_0$, then sure, take any constant function. If you want strict inequality, i.e. $f(x_0)>f(x)$ for all $x$ near $x_0$, then no, it is impossible. This relies on the fact that the real numbers have a countable basis.