# Strange partial derivative

Tags:
1. Dec 23, 2014

### AwesomeTrains

1. The problem statement, all variables and given/known data
I want to find the partial derivatives in the point $(0,0)$ of the function $f:\mathbb R^2\rightarrow\mathbb R$ $f(x,y):= \begin{cases} 0 & \text{if } (x,y) = (0,0) \\ \frac{y^5}{2x^4+y^4} & otherwise \end{cases}$

2. Relevant equations
Our definition of the partial derivatives in the direction $\vec v = (v_1,v_2)$ with $\|\vec v \|_2 = 1$ at the point $(0,0)$
$D_v(f)(0,0)=\lim_{h\rightarrow 0} {\frac{f((0,0)+h\vec v)-f(0,0)}{h}}$
3. The attempt at a solution
Straight forward:
$D_v(f)(0,0)=\lim_{h\rightarrow 0} {\frac{f((0,0)+h\vec v)-f(0,0)}{h}}=\lim_{h\rightarrow 0} {\frac{f(h(v_1,v_2))}{h}}=\lim_{h\rightarrow 0} {\frac{\frac{h^5v_2^5}{2h^4v_1^4+h^4v_2^4}}{h}}= \frac{v_2^5}{2v_1^4+v_2^4}$ Then in the direction $\vec v = (0,1),(y-direction)$ the tangent slope should be $\frac{1^5}{2*0^4+1^4}=1$
Here's my problem: When I evaluate the same thing in maple I get 0. Where's my error?
(I've attached a picture of maple)
Also I can't see from the graph that the tangent slope in the y-direction should be 0, I think.

Any feedback is very appreciated :)
Alex

2. Dec 23, 2014

### HallsofIvy

Staff Emeritus
I am puzzled as to why you are trying to find the general directional derivative when you are asked only to find the partial derivatives.
(It is quite possible for a function to have partial derivatives at a point and not be differentiable there- in which case, it would not have directional derivatives I all directions.)

Here, the partial derivative, at (0, 0), with respect to x is given by $$\lim_{h\to 0}\frac{f(h, 0)- f(0,0)}{h}$$ and the derivative with respect to y is given by $$\lim_{h\to 0}\frac{f(0,h)- f(0,0)}{h}$$[/B]

3. Dec 23, 2014

### Dick

You didn't make any mistake. It looks like Maple is being sloppy about how it takes the limit.

4. Dec 23, 2014

### AwesomeTrains

Thanks for the replies.
Ah okay, I meant the general directional derivatives and not the partial ones. I just used the partial in y-direction to test my result and was wondering why it was differing from maple. Is it true that is differentiable? I used the argument that all partial derivatives exists and are continuous. Since that quotient exists for all $$\vec v$$ with norm 1.

Okay thanks. This was my question :)
Do you know how I then get the correct result from maple?

5. Dec 23, 2014

### Dick

Just get maple to do what you did. Don't trust it to be magic on this one. More importantly, your function is NOT differentiable at (0,0). It has directional derivatives in all directions - but it doesn't have a tangent plane. The partials exist everywhere but they are NOT continuous at (0,0). Write down the y-partial derivative at a general point (x,y) using quotient rule, etc. Now approach (0,0) by setting x=0 and letting y->0. You get limit 1, just as you worked out. Then approach (0,0) by setting y=0 and letting x->0. You get 0. That's not the way a continuous partial is supposed to work.

6. Dec 23, 2014

### AwesomeTrains

Ah okay great thank you very much :) I understand now. I was sloppy when checking for continuity at (0,0), took it for granted :)

7. Dec 23, 2014

### Ray Vickson

You are mis-using Maple. Your first statement gives a formula for a variable with the strange name "f(x,y)"; it is NOT a function! To make it a function you need to use the arrow assignment "->", so you need to say
f:=(x,y)-> piecewise(x = 0 and y =0,0,y^5/(2*x^4+y^4));

That works like a charm.

8. Dec 23, 2014

### AwesomeTrains

Ah I see, thanks for the tip. I'll do that in the future

9. Dec 23, 2014

### Ray Vickson

Just so you know: sometimes f:x-> ... gives a usable function f(x), but sometimes if does not. For example, if you say f:=x->diff(x^2,x), the inputs f(y) and f(a) give 2y and 2a, as they should; however, f(2) fails, because Maple does not know how to interpret diff(1^2,1) = d(1^2)/d1. So, what you need to do is make sure Maple refers to the result of diff(x^2,x), not to the original formula. You might think that saying fx:=diff(x^2,x); f:=x->fx will do it, but it does not: it gives f(y) = 2x and f(1) = 2x. So: what to do? In the presence of operations (such as "diff" and "int") when defining a function, I always use the "unapply" method. For example, f:=unapply(diff(x^2,x),x) gives f(x) = 2x, f(a) = 2a and f(1) = 2, exactly as it should. The alternative fx:=diff(x^2,x); f:=unapply(fx,x); gives the same correct behaviour.

Strangely, in your case, unapply does not work, but the direct definition does! When I try
f:=unapply(piecewise(...), (x,y)) or fxy = piecewise(...), f:=unapply(fxy,(x,y)) it fails: it just defines f(x,y) as the part where (x,y) =/= (0,0), and declares a "division by 0" error for f(0,0). (However, this odd behavour does not seem to occur for 1-variable piecewise function, and not even for all two-variable piecewise functions--only for yours!)

Note: further checking seems to indicate it has something to do with the nature of the excluded region, which is a single point in your case. The alternative example
fxy:=piecewise(x > 0 and y > 0, g(x,y),0); f:=unapply(fxy, (x,y))
works as it should. Here, the "excluded" region is two-dimensional--quadrants 2,3,4-- rather than a single point.

So, the bottom line is: most of the time the "unapply" method is best, as it works almost always; but on rare examples you need to fall back on the arrow assignment method. Whenever I define piecewise functions, I always check them first, to make sure they are doing what I want.

Last edited: Dec 23, 2014
10. Dec 24, 2014

### AwesomeTrains

Thanks for the help Ray. In cases with single point exclusions I use the arrow and otherwise unapply, did I get it right?

11. Dec 24, 2014

### Ray Vickson

Sort of, but the real message is: always check it before doing further calculations with it.