0

$$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 image

Also, GeoGebra evaluates the limit in method 2 as $\pi$

img

Where is the error here?

Aniruddha Deb
  • 4,345
  • 11
  • 30

2 Answers2

1

You took the derivative incorrectly, in several places. First,

$$\left(x^2\sin\frac{\pi}{x}\right)' = \left(x^2\right)'\sin\frac{\pi}{x} + x^2\left(\sin\frac{\pi}{x}\right)'$$

and also $$\left(\sin\frac{\pi}{x}\right)' = \cos\frac{\pi}{x}\cdot \left(\frac{\pi}{x}\right)'$$ and $$\left(\frac{\pi}{x}\right)' = (\pi x^{-1})' = -\pi x^{-2} = -\pi/x^2$$

MPW
  • 43,638
1

In the end you need to formally take the limit at $0$ and $1$, in order to handle the rapidly oscillating term correctly. The situation is basically the same in both scenarios, so let's just look at $0$:

$$f'(0)=\lim_{x \to 0} \frac{x^2 \sin(\pi/x)+(x-1)^2 \sin(\pi/(x-1))}{x}$$

The first term goes to zero (the sine oscillates with decaying amplitude). In the second term, at first it looks kind of like no decay is occurring so you should have bad behavior, but actually $\pi/(x-1)$ is going to $-\pi$ where $\sin$ is $0$. You can then take the linear approximation of $\sin(\pi/(x-1))$ near $x=0$ using ordinary derivative rules; you find that it is $0$ at $x=0$ and the derivative is $\pi$. Thus the first term contributes $0$ to the limit while the second term contributes a finite number, specifically $\pi$, to the limit.

Ian
  • 101,645