Question

Differentiability and derivative of x squared sine one over x at zero

Original question: 8. Is the following function differentiable in (,)(-\infty,\infty)?

f(x)={x2sin1x,x0;0,x=0.f(x)=\begin{cases} x^2\sin\frac{1}{x}, & x\ne 0;\\ 0, & x=0. \end{cases}

If so, find the derivative f(x)f'(x), and discuss the continuity of f(x)f'(x).

Expert Verified Solution

thumb_up100%(1 rated)

Expert intro: This piecewise function is one of the standard examples where the formula looks wild near the origin but still behaves nicely enough to be differentiable. The real test is not whether the expression is defined away from 00—it is—but whether the quotient at 00 settles down cleanly.

Detailed walkthrough

Yes, the function is differentiable on (,)(-\infty,\infty).

For x0x\neq 0,

f(x)=x2sin1xf(x)=x^2\sin\frac1x

so by the product rule and chain rule,

f(x)=2xsin1x+x2cos1x(1x2)f'(x)=2x\sin\frac1x+x^2\cos\frac1x\left(-\frac1{x^2}\right)

which simplifies to

f(x)=2xsin1xcos1x,x0.f'(x)=2x\sin\frac1x-\cos\frac1x, \quad x\neq 0.

Now check differentiability at x=0x=0 from the definition:

f(0)=limh0f(h)f(0)h=limh0h2sin(1/h)h=limh0hsin(1/h)f'(0)=\lim_{h\to 0}\frac{f(h)-f(0)}{h}=\lim_{h\to 0}\frac{h^2\sin(1/h)}{h}=\lim_{h\to 0}h\sin(1/h)

Since sin(1/h)1|\sin(1/h)|\le 1,

hsin(1/h)h0|h\sin(1/h)|\le |h|\to 0

so

f(0)=0.f'(0)=0.

Therefore

2x\sin\frac1x-\cos\frac1x, & x\ne 0,\\ 0, & x=0. \end{cases}$$ ### Continuity of $f'(x)$ For $x\neq 0$, the formula is a combination of continuous functions, so $f'$ is continuous there. At $x=0$, $$\lim_{x\to 0} \left(2x\sin\frac1x-\cos\frac1x\right)$$ does not exist because $\cos(1/x)$ oscillates without a limit. So $f'(x)$ is **not continuous at $0$**. ### 💡 Pitfall guide A frequent slip is to claim $f'(0)$ is 1 or to forget that the derivative at the origin must come from the limit definition, not from the formula for $x\neq 0$. Another trap is thinking differentiability automatically implies continuity of the derivative. Here $f$ is differentiable everywhere, but $f'$ fails to be continuous at $0$. ### 🔄 Real-world variant If the function were $g(x)=x^n\sin(1/x)$ for $x\ne 0$ and $g(0)=0$, the same idea shows differentiability at $0$ gets easier as $n$ grows. In particular, for $n\ge 2$, the factor $x^n$ usually controls the oscillation enough to give a derivative at $0$, but continuity of $g'$ still needs a separate check. ### 🔍 Related terms chain rule, piecewise function, continuity of derivative

FAQ

Is x^2 sin(1/x) differentiable at 0?

Yes. Use the derivative definition at 0: lim h->0 [h^2 sin(1/h)]/h = lim h->0 h sin(1/h) = 0 by squeezing.

Is the derivative continuous at 0?

No. For x != 0, f'(x)=2x sin(1/x)-cos(1/x), and the cosine term oscillates as x approaches 0, so f' is not continuous at 0.

chat