[Math] How to determine partial derivatives of a conditional function

calculuspartial derivative

I'm asked to find a point $(a,b)$ where the function
$$
f(z) = \left\{
\begin{array}{ll}
(x-y)^2\sin(\frac{1}{x-y}) &\quad x\not=0 \\
0 & \quad x=y
\end{array}
\right.$$

is differentiable, but the partial derivatives $f_x$ and $f_y$ are not continuous. However I'm not quite sure how to find partial derivatives of such a function.

It's not hard to show that if $x\not=y$ then

$$f_x=2(x-y)\sin(\frac{1}{x-y})-\cos(\frac{1}{x-y})$$

Which is clearly not continuous at any point $(a,a)$. However, how do I know that this partial derivative is actually valid if $x=y$? Because in determining it I used the definition of $f$ when $x\not=y$. So how can I know that we can't have for example $f_x=1$ if $x=y$?

Now I think that in this case you can say that this partial derivative is the correct expression for $f_x$ at a point with $x=y$ because $f$ is continuous at such points. However I'm not sure about that.

Best Answer

I think you have a typo in your $f(z)$. Either way, here is what you should do when $x = y$.

Consider this definition of the partial derivative: $$\frac{\partial f}{\partial x}(x_0,y_0) = \lim_{h\to 0} \frac{f(x_0 + h,y_0) - f(x_0,y_0)}{h}.$$

Set $x_0 = y_0$. $$\frac{\partial f}{\partial x}(x_0,x_0) = \lim_{h\to 0} \frac{f(x_0 + h,x_0) - f(x_0,x_0)}{h}.$$

Note that $f(x_0, x_0) = 0$. Therefore, $$\frac{\partial f}{\partial x}(x_0,x_0) = \lim_{h\to 0} \frac{f(x_0 + h,x_0)}{h} = \lim_{h\to 0}\; h^2\sin(1/h).$$

Notice how this value is the same for every $x_0$.