Why the results from chain rule and partial derivative do not match?

Given $f(x,y) = xy^2/(x^2+y^2)$, if $x^2 + y^2 > 0$ else $f(x,y) = 0$ where $x(t)=t, y(t)=t$

If we apply chain rule: $f(t) = t^3/(2t^2) = t/2$ then $f'(t)=1/2$

If we try to calculate partial derivatives:

$f'x(x,y) = y^2(y^2-x^2)/(x^2 + y^2)$ then $f'x(0,0)=0$

and

$f'y(x,y) = 2x^3y/(x^2 + y^2)$ then $f'y(0,0)=0$


Solution 1:

The partial derivatives are \begin{align} f'_x(x,y)&=\frac{y^2(x^2+y^2)-xy^2\cdot2x}{(x^2+y^2)^2}=\frac{y^2(y^2-x^2)}{(x^2+y^2)^2} \\[6px] f'_y(x,y)&=\frac{2xy(x^2+y^2)-xy^2\cdot2y}{(x^2+y^2)^2}=\frac{2xy^3}{(x^2+y^2)^2} \end{align} but these expressions are undefined at $(0,0)$. You get, for $t\ne0$, $$ f'_x(t,t)=0,\qquad f'_y(t,t)=\frac{2t^4}{4t^4}=\frac{1}{2} $$ but it makes no sense to compute this for $t=0$.

The function $\varphi(t)=f(t,t)$ for $t\ne0$ and $\varphi(0)=0$ is differentiable, but the function $f$ is not differentiable at $(0,0)$. That's not a strange fact.

The partial derivatives exist at $(0,0)$ and they are zero (thanks to Hans Lundmark for poking me to observe this), but this cannot be used for computing the derivative of $\varphi$ at $0$. We might use the directional derivative, though. $$ \lim_{h\to0}\frac{f(0+h,0+h)-f(0,0)}{h}=\lim_{h\to0}\frac{h^3}{2h^3}=\frac{1}{2} $$ By the way, this proves that $f$ is not differentiable at $(0,0)$.

Solution 2:

Your partial derivatives are wrong. Compute again $f_x(x,y)$ and $f_y(x,y)$. Then you will see, with the chain rule, that

$$ \frac{d}{dt}f(t,t)= f_x(t,t) +f_y(t,t)=1/2$$

for $t \ne 0.$

For $t=0$ you can not apply the chain rule, since $f$ is not differentiable at $(0,0).$

Solution 3:

The simple answer is that the derivative (or rather, the gradient) of the finction does not exist at $(0,0)$

The reason for this is a bit tricky, but it boils down to the fact that the gradient muat be consistent for all paths to the point of evaluation. Kinda similar to where a derivative doesn't exist at zero for $f(x)=|x|$ not because you can't find the derivative from one direction or the other, but because the derivative is not equal for both directions. For a 2d domain, we find that the derivative of $f$ along $x=0$ and $y=0$ is $0$, but the derivative along $x=y=t$ is $1/2$.

If the gradient did exist, then it would be uniquely identified by $f_y$ and $f_x$, and that's what lets you decompose the derivitive by partial derivitives. But since the gradient does not exist, the partial derivatives don't allow you to find the derivative for an arbitrary path, as you attempted.

For reference, here's a picture of your function $f(x,y)$ near $(0,0)$. Note that it is flat for some paths thru the origin, but sloped for others.

Graph of f(x)