Given the function:

$$f(x) = \begin{cases} x^2+1 & \text{if $x\ge0$} \\ x^2-1 & \text{if $x < 0$} \end{cases}$$

Question: are we justified to say that the derivative at $f(0)$ exists? If so, what is $f'(0)$? And how do we justify it?

Of course I do realize that the function isn't continuous at $x=0$ but still since the slope near $x=0$ seems equal near $0+$ and $0-$ I wondered why we can't say that $f'(0)=0$

What I tried is this:

$f_+'(0)=\lim\limits_{h \to 0+}\frac{(x+h)^2+1-(x^2+1)}{h}=\lim\limits_{h \to 0+}\frac{(0+h)^2+1-(0^2+1)}{h}=\lim\limits_{h \to 0+}\frac{h^2}{h}=h=0$ $f_-'(0)=\lim\limits_{h \to 0-}\frac{(x+h)^2+1-(x^2+1)}{h}=\lim\limits_{h \to 0-}\frac{(0+h)^2+1-(0^2+1)}{h}=\lim\limits_{h \to 0-}\frac{h^2}{h}=h=0$

My conclusion is that since both the right and left limit using the definition of the derivative exist and generate the same answer the limit exists such that $f'(0)=0$.

Apparently this is not true, so what is my mistake?

  • 2
    $\begingroup$ did you realised that this function isn't continuous at $x=0$? $\endgroup$
    – janmarqz
    Nov 16 '15 at 15:47
  • 2
    $\begingroup$ To add to janmarqz, a function which is not continuous cannot be differentiated. $\endgroup$ Nov 16 '15 at 15:51
  • $\begingroup$ Why can`t you differentiate is the function isn't continuous? The values of the left and right limit of the seperate derivatives are the same... $\endgroup$ Nov 16 '15 at 15:58
  • $\begingroup$ A derivative is calulated by limits but that isn't its definition. The definition is an instantaneous measure of the rate of change. At a discontinuity the rate of change is infinite. So a derivative can not exist. This is, in a way, similar to evaluating a function at asingularity. 1/x simply does not exist at x = 0 even though it exists at every other point in both directions do. The derivative (rate of change) does not exist at 0, even though the calculations from opposite directions of (but not acctually at) zero exist. $\endgroup$
    – fleablood
    Nov 16 '15 at 23:04
  • $\begingroup$ "The values of the left and right limit of the seperate derivatives are the same." Well, as Tim Raczkowski pointed out, they are not. The right limit is 0, but the left limit is negative infinite. $\endgroup$
    – fleablood
    Nov 16 '15 at 23:31

Any function which is differentiable at a point $x_0$ must also be continuous at $x_0$. Since the left and right hand limits of $f$ do not agree, your function is not continuous at $0$. Therefore the derivative does not exist at $0$ even though the derivative seems to be approaching the same value from both directions.

In more detail, $$\lim_{h\to 0^+}\frac{f(0+h)-f(0)}h=\lim_{h\to 0^+}\frac{h^2+1-1}h=\lim_{h\to 0^+}h=0.$$

But $$\lim_{h\to 0^-}\frac{f(0+h)-f(0)}h=\lim_{h\to 0^-}\frac{h^2-1-1}h=\lim_{h\to 0^-}\frac{h^2-2}h=\infty.$$

  • $\begingroup$ If I use the definition of the limit then the left and right limit at x=0 give the same value. So if both right and left limit give the same value, then the limit exists and thus it is also differential? Is this true? $\endgroup$ Nov 16 '15 at 18:41
  • $\begingroup$ No it's not true. If you were look at $f'(0)$ directly from the definition, you would find that it does not exist. $\endgroup$ Nov 16 '15 at 18:43
  • $\begingroup$ How? Using the definition, I can find a left and right side value for f`(0) which are both 0. $\endgroup$ Nov 16 '15 at 20:05
  • $\begingroup$ The definition is $f'(x)=\lim_{h\to 0}(f(x+h)-f(x))/h$. This limit does not exist for $x=0$. $\endgroup$ Nov 16 '15 at 20:09
  • $\begingroup$ Why not? I get h^2/h which is 0 $\endgroup$ Nov 16 '15 at 20:33

If a function $g: \Bbb R \to \Bbb R$ is differentiable at some point $x_0 \in \Bbb R$, then $f$ is also continuous in $x_0$.

Now, let's consider the left- and right-sided limits of your function $f$ at the point $0$. We see that $$ \lim_{x \to 0^+} f(x) = \lim_{x \to 0^+} (x^2 + 1) = 1 \; ,$$ and $$ \lim_{x \to 0^-} f(x) = \lim_{x \to 0^-} (x^2 - 1) = -1 \; , $$ which means that $f$ is not continuous at the point $0$. So $f$ is not differentiable at the point $0$ and $f'(0)$ is not defined.


To be differentiable a function must be continuous. Let's go back to the definition of a derivative. NOT the calculation via limits of derivatives but the conceptual meaning of derivative.

"The derivative of a function of a real variable measures the sensitivity to change of a quantity (a function value or dependent variable) which is determined by another quantity (the independent variable)."

So at x = 0, the functions sensitivity to change as x decreases is infinite. The function "jumps" from value 1 to value -1 in no measurable change at all. This is infinite, huge, and unmeasurable sensitivity.

In short, no derivative can exist at x = 0.


Also your calculation is in error:

$f_-'(0)=\lim\limits_{h \to 0-}\frac{(x+h)^2+1-(x^2+1)}{h}=\lim\limits_{h \to 0-}\frac{(0+h)^2+1-(0^2+1)}{h}=\lim\limits_{h \to 0-}\frac{h^2}{h}=h=0$ is incorrect.

$f_-'(0)=\lim\limits_{h \to 0-}\frac{f(0 -h)-f(0)}{h} =\frac{[(0+h)^2-1]-[(0^2+1)]}{h}$ (Note: $0 - h < 0$ BUT $0 \ge 0$ so $f(0-h) = (0-h)^2 -1 = h^2 -1$ but $f(0) = 0^2 + 1 = 1$)

$=\lim\limits_{h \to 0-}\frac{h^2-2}{h}=\lim\limits_{h \to 0-}\frac{h^2 -2}{h}=h - \frac 2 h= -\infty$

Which is really much more to the point.

As one can't define a discontinuous function as two different values at the discontinuity there will be one direction where $\lim f(x \pm h) - f(x)$ will NOT equal 0. If so you get $\lim f(x \pm h) - f(x)/h = \text{not_zero}/0 = \pm \infty$


You can differentiate any locally integrable function if you view it as a generalized function - in other views as a distribution. The main concept to remember is $$u'=\delta$$

where $u$ is the standard step-function and $\delta$ is Dirac's delta. Hence $$f'(x)=2x+2\delta(x).$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.