A function $f$ such that $f' = 0$ when $x < 0$ and $f' = 1$ when $x \geq 0$? Is there a differentiable function $f: \mathbb{R} \rightarrow \mathbb{R}$ such that $f'(x) = 0$ when $x < 0$ and $f'(x) = 1$ when $x \geq 0$? 
Attempt: I was trying to think of an example. First thing that came to mind was $$ f(x) =  \begin{cases} x & x \geq 0 \\ 0 & x < 0 \end{cases}. $$ I wanted to know if it is differentiable at $x = 0$. Since $$ \lim_{x \to 0^+} \frac{f(x) - f(0)}{x} = 0 = \lim_{x \to 0^-} \frac{f(x) - f(0)}{x} $$ the derivative at $x = 0$ exists and equals $0$. But according to the problem, the derivative should be $1$, so I guess this is not a correct example. Does anyone have an example, or is such a function not possible at all?
 A: Such a function does not exist. The derivative of a function satisfies the intermediate value property. See Darboux's theorem.
A: It is important to understand that derivatives do not have jump discontinuity. We have the following result in this regard:
Let $f$ be differentiable in a certain neighborhood of $a$ except possibly at $a$. If $f'(x) \to L$ as $x \to a^{+}$ then right hand derivative $f_{+}'(a)$ exists and is equal to $L$ and if $f'(x) \to M$ as $x \to a^{-}$ then left hand derivative $f_{-}'(a)$ exists and is equal to $M$.
The proof proceeds via mean value theorem and we will prove the result when $x \to a^{+}$. If $h > 0$ then by the mean value theorem we have $$f(a + h) - f(a) = hf'(c)$$ for some $c \in (a, a + h)$. We have $$f_{+}'(a) = \lim_{h \to 0^{+}}\frac{f(a + h) - f(a)}{h} = \lim_{h \to 0^{+}}f'(c) = L$$ because as $h \to 0^{+}$, the point $c \to a^{+}$.
Thus if all the three numbers $\lim_{x \to a^{-}}f'(x), f'(a), \lim_{x \to a^{+}}f'(x)$ exist then they must be equal. It follows that it is not possible to have a function $f$ differentiable on all of all $\mathbb{R}$ such that $f'(x) = 0$ for $x < 0$ and $f'(x) = 1$ for all $x \geq 0$.
