# What is the derivative of this function x^2 sin(1/x) - 2 ?

$f ' \left(x\right) = 2 x \cdot \sin \left(\frac{1}{x}\right) - \cos \left(\frac{1}{x}\right)$
Let $f \left(x\right) = {x}^{2} \sin \left(\frac{1}{x}\right) - 2$.
$\therefore f ' \left(x\right) = {x}^{2} \cdot \frac{d}{\mathrm{dx}} \sin \left(\frac{1}{x}\right) + \sin \left(\frac{1}{x}\right) \cdot \frac{d}{\mathrm{dx}} {x}^{2}$.
$= {x}^{2} \cdot \cos \left(\frac{1}{x}\right) \cdot \frac{d}{\mathrm{dx}} \left(\frac{1}{x}\right) + 2 x \cdot \sin \left(\frac{1}{x}\right)$
$= {x}^{2} \cdot \cos \left(\frac{1}{x}\right) \cdot \left(- \frac{1}{x} ^ 2\right) + 2 x \cdot \sin \left(\frac{1}{x}\right)$
$= 2 x \cdot \sin \left(\frac{1}{x}\right) - \cos \left(\frac{1}{x}\right)$