# How do you find f ' if f(x)=sin (1/x^2)?

Aug 4, 2015

$f ' \left(x\right) = \frac{- 2}{x} ^ 3 \cos \left(\frac{1}{x} ^ 2\right)$

#### Explanation:

Use $\frac{d}{\mathrm{dx}} \left(\sin x\right) = \cos x$ together with the chain rule to get:

$\frac{d}{\mathrm{dx}} \sin u = \cos u \cdot \frac{\mathrm{du}}{\mathrm{dx}}$

In this case, $u = \frac{1}{x} ^ 2 = {x}^{-} 2$,

so $\frac{\mathrm{du}}{\mathrm{dx}} = - 2 {x}^{-} 3 = \frac{- 2}{x} ^ 3$

Putting this together, we get:

$f ' \left(x\right) = \cos \left(\frac{1}{x} ^ 2\right) \cdot \frac{d}{\mathrm{dx}} \left(\frac{1}{x} ^ 2\right)$

$= \cos \left(\frac{1}{x} ^ 2\right) \frac{- 2}{x} ^ 3 \text{ }$ which is better written:

$f ' \left(x\right) = \frac{- 2}{x} ^ 3 \cos \left(\frac{1}{x} ^ 2\right)$

Aug 4, 2015

An interesting example related to this one is to consider the piecewise-defined function $f$ given by the equations $f \left(x\right) = {x}^{2} \sin \left(\frac{1}{x}\right)$ for $x \ne 0$ and $f \left(0\right) = 0$. Even though this function has infinitely many oscillations near the origin, the derivative $f ' \left(0\right)$ exists. On the other hand, the derivative $f '$ is not continuous at $x = 0$.

#### Explanation:

Again, let $f$ be defined in a piecewise way by $f \left(x\right) = {x}^{2} \sin \left(\frac{1}{x}\right)$ when $x \ne 0$ and $f \left(0\right) = 0$.

Certainly, when $x \ne 0$ the function is differentiable and continuous and the Product Rule and Chain Rule can be used to say that:

$f ' \left(x\right) = 2 x \cdot \sin \left(\frac{1}{x}\right) + {x}^{2} \cdot \cos \left(\frac{1}{x}\right) \cdot \left(- 1\right) {x}^{- 2}$

$= 2 x \sin \left(\frac{1}{x}\right) - \cos \left(\frac{1}{x}\right)$ for $x \ne 0$.

But $f$ is continuous everywhere (${\lim}_{x \to 0} f \left(x\right) = 0 = f \left(0\right)$ by the Squeeze Theorem) and $f ' \left(0\right)$ happens to exist as well! Do a limit calculation:

$f ' \left(0\right) = {\lim}_{h \to 0} \frac{f \left(0 + h\right) - f \left(0\right)}{h} = {\lim}_{h \to 0} \frac{{h}^{2} \cdot \sin \left(\frac{1}{h}\right) - 0}{h}$

$= {\lim}_{h \to 0} h \sin \left(\frac{1}{h}\right) = 0$, where the last equality follows by the Squeeze Theorem.

In other words, $f ' \left(0\right) = 0$.

Here's a graph of the function $f$ (blue) and its derivative $f '$ (red). Even though the derivative exists everywhere, it is not well-behaved near the origin. Not only does it have infinitely many oscillations as $x \to 0$, but the oscillations never decrease below 1 in amplitude (and ${\lim}_{x \to 0} f ' \left(x\right)$ fails to exist so that $f '$ is not continuous at $x = 0$). On the other hand, the graph of the derivative contains the point $\left(0 , 0\right)$ as well.

Pretty amazing, isn't it?!?!

Here a closer view near the origin and also making sure we can still see the blue curve. It's oscillating infinitely often as $x \to 0$ as well, though the oscillations are rapidly decreasing in amplitude as $x \to 0$.