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

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

• Do you want local maxima in particular or just $x$ with $f'(x)=0$? Jun 25 '15 at 18:17
• No one said the function was differentiable. Jun 25 '15 at 18:18
• A related question, which is much easier: Can the set of all strict local maxima be dense? Jun 25 '15 at 18:41
• Yes you can have a local maximum at every rational. The Weierstrass function works right? Jun 25 '15 at 19:02
• @Vim It does, if you're looking at the function defined as on the Wikipedia article en.wikipedia.org/wiki/Weierstrass_function. The maximum must be at $0$ (where cosine is $1$), and there it takes the value of the geometric series with ratio $a$. However, since we care only about local maxima for this question, what is more relevant is that the Weierstraß function is continuous on every compact interval. Jun 26 '15 at 19:05

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.

• I don't quite buy this argument for the same reasons that @angryavian brought up below. If your association is: "For a strict local maximum x, pick an open neighborhood U on which x is a global maximum, then pick a rational number q_x in U", then there is nothing preventing two strict local maxima from mapping to the same rational number. Jun 25 '15 at 19:24
• @AlexZorn Just about to say the same thing. There is a resolution, though: pick two rational numbers $r,s$, one on the left and one on the right, such that the local maximum $x\in(r,s)$ is greater than every other point in $(r,s)$. There can only be one local maximum for this pair of rationals, so this extablishes an injection from $\Bbb Q^2$. Jun 25 '15 at 19:26
• My solution is a bit different: take any interval centered at the strict local maximum, then take a rational number in the interval half the size of the first interval. This guarantees distinct rational numbers. I thought that was clear enough that I did not need to include it in my answer. I looks like I was wrong and should have included it. Jun 25 '15 at 20:10
• @RoryDaulton I don't think that necessarily works. Your first point $x$ could be a global maximum on some interval. But $x$ can still be the limit point of local maxima within the same interval - any neighbourhood of $x$ could contain arbitrarily many local maxima. Jun 25 '15 at 20:50
• @JoshuaBenabou: See my expanded answer for a more rigorous answer. Jun 26 '15 at 18:41

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.

• This argument is absolutely fantastic! Jul 23 '15 at 22:23
• Are you sure that this extends to weak local maxima? Any function $f: \mathbb{R} \rightarrow \mathbb{R}$ which is constant on some subinterval of $\mathbb{R}$ would be a counterexample. Or would you lump that in with constant functions as being a trivial counterexample? Apr 21 '19 at 11:37
• @JoeManAnalysis The exact statement is given in the post. Rather than counting the maxima, I'm counting the number of values that those maxima obtain. A constant function also satisfies the theorem, because in that case $f(M)=\{c\}$ is a singleton, which is countable, and similarly for functions constant on an interval. Apr 21 '19 at 12:45
• @MarioCarneiro I understand now, thank you for clarification! Apr 21 '19 at 13:51

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.

• So my attempt to construct one would have failed... I was thinking about $f$ having local maxima in every point of the Cantor set, but haven't thought it through completely yet. Jun 25 '15 at 18:28
• @NoahSchweber: I think second-countable (countable basis) is the property we need here. Separable (having a countable dense subset) is not strong enough: Consider the reals equipped with the lower limit topology, i.e. the topology generated by intervals [a, b). This is separable but not second countable. If f is any strictly decreasing function, then every point is a strict local maximum, and so f has uncountably many local maxima. Jun 26 '15 at 1:54
• Yes, of course, you're right; I've deleted my comment. Jun 26 '15 at 1:56
• This is a beautiful argument. Jan 10 at 23:12