Differentiating $x+2x^2\sin(1/x)$ near $0$, discontinuity of the derivative

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

2 Answers

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.

I seem to have neglected the question about invertibility. A continuous function on an interval in $\mathbb R$ is invertible if and only if it is strictly monotone (a consequence of the intermediate value theorem). A function with everywhere existing nonzero derivative in an interval is strictly monotone (a consequence of the mean value theorem). In particular, if a function has a continuous derivative and nonzero derivative at zero, then the function is invertible in a neighborhood of the origin, and the inverse function theorem even applies.

For your function, although $f'(0)$ exists and is nonzero, discontinuity of $f'$ means the inverse function theorem doesn't apply, and more work is required to determine whether $f$ is invertible. A necessary condition for a differentiable function to be monotone on an interval is that the derivative doesn't change signs on the interval. For your function, $f'(0)=1>0$, but evaluating at $x_n = \dfrac{1}{2n\pi}$ gives $f'(x_n)=-1$ with $x_n\to 0$ as $n\to \infty$. Hence, $f$ is not monotone in any interval containing $0$.

-
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.$$

-