# Existence of local minimum when local maximum is not global maximum

Suppose I have a continuous, differentiable (univariate) function $$f: \mathbb{R}_{>0}\rightarrow \mathbb{R}$$, and I have a local maximum at, say, $$x_0$$. My intuition now is that in order for the point $$x_0$$ to not be the global maximum, $$f$$ should first decrease and then at some point increase again to reach a global maximum somewhere else, implying that there should be at least one local minimum.

How do I formally prove this intuition, that is, that in order for $$x_0$$ to not be the global maximum, there should be a local minimum? Is there a well-known theorem that implies this result?

Or is my intuition perhaps not correct, in which case, I would love to see a counter example.

Let $$x_1\in(0,\infty)$$ be such that $$f(x_1)>f(x_0)$$. You can assume without loss of generality that $$x_1>x_0$$. The restriction of $$f$$ to $$[x_0,x_1]$$ has a minimum at some point $$a$$. Since $$f(a)\leqslant f(x_0), $$a\ne x_1$$. If $$a\ne x_0$$, then you're done: $$a\in(x_0,x_1)$$, and therefore $$f$$ has a local minimum at $$a$$.
If $$a=x_0$$ then, since $$f$$ has a local maximum at $$x_0$$, there is some $$\delta>0$$ such that$$x\in[x_0,x_0+\delta)\implies f(x)\leqslant f(x_0).$$Take $$\delta$$ such that $$x_0+\delta. You have $$a=x_0$$ and the minimum of the restriction of $$f$$ to $$[x_0,x_1]$$ is reached at $$a$$. Therefore, $$f$$ is constant on $$[x_0,x_0+\delta)$$ and so you can replace $$a$$ by any number from $$(x_0,x_0+\delta)$$. So, as above, $$f$$ has a local minimum at $$a$$.