5

Can there be such a function:

$f \colon \mathbb R \to \mathbb R$ is continuous and non-constant. It has a local maxima everywhere, i.e., for all $x \in \mathbb R$ there is some $\delta_x>0$ such that $f(x)\geq f(y)$ for all $y \in B(x,\delta_x)$. And, yet $f$ has no global maxima?

Thank you.

PS: $\mathbb R$ is with the usual topology. This is true for $\mathbb R$ with upper-limit topology.

user26857
  • 52,094

3 Answers3

12

No such function exists. If $f$ is continuous and has a local maximum everywhere, then $f$ is constant. To see this, let $a$ be a real number. By continuity, $\{x:f(x)\leq f(a)\}$ is closed, and by the hypothesis on local maxima, $\{x:f(x)\leq f(a)\}$ is open. The set is nonempty because it contains $a$, so it is all of $\mathbb{R}$ by connectedness. Therefore, for all $a$ and $b$ in $\mathbb{R}$, $f(b)\leq f(a)$ and similarly $f(a)\leq f(b)$.

Jonas Meyer
  • 53,602
  • what if $f$ is not a continuous function? – SBF Apr 08 '11 at 14:24
  • 1
    Then the proposition does not hold. Try f(x) = 1 if rational, 0 if irrational. – user7530 Apr 08 '11 at 15:48
  • 2
    @Gortaur: There would be examples if you didn't require the function to be continuous. E.g., take $f(n)=n$ for each positive integer $n$, and $f(x)=0$ otherwise. If you didn't care about having a global maximum, the characteristic function of any proper nonempty closed set would be a nonconstant function with a local maximum everywhere. – Jonas Meyer Apr 08 '11 at 18:02
  • 1
    @user7530: What is that example supposed to show? – Jonas Meyer Apr 08 '11 at 18:03
  • 1
    @user7530: for this function there are no local maximas. – SBF Apr 08 '11 at 19:19
  • @Jonas Meyer - I guess that for any characteristic function I know the global maximum a priori. – SBF Apr 08 '11 at 19:23
  • @Gortaur: Sure, as long as you know whether or not it is the characteristic function of the empty set. But if instead you wanted to construct more examples where there is no global maximum, take an unbounded positive locally constant function on a closed set $C$ ("locally" relative to the subspace topology on $C$), and extend to $\mathbb{R}$ by having it be $0$ on $\mathbb{R}\setminus C$. – Jonas Meyer Apr 08 '11 at 23:27
  • Sorry, I missed your words "if you didn't care about having a global maximum". As for me, your first example is sufficient. – SBF Apr 09 '11 at 08:20
  • Another example for non-continuous functions: $f(x)=0$ if $x≠\frac{1}{2}$, and $f(\frac{1}{2})=1$ –  Sep 11 '20 at 20:31
5

Surprisingly enough, there are a few papers on this (like here). So other people have considered variations of this problem.

I think that you should also be familiar with a related but incredibly interesting fact: it is possible to have a continuous function that has a local maxima/minima at every rational number. That's a dense subset, which is astounding enough as it is. (One should note that having a countable number of local maxima is all one can ask for. To see this, note that around every maxima one can assign an interval over which it is the maximum, from the definition of a local maximum. But there is a rational number in this interval, and so there can be at most countably many).

One such function is the Weierstrass function. It seems not so hard to alter this so that it has countably many maxima and minima, but no global maxima or minima.

t.b.
  • 78,116
  • (+1); concerning paragraphs 2-3, it is worth recalling http://math.stackexchange.com/questions/42944/is-it-possible-for-function-f-mathbbr-to-mathbbr-have-a-maxima-at-ever/42948#42948 – Shai Covo Jun 10 '11 at 07:18
3

To extend the answer Jonas gave, let me note that if $f$ is continuous and has a local minimum or maximum everywhere, then $f$ is constant. See Problem2010-4/B here for a proof (very recently published).

EDIT (elaborating). If $f$ has a local minimum or maximum everywhere, then the range of $f$ is countable (a proof is provided in the above link; see also here). Hence if $f$ is further continuous it must be constant, for otherwise, by the intermediate value theorem, the range of $f$ would be uncountable, a contradiction.

Shai Covo
  • 24,077