$$f(x) = \cases{x^2\sin\left(\frac\pi x\right) + (x-1)^2\sin\left(\frac \pi {x-1}\right), x\ne0,1 \\ 0, \text{otherwise}}$$
How is this function differentiable at $x=0$ and $x=1$?
Method 1: Differentiating the function using rules gives us $$f'(x) = 2x\sin\left(\frac\pi x\right) - \pi\cos\left(\frac\pi x\right) +2(x-1)\sin\left(\frac \pi {x-1}\right) - \pi\cos\left(\frac\pi {x-1}\right)$$
This function clearly tends to $\pm1$ as $x \to 0$ and hence has an oscillating discontinuity. Since $f'(x)$ is discontinuous, we can say that $f(x)$ is not differentiable at $x=0$
Method 2: Taking the first principle definition of derivative and applying it to this function, we have $$f'(0) = \lim_{x \to 0}\frac{x^2\sin\left(\frac\pi x\right) + (x-1)^2\sin\left(\frac \pi {x-1}\right)}{x} \\ f'(0) \to -\infty$$
However, graphing the function gives me a smooth curve which seems differentiable
Also, GeoGebra evaluates the limit in method 2 as $\pi$
Where is the error here?