# Continuous function with no local maximum

I encountered the following problem:

Find all $$f:\mathbb{R}\rightarrow\mathbb{R}$$ such that $$f^2$$ is differentiable on $$\mathbb{R}$$ and $$(f^2)'=f$$

I am not interested in this problem's solution, I have a different question. I denoted by $$g=f^2$$, $$g:\mathbb{R}\rightarrow [0, +\infty)$$. It is clear that $$g$$ is continuous, differentiable and $$(g')^2=g$$ If $$g$$ would have a strict local maximum, let it be $$x_0$$, then $$g'(x_0)=0$$, so $$g(x_0)=0$$ and since $$g$$ is continuous and $$g:\mathbb{R}\rightarrow [0, +\infty)$$ we have that $$g$$ has no strict local maximum.

My question is the following:

If a continuous function $$f$$ has no strict local maximum or $$f$$ has no strict local minimum, then is $$f$$ monotone or constant?

(in my problem we have that $$g$$ is also differentiable but I am curious if this holds for any continuous function)

I thought immediately at the Weierstrass Function, which is everywhere continuous, nowhere differentiable and we also know that it is not monotone on any interval. If it has no local maximum, then what I'm saying is wrong, but I could't found if Weierstrass Function has or hasn't any local maximum/minimum.

EDIT:

@user539887 and @RobertZ showed that my question doesn't hold for strict extreme point, but what if we think at local extreme points? Not strict? The question will be therefor

If a continuous function $$f$$ has no local maximum or $$f$$ has no local minimum, then is $$f$$ monotone or constant?

• But $$(f^2)'=2ff'$$ by the chain rule. Apr 1, 2018 at 9:45
• @Dr.SonnhardGraubner I don't think the OP was asking about solutions to the original differential equation. Apr 1, 2018 at 9:54
• @Dr.SonnhardGraubner Did you read the whole question? Apr 1, 2018 at 10:02
• The Weierstrass function has a strict local maximum at the origin (simply by the triangle inequality). Apr 1, 2018 at 10:26
• The edited version appears O.K. Assume that $f$ is neither constant nor monotone. Then, considering various cases and subscases, one gets $x_1 < x_2 < x_3$ such that, for instance, $f(x_1) < f(x_3) < f(x_2)$. By IVT, there is $\tilde{x} \in [x_1, x_2]$ such that $f(\tilde{x}) = f(x_3)$. $f$ restricted to $[\tilde{x}, x_3]$ must take its largest value somewhere in $(\tilde{x}, x_3)$, and at such a point $f$ has local maximum. Perhaps someone will be able to give a more elegant proof (or show holes in my argument). Apr 1, 2018 at 11:26

No, the function $f(x)=\max(\min(2\sin(x),1),-1)$ is a continuous function in $\mathbb{R}$ which has no strict local maximum and no strict local minimum but it is not monotone or constant. Here $x_0$ is a strict local maximum (minimum) for $f$ if there is $r>0$ such that $f(x_0)>f(x)$ ($f(x_0)<f(x)$) for all $x\in (x_0-r,x_0)\cup (x_0,x_0+r)$.
Hint for the second question. Let $f$ be a continuous function in $\mathbb{R}$ which has no local maximum and no local minimum. Assume that there are $x<y$ such that $f(x)=f(y)$. Since $f$ is continuous in $[x,y]$ it has a maximum point $t$ and a minimum point $s$ in $[x,y]$. By hypothesis $t,s\not \in (x,y)$. So $t=x$ and $s=y$ or $s=x$ and $t=y$ which implies that $f$ is constant in $[x,y]$. Contradiction! Hence $f$ is injective in $\mathbb{R}$.