# Is this piecewise function differentiable at the origin?

Let $f: \mathbb{R}^2 \to \mathbb{R}$ be defined by:

$f(x,y) = \begin{cases}y - x^2, & y\geq x^2 \\0, & -x^2\leq y < x^2 \\ y + x^2, & y < -x^2\end{cases}$

(a) Is $f$ differentiable at the origin?

(b) Is f of class $C^1$ at the origin?

My attempt at a solution:

$\frac{\partial f}{\partial x}(0,0)$ = $\lim_{h\to0}\frac{f(h,0) - f(0,0)}{h} =$ $\lim_{h\to0}\frac{(0 - h^2) - (0-0)}{h} = -h^2/h =$$-h = 0 \frac{\partial f}{\partial y}(0,0) = \lim_{h\to0}\frac{f(0,h) - f(0,0)}{h} = \lim_{h\to0}\frac{(h - 0) - (0-0)}{h} = h/h = 1 So the partial derivatives exist at (0,0) and \nabla f = (0,1) (b) I can see that f is not C^1 since the partial derivatives of f with respect to y are not continuous at (0,0) (a) If f were differentiable at the origin, then: \lim_{(s,t) \to (0,0)} \frac{f(0+s,0+t) - f(0,0) - \langle 0,1 \rangle \cdot (s,t)}{|(s,t)|} \to 0 which simplifies to: \lim_{(s,t) \to (0,0)} \frac{f(s,t)-t}{|(s,t)|} = 0 If this were true then: (1) \qquad \lim_{(s,t) \to (0,0)} \frac{-s^2}{\sqrt{s^2+t^2}} = 0, \qquad \text{on the set where t \ge s^2} (2) \qquad \lim_{(s,t) \to (0,0)} \frac{-t}{\sqrt{s^2+t^2}} = 0, \qquad \text{on the set where -s^2 \leq t < s^2} (3) \qquad \lim_{(s,t) \to (0,0)} \frac{s^2}{\sqrt{s^2+t^2}} = 0, \qquad \text{on the set where t < - s^2} Approaching along the linear path s = mt we see that (1) and (3) evaluate to 0 but that (2) evaluates to \frac{-1}{\sqrt{m+1}} Thus the limit \lim_{(s,t) \to (0,0)} \frac{f(s,t)-t}{|(s,t)|} does not exist and f is not differentiable at the origin. Is this a correct solution? The only other way I can think to do this question is by using the properties of direction derivatives. Let u = (sin (\theta), cos(\theta)) Then the directional derivative of f at (0,0) in the direction of u is defined to be \partial_u f(0,0)= lim_{t \to 0} \frac{f((0,0) +t(sin(\theta), cos(\theta)) - f(0,0)}{t} = lim_{t \to 0} \frac{f(tsin(\theta), tcos(\theta))}{t} = lim_{t \to 0} \frac{tcos(\theta) -t^2sin^2(\theta)}{t} = cos(\theta) So the directional derivatives of f(0,0) all exist and are given by: \partial f(0,0) = \nabla f(0,0)\bullet u = (0,1) \bullet (sin(\theta), cos(\theta)) =(0,cos(\theta)) Wouldn't this imply that the f is differentiable at the origin? Furthermore, since all of the partial derivatives at the origin exist and are continuous, f is C^1 at the origin? • Your evaluation of (2) is not correct, because the linear path s=mt is not contained in the region |t| < s^2: the inequality$$|t| < m^2 t^2$$is equivalent to$$1 < m^2 |t|$$which is false for t near zero. So you have to do something else to evaluate (2). Apr 21, 2018 at 12:41 • @LeeMosher for (2) could I use the path s = 100\sqrt t? Apr 21, 2018 at 21:13 • @LeeMosher But then (2) would evaluate to 0 and this path doesn't satisfy the conditions for (1) or (3). Do I need to find a path the satisfies the conditions for all (1), (2) and (3)? And if so, what do I do if they all evaluate to the same thing? This just shows the limits exists along one path right? I'm really confused. Apr 21, 2018 at 21:22 • I added more to my answer. Apr 21, 2018 at 21:51 • @LeeMosher Ohhh, I see now. Thank you. This really clears things up. I also updated my attempted solution with an argument that uses directional derivatives. I'm not sure if it's a valid argument or not but maybe you could take a look at it. Apr 21, 2018 at 22:12 ## 1 Answer Certainly f is not of class C^1 at the origin: there is no neighborhood of (0,0) in which \partial f/\partial y exists and is continuous. To see why, in the region -x^2 < y < x^2 we have \partial f/\partial y = 1, whereas in the region y \ge x^2 we have \partial f/\partial y = 0. These do not match up continuously at any point of the parabola y=x^2, and yet every neighborhood of (0,0) has points on that parabola. Also, in your attempt to prove that f is differentiable, perhaps you wanted to use the theorem which says that if f is C^1 in a neighborhood of (0,0) then f is differentiable in that neighborhood. But, since f is not C^1 in any neighborhood, this theorem gives no information about differentiability at (0,0). So it looks like you have to go back to the definition of the multivariable derivative. You already know that \partial f/\partial x(0,0)=0 and \partial f/\partial x(0,0)=1. So what you have to determine is whether$$\lim_{(s,t) \to (0,0)} \frac{f(0+s,0+t) - f(0,0) - \langle 0,1 \rangle \cdot (s,t)}{|(s,t)|} \to 0 $$which simplifies to$$\lim_{(s,t) \to (0,0)} \frac{f(s,t)-t}{|(s,t)|} = 0 $$This breaks into three separate limits, and you have to check whether each is true:$$(1) \qquad \lim_{(s,t) \to (0,0)} \frac{-s^2}{\sqrt{s^2+t^2}} = 0, \qquad \text{on the set where$t \ge s^2$} (2) \qquad \lim_{(s,t) \to (0,0)} \frac{-t}{\sqrt{s^2+t^2}} = 0, \qquad \text{on the set where$-s^2 < t < s^2$} (3) \qquad \lim_{(s,t) \to (0,0)} \frac{s^2}{\sqrt{s^2+t^2}} = 0, \qquad \text{on the set where$t \le - s^2$} $$Are they true? It's pretty easy to see that (1) is true, because the limit equation is true on the whole (s,t) plane, since f(x,y)=y-x^2 is differentiable with partial derivatives equal to 0 at (0,0). So the limit is true when restricted to t \ge s^2. Similarly for (3). The limit (2) is also true, although the proof is a bit trickier. If we divide the top and bottom by s we'll get$$\frac{-\frac{t}{s}}{\sqrt{1 + \bigl(\frac{t}{s}\bigr)^2}} $$As (s,t) approaches (0,0) in the region -s^2 \le t < s^2, the ratio \frac{t}{s} approaches 0. So the limiting value is$$\frac{-0}{\sqrt{1 + \bigl(0\bigr)^2}} = 0$$Notice, these limit arguments are not about "approaching$(0,0)$along paths". Thinking about approaching$(0,0)\$ along paths can be a useful argument for disproving a limit equation, but for proving a limit equation it's not a very useful way to think.

• I updated my solution. Is it correct? Apr 20, 2018 at 23:17
• @Lee_Mosher I updated my solution, Is it correct? Apr 21, 2018 at 0:12
• No, your evaluation of (2) is not correct. See my comment to our answer. Apr 21, 2018 at 12:41