<s>[INST] Derivative of $f(x) = x^2 \sin(1/x)$ using the derivative definition derivative of $f(x) = x^2 \sin(1/x)$ using the derivative definition
When not using the derivative definition I get $\cos (1/x) + 2x \sin(1/x)$,
which WolframAlpha agrees to.
However when I try solving it using the derivative definition:
$$\lim_ {h\to 0} = \frac{f(x+h) - f(x)}{h} $$
I get:
$$2x \sin \left(\frac{1}{x+h} \right ) + h \sin \left(\frac{1}{x+h}\right)$$
which in return results in, as $h \to 0$:
$$2x \sin (1/x)$$
So what am I doing wrong when using the def of derivatives? 
 [/INST] You're doing wrongly the computation:
\begin{align}
f(x+h)-f(x)&=(x+h)^2\sin\frac{1}{x+h}-x^2\sin\frac{1}{x}\\
&=x^2\left(\sin\frac{1}{x+h}-\sin\frac{1}{x}\right)+2hx\sin\frac{1}{x+h}+h^2\sin\frac{1}{x+h}
\end{align}
When you divide by $h$ you get
$$
\frac{f(x+h)-f(x)}{h}=
\frac{x^2}{h}\left(\sin\frac{1}{x+h}-\sin\frac{1}{x}\right)+2x\sin\frac{1}{x+h}+h\sin\frac{1}{x+h}
$$
and you're left with computing
$$
\lim_{h\to0}\frac{1}{h}\left(\sin\frac{1}{x+h}-\sin\frac{1}{x}\right)
$$
because the second summand above tends to $2x\sin(1/x)$ and the third summand tends to $0$. You'll reinsert $x^2$ later.
Now you can use the identity
$$
\sin\alpha-\sin\beta=2\cos\frac{\alpha+\beta}{2}\sin\frac{\alpha-\beta}{2}
$$
Setting $\alpha=1/(x+h)$ and $\beta=1/x$, we have
$$
\frac{\alpha+\beta}{2}=\frac{1}{2}\left(\frac{1}{x+h}+\frac{1}{x}\right)=
\frac{2x+h}{2x(x+h)}
$$
while
$$
\frac{\alpha-\beta}{2}=\frac{1}{2}\left(\frac{1}{x+h}-\frac{1}{x}\right)=
\frac{-h}{2x(x+h)}
$$
so your limit is
$$
\lim_{h\to0}\frac{2}{h}\cos\frac{2x+h}{2x(x+h)}\sin\frac{-h}{2x(x+h)}
$$
But
$$
\lim_{h\to0}2\cos\frac{2x+h}{2x(x+h)}=2\cos\frac{1}{x}
$$
so we just need to compute
$$
\lim_{h\to0}\frac{1}{h}\sin\frac{-h}{2x(x+h)}
$$
Set $k=-h/(2x(x+h))$, so
$$
2x^2k+2xhk=-h
$$
or $h(2xk+1)=-2x^2k$ that lends
$$
h=-\frac{2x^2k}{2xk+1}
$$
So this transformation is bijective (and bicontinuous) and $h\to0$ implies $k\to0$ so your limit is
$$
\lim_{h\to0}\frac{1}{h}\sin\frac{-h}{2x(x+h)}=
\lim_{k\to0}-\frac{2xk+1}{2x^2k}\sin k=
\lim_{k\to0}-\frac{2xk+1}{2x^2}\frac{\sin k}{k}=-\frac{1}{2x^2}
$$
In the end we get
$$
\lim_{h\to0}\frac{f(x+h)-f(x)}{h}=
x^2\left(-\frac{1}{2x^2}\right)\cos\frac{1}{x}+2x\sin\frac{1}{x}=
-\cos\frac{1}{x}+2x\sin\frac{1}{x}
$$
This assumes, of course, $x\ne0$. If your function is defined by
$$
f(x)=\begin{cases}
x^2\sin\dfrac{1}{x}&\text{for $x\ne0$}\\[1ex]
0&\text{for $x=0$}
\end{cases}
$$
we are left with the derivative at $0$, that is
$$
\lim_{h\to0}\frac{f(h)-f(0)}{h}=
\lim_{h\to0}\frac{1}{h}h^2\sin\frac{1}{h}=
\lim_{h\to0}h\sin\frac{1}{h}=0
$$
with an easy application of the squeeze theorem.
Of course using the chain rule is much simpler.
Now that you know that
$$
f'(x)=\begin{cases}
-\cos\dfrac{1}{x}+2x\sin\dfrac{1}{x}&\text{for $x\ne0$}\\[1ex]
0&\text{for $x=0$}
\end{cases}
$$
it should be easy to verify whether the derivative is continuous at $0$.
</s>