Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does there exists a differentiable function $f:\mathbb{R} \to \mathbb{R}$ such that:

  1. $f(0) = 0$.

  2. $f'(x) = 1$ for all $x \in \mathbb{R}$ with $f(x) \lt 0$.

  3. $f'(x) = -1$ for all $x \in \mathbb{R}$ with $f(x) \ge 0$.

Clearly such function doesn't exist because it is monotone decreasing at 0, but increasing for $x > 0$ which is impossible however I didn't manage to prove this.

share|cite|improve this question
Can you visualize such a function? Can you compute the derivative at $x = 0$ using limits from both sides? – shardulc Mar 27 at 16:01
The open set $\{x : f(x) < 0\}$ cannot contain an interval of the form $(a,\infty)$ (why?). Thus, it has a boundary point in $\mathbb R$. Consider such a boundary point. – Friedrich Philipp Mar 27 at 16:19
The conditions mean that $f(x) = -|x|$ for all $x$, which is not differentiable at $0$. However, to prove that $|x|$ is not differentiable at $0$ requires a method like those already offered. – Paul Sinclair Mar 27 at 22:38

First solution:

Notice $f'(0)=-1$, take $\epsilon=1/2$, then there is $\delta>0$ so that if $x\in (-\delta,\delta)$ then $\frac{f(x)-f(0)}{x-0}\in (-3/2,-1/2)$. In particular $f(x)$ has a different sign than $x$, so take a fixed $x_0$ in $(0,\delta)$, then $f(x_0)<0$.

We have $f'(0)=-1$ and $f'(x_0)=1$. We conclude with Darboux's theorem that there is $x\in (0,x_0)$ with $f'(x_0)=0$, a contradiction.

Second solution:

Because of Darboux's theorem the derivative of a differentiable function cannot take exactly two values.

So the only two options are $f(x)=x+c$ and $f(x)=-x+c$. However, these functions have both positive and negative values, so the derivative should take on two values.

share|cite|improve this answer
Please edit your second solution. – Friedrich Philipp Mar 27 at 16:49
what should I change? – Carry on Smiling Mar 27 at 16:51
There's not that much to check, right? – Friedrich Philipp Mar 27 at 17:03
Is that what you meant? Thanks by the way. – Carry on Smiling Mar 27 at 17:04
Yes, that was it. Thank you, too. :o) – Friedrich Philipp Mar 27 at 17:06

Ok, here is an answer that does neither make use of Darboux's theorem nor of the assumption 1. So, assume that only 2. and 3. hold. Suppose that there exists $a\in\mathbb R$ such that $f(x) < 0$ for all $x\in (a,\infty)$. Then $f'(x) = 1$ there which implies that $f(x) = x + c$ for $x\in (a,\infty)$ with some $c\in\mathbb R$. But then $f(x) > 0$ for some $x\in (a,\infty)$, contrary to the assumption that $f(x) < 0$ on $(a,\infty)$. Similarly one shows that $\{x : f(x)\ge 0\}\neq \mathbb R$.

Therefore, there exists some $x_0\in\mathbb R$ such that $f(x) < 0$ for $x < x_0$ and $f(x_0) \ge 0$. Then we have $f(x_0) = 0$ (by continuity of $f$) and $f'(x_0) = -1$. Therefore, $$ -1 = \lim_{x\uparrow x_0}\frac{-f(x)}{x_0-x}\ge 0, $$ a contradiction. Hence, a differentiable function satisfying 2. and 3. does not exist.

share|cite|improve this answer

Since $f'(0) = -1, f(0) = 0$ it follows that there is a number $\delta > 0$ such that $f(x)$ is positive for all $x \in [-\delta, 0)$ and $f(x)$ is negative for all $x \in (0, \delta]$. This means that $f'(x) = -1$ for all $x \in [-\delta, 0]$ and $f'(x) = 1$ for all $x \in (0, \delta]$. Thus $f'$ has a jump discontinuity at $x = 0$ and this is impossible as derivatives don't have jump discontinuity. Hence no such function $f$ can exist.

The last bit about derivatives not having jump discontinuity can be established via mean value theorem but we can more directly obtain the contradiction for the specific function $f$ of the current question. Let $x \in (0, \delta]$ then we know that $$f(x) = f(x) - f(0) = xf'(\xi)$$ for some $\xi \in (0, x)$. And since $f'(x) = 1$ for $x \in (0, \delta]$ it follows that $f(x) = x$ for all $x \in (0, \delta]$. And this is inconsistent with $f(x)$ being negative for $x \in (0, \delta]$.

share|cite|improve this answer

Let's consider $x_1>0$.

If $f(x_1)>0$ by continuity $f(x)>0$ (and therefore $f'(x)=-1$) for any $x \in (x_1-a,x_1+a)$ for some $a$.

Call $x_0=\inf\{t:f(x)>0 \; \forall x \in (t,x_1)\}$ (that we just proved to be non empty).

  • If $x_0>-\infty$ by continuity $f(x_0)=0$ but this is impossible because $f'=-1$ in $(x_0,x_1)$ and so $f(x_0)>f(x_1)>0$.

  • If $x_0=-\infty$ then $0 \in (x_0,x_1)$ and so $f(0)>0$, that is impossible.

Since $x_1$ is arbitrary we must conclude that $f(x)\leq 0$ and $f'=1$ for any $x \in [0,+\infty)$, but this is still impossible because if $x>0$ we would have $f(x)>f(0)=0$ because $f'=1$ on $[0,+\infty)$ implies $f$ is strictly increasing on $[0,+\infty)$.

share|cite|improve this answer

Since $f'(0) = -1$, for some $\delta>0$ we have $f(x) \le - {1 \over 2} x$ for $x \in [0,\delta)$.

In particular, $f(x) <0$ for $x \in [0,\delta)$ and so $f'(x) = 1$.

If $0<y<x < \delta$, we have $f(x)=f(y) +x-y$, and by continuity (letting $y\to 0$) we have $f(x) = x$, which contradicts $f(x) \le - {1 \over 2} x$ for $x \in [0,\delta)$.

share|cite|improve this answer
Actually $f'(x)=-\text{sgn}(f(x))$ – Marco Disce Mar 27 at 17:24
@MarcoDisce: Thanks, I completely missed that and was wondering why the other answers were so complicated. – copper.hat Mar 27 at 17:25
@MarcoDisce: I have repaired my answer. – copper.hat Mar 27 at 17:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.