Function that got positive derivative for all $x\neq 0$ And zero derivative for $x=0$ must be increasing on $\mathbb{R}$

I got this statement that I am trying to prove

Let $f:\mathbb{R}\to\mathbb{R}$ be a differentiable function such that for all $x\neq 0$, $f'(x)>0$ and for $x=0$, $f'(x)=0$, how do I prove that $f$ is increasing on $\mathbb{R}$ by the definition of increasing function.

My try: I showed that $f$ is increasing on $\mathbb{R}-\{0\}$ using the theorem on increasing functions and their derivatives, but at $x=0$ I came into difficulty and wasn't able to proceed that much (do I miss something, maybe MVT or Rolle's theorem ).

Some hints will be appreciated.

There's a small trick. You've proved that for all $x,y$, if both are either positive or negative, then $x < y \implies f(x) < f(y)$. By the MVT you can also prove the claim if either $x$ or $y$ is zero. To conclude, you're left with the case $x < 0 < y$. But then you can apply the MVT on $[x,0]$ and $[0,y]$...
Small nitpick: you probably haven't shown that $f$ is increasing on $\mathbb{R} \setminus 0$. You have shown that it's increasing on $(-\infty, 0)$ and $(0, +\infty)$. This is different! Consider for example $f(x) = \dfrac{-1}{x}$.
• True, that's a mistake to say "$f$ is increasing on $\mathbb{R}-\{0\}$", thanks. – MathNerd May 28 '14 at 7:45