$ f(x)= \begin{cases} x^2\sin\left(\frac{\pi}{x}\right)\;,\quad x < 0\\ A\;,\qquad\qquad x = 0 \\ ax^2+b\;,\qquad x > 0 \end{cases} $
I need to find $A$, $a$ and $b$ knowing that $f$ is differentiable. I am doing this by using the definition of the derivative and showing that the two one-sided limits at 0 from the negative and positive side exist, and they must be equal to each other. I guess they must also be equal to the derivative of $f(x)$ at $0$, which would be 0 since any constant function is differentiable.
For the negative side I got the limit as $x$ tends to negative $0$ of $x\sin\left(\frac{\pi}{x}\right)$ - $\frac{A}{x}$.
For the positive side I got the limit as $x$ tends to positive $0$ of $ax + \frac{b}{x} - \frac{A}{x}$. I set these two limits equal to $0$ and each other.
I know for the first limit that the limit as $x$ tends to negative $0$ of $x\sin\left(\frac{\pi}{x}\right)=0$ by the sandwich theorem if it is defined as $0$ at $x=0$. For $\frac{-A}{x}$ to tend to $0$, A must be 0.
Similarly, I ended up with $b$ = $0$ and $a$ any real number. I'm unsure on my method and would like some help with it. Cheers. Would it be best to first use the fact that $f(x)$ must be continuous at $0$ for it to be differentiable at $0$? That way I know $x^2\sin\left(\frac{\pi}{x}\right)$ would be $0$ as $x$ tends to $0$ from the left, and that should equal $b$, meaning $b=0$. Since the two limits must equal $f(0)$, that would also give $A = 0$. I could then deduce that $a$ can be any real number using the differentiability fact ?
Before looking for differentiability, I feel more comfortable indeed to first observe that continuity requires $A=f(0)=\lim_{0^-}f=0$ (by the squeeze theorem) and $A=f(0)=\lim_{0^+}f=b.$
For $A=b=0$ (and any real number $a$: what follows doesn't depend on this value):
Since the left and right derivatives at $0$ are equal, $f'(0)$ (exists and) is this common value: $f'(0)=0.$
But your first approach can also be written correctly: $f$ is differentiable at $0$ iff the two following limits exist (in $\mathbb R$) and are equal:
By the squeeze theorem $\lim_\limits{x\to0}x\sin\frac\pi x=0$ hence $f'_l(0)$ exists (as a finite limit) iff $A=0,$ and if so, $f'_l(0)=0.$ Similarly, $f'_r(0)$ exists (as a finite limit) iff $b-A=0,$ and if so, $f'_r(0)=0.$
Conclusion (without studying continuity before): $f$ is differentiable at $0$ iff $b=A=0,$ and then, $f'(0)=0.$ (Again, we note that this does not depend on the value of $a$.)