# Countability of local maxima on continuous real-valued functions

I am working through a bank of previous exams and couldn't figure a problem out to my satisfaction.

Let $f(x) : \mathbb{R} \to \mathbb{R}\,$ be a continuous function.

1. Show that $f$ can have at most countably many strict local maxima.
2. Assume that $f$ is not monotone on any interval. Then show that the local maxima of $f$ are dense in $\mathbb{R}$.
-

1. For each $\delta>0$, the set of all $x\in\mathbb{R}$ such that $f(y)<f(x)$ for all $y$ with $0<|x-y|<\delta$ is countable. This can be seen by noting that the set contains at most one element of the interval $[k\frac{\delta}{2},(k+1)\frac{\delta}{2}]$ for each integer $k$, and these intervals cover $\mathbb{R}$. The set of strict local maxima is a countable union of such sets, for example taking $\delta=\frac{1}{n}$ as $n$ ranges over the positive integers.

2. Suppose that $f$ is a continuous function that is not monotone on any interval. We want to show that $f$ has a local maximum in every interval. The argument is the same if the interval is $(0,2)$, so to slightly reduce notation let's work there. Note that not being monotone in any interval means that each interval contains pairs $x_1<x_2$ and $y_1<y_2$ such that $f(x_1)<f(x_2)$ and $f(y_1)>f(y_2)$. So $(0,1)$ contains a pair $x_1<x_2$ such that $f(x_1)<f(x_2)$, and $(1,2)$ contains a pair $y_1<y_2$ such that $f(y_1)>f(y_2)$. Because $f$ is continuous, there is a point $x_0\in [x_1,y_2]$ where $f$ has its maximum value. Because $f(x_2)>f(x_1)$ and $f(y_1)>f(y_2)$, $x_0$ is not an endpoint of $[x_1,y_2]$. Therefore $f$ has a local maximum at $x_0$.

-
 How do you use the continuity requirement in showing 1? – davidk01 Mar 19 '11 at 4:11 Continuity isn't needed for 1. – Jonas Meyer Mar 19 '11 at 4:13 Then I don't see how what you've said is true. Why can't I just take $f(y)$ and move it down creating a hole in the function where all the values around it are above the new value where I moved $f(y)$. That would make the entire interval $(y-\delta,y+\delta)$ except for $y$ satisfy your stated condition and $(y-\delta,y+\delta)$ is uncountable. – davidk01 Mar 19 '11 at 4:17 @davidk01: I am saying that for each $\delta>0$, the set $\{x:\text{ for all }$y$, |x-y|<\delta\Rightarrow f(y)f(y)$ for some fixed $y$ close to $x$, but for all $y$ close to $x$. Hence the statement that there can be only one such point in an interval of length less than $\delta$. – Jonas Meyer Mar 19 '11 at 4:25 @Jonas Meyer: That wasn't clear in your original statement. I'll look this over. – davidk01 Mar 19 '11 at 4:27
@davidk01: In a situation where the strict local maxima are dense, which happens for functions that are monotone on no interval, if you take an interval around a point where $f$ has a local maximum, the interval will contain other points where $f$ has a local maximum, and therefore it will intersect all intervals containing those points. – Jonas Meyer Mar 19 '11 at 3:42
@davidk01: Continuous functions take on their maxima on closed bounded intervals, but that isn't relevant for the first question. As for how density makes a difference: Being able to cover a set with disjoint intervals each of which contains only one element of the set is a lot stronger than saying that the set is not dense. If a set is dense in $\mathbb{R}$, then every interval contains infinitely many elements of the set. – Jonas Meyer Mar 19 '11 at 4:08