# 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. – Dr. Sonnhard Graubner Apr 1 '18 at 9:45
• @Dr.SonnhardGraubner So? We don't know that $f$ is diffferentiable – razvanelda Apr 1 '18 at 9:51
• @Dr.SonnhardGraubner I don't think the OP was asking about solutions to the original differential equation. – DonAntonio Apr 1 '18 at 9:54
• @Dr.SonnhardGraubner Did you read the whole question? – DonAntonio Apr 1 '18 at 10:02
• The Weierstrass function has a strict local maximum at the origin (simply by the triangle inequality). – Hans Lundmark Apr 1 '18 at 10: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}$.