# Function has a gradient despite discontinuity. But does it have a hessian?

In the link here, an example is presented where a function in two variables is discontinuous at the origin and this results in the gradient not existing. This is because approaching the origin along the line $x=y$ leads to a jump (the function is 1/2 everywhere along $x=y$ but not at the origin, so the gradient at the origin along the direction of that line blows up).

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

Then in this link, the function is slightly modified in that $y$ is replaced by $y^2$. So, now the function becomes (it is framed slightly differently in the link but I believe is equivalent to):

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

Now, the curve along which the function is 1/2 is the parabola $x=y^2$ instead of the line $x=y$. So, now no matter what linear direction we travel in from the origin, the gradient can be calculated no problem.

In a way, when the jump in the function was along a linear approach to the origin, the gradient couldn't exist along that approach. But when the jump was along a quadratic approach, the gradient could exist because it is inherently linear.

So the question becomes, what can we say about the hessian in the case of the second function? We got rid of the problem with the gradient by making the direction of constancy quadratic instead of linear. But my intuition says that the hessian defines quadratic functions, so we should run into a problem with it. I just can't seem to make concrete how.

• The function is not differentiable. Even if it is differentiable along every linear direction, this doesn't necessarily imply (total) differentiability. Your example about the $x = y^2$ curve and the axes shows that no linear function will approximate it. Hence there shouldn't be a second derivative (Hessian). – Theo Bendit Mar 4 '18 at 1:07
• @TheoBendit - what is the difference between being differentiable in every direction and "total differentiability"? – Rohit Pandey Mar 4 '18 at 1:09
• en.wikipedia.org/wiki/… – Theo Bendit Mar 4 '18 at 1:11
• Your question rests on an incorrect assumption. The second function has directional derivatives in every direction, but it does not have a gradient. – Rahul Mar 4 '18 at 4:33
• @Rahul - I'm still not sure how to test if the gradient exists. The link provided by Theo mentions checking the existence of the Jacobian, but doesn't detail how exactly we would do that test for a given function? – Rohit Pandey Mar 4 '18 at 5:17