Derivative of a multivariable, piecewise function

multivariable-calculuspartial derivative

I was asked to show that the function $h(t)=f(g(t))$ is differentiable at $t=0$, where

$f(x,y)=\begin{cases}
\frac{x^2y}{x^2+y^2} & (x,y)\neq 0 \\ 0 & (x,y)=0 \end{cases}$

and $\vec{g}(t)=(kt,pt)$ for constants $k$ and $p$.

I made a diagram and said "$h$ is a function of $x$ and $y$, which are functions of $t$. Hence, $h'(t)=f_x(x,y)k+f_y(x,y)p$." I then plugged in $t=0$, which gave me $h'(0)=0$. (I had calculated $f_x$ and $f_y$ beforehand and found them to be $0$ at $(x,y)=(0,0)$.)

However, my answer is marked wrong and the correct answer is $\frac{k^2p}{k^2+p^2}$. Why am I wrong, and why is this the correct answer?

Best Answer

To see that this is the correct answer, we compute the derivative from first principles

$$h'(0)=\lim_{t\to 0} \frac{h(t)-h(0)}{t}$$ which reduces to $$h'(0)=\lim_{t\to 0}\frac{k^2pt^3}{k^2t^3+p^2t^3}=\frac{k^2p}{k^2+p^2}$$

The reason your calculation is wrong is because $f(x,y)$ is not differentiable at $(0,0)$, which is to say there doesn't exist a linear map $df_0$ such that

$$\lim_{(x,y)\to(0,0)}\frac{||f(x,y)-f(0,0)-df_0(x,y)||}{||(x,y)||}=0$$

In the proof of chain rule, we use this fact, which is why chain rule doesn't apply here. Conceptually, this is saying the directionally derivative doesn't change in a "sensible" way, which we would need to be able to write it in terms of the partial derivatives