# Silly question on derivatives

I have this function $$\begin{array}{l} f:\mathbb{R}\rightarrow\mathbb{R}\\ x\rightarrow\left\{\begin{array}{ll} x+2x^2\sin\left(\frac{1}{x}\right)&x\neq 0\\ 0&x=0 \end{array}\right. \end{array}$$ I need to calculate its derivative in $x=0$. I'm not sure how can I compute it at zero, since the limit of its derivative goes to 1 when x tends to zero but at zero I thought $f'(0)$ must be zero (therefore its derivative is not continuous at the origin). If is not zero then it is invertible around the origin via the Inverse Function Theorem, right?

-
I was biased by the exercise's question whether the function is invertible or not around the origin, I guess. –  Marra Jan 29 '13 at 1:33

The derivative is discontinuous at the origin, but not for the reasons you stated.

Calculate the derivative at $x=0$ using the limit definition, $f'(0)=\lim\limits_{h\to 0}\dfrac{f(h)-f(0)}{h}$. You will find that it is $1$, not $0$.

Calculate the derivative at $x\neq 0$ using the ordinary shortcuts from calculus. You will have a general expression for $f'(x)$ when $x\neq 0$, and you will find that $\lim\limits_{x\to 0}f'(x)$ does not exist.

-
It won't exist because I will find $lim_{x\rightarrow 0}-2\cos(1/x)$ plus an expression that goes to zero, and this one does not exist. –  Marra Jan 29 '13 at 1:38
@GustavoMarra: Almost; the other stuff goes to $1$, not $0$, but yes, when you have $a(x)+b(x)$, if the limit of $a(x)$ exists and the limit of $b(x)$ does not exist, then the limit of the sum does not exist. –  Jonas Meyer Jan 29 '13 at 1:40
Yez, it goes to 1 not 0, sorry :) –  Marra Jan 29 '13 at 1:41

Use the definition of the derivative to evaluate it at zero: $$f'(0) = \lim_{x \to 0} \frac{f(x) - f(0)}{x - 0}.$$ In this case we have \begin{align} \lim_{x \to 0} \frac{f(x) - f(0)}{x - 0} & = \lim_{x \to 0} \frac{x + 2x^2 \sin(1/x)}{x} \\ & = \lim_{x \to 0} (1 + 2x \sin(1/x)) \\ & = 1 + 0 = 1, \end{align} where we use the squeeze theorem to conclude that $$\lim_{x \to 0} 2x \sin(1/x) = 0.$$

-