Given a piecewise function, let's say:

$$f(x)= \begin{cases} x^2 \quad x < 0 \\ x^3 \quad x \ge 0 \end{cases}$$

Let's say we know the function is continuous and we only deal with real numbers.

I have seen people check if it's differentiable at 0 in two different ways, but I'm not sure if all are correct. So help me out figuring out which are actually correct ways to do it.

Method 1: Use the definition of the derivative, one for x>0 and one for x<0. Check if the the limits you get are the same.

Method 2: Simply differentiate the function like this:

$$f(x)= \begin{cases} 2x\quad x < 0 \\ 3x^2 \quad x > 0 \end{cases}$$

Then check if it's continuous in 0 by checking the limit from both sides.

Which methods are correct? And are there other (analytic) methods?

  • $\begingroup$ @Rahul: Actually, the methods are not equivalent as method $(2)$ checks if the function is continuously differentiable at $x = 0$ while method $(1)$ checks only if the function is differentiable at $x = 0$. $\endgroup$
    – levap
    Apr 27 '17 at 18:04
  • $\begingroup$ @levap: You're right. I misunderstood the statement "one for x>0 and one for x<0"; I would find it clearer if the limiting variable was called $h$ or $\Delta x$ which is more standard. $\endgroup$
    – user856
    Apr 27 '17 at 21:09

Method $(1)$ is correct because it uses the definition of differentiability as the existence of a certain limit and check its existence by checking the existence and agreement of two one-sided limits.

Method $(2)$ works under certain assumptions on $f$ which are most often met. However, it only gives you a sufficient criterion for the differentiability of $f$, not a necessary one. Assume the problematic point is $x_0$ and that the function $f$ is continuous on some interval containing $x_0$ and differentiable on some punctured interval containing $x_0$. Method $(2)$ suggests that if

$$ \lim_{x \to x_0^{-}} f'(x) = \lim_{x \to x_0^{+}} f'(x) $$

then $f$ is differentiable at $x = x_0$ and

$$ f'(x_0) = \lim_{x \to x_0^{-}} f'(x) = \lim_{x \to x_0^{+}} f'(x). $$

This is indeed true. Let $h > 0$ be small enough. Since $f$ is continuous on $[x_0, x_0 + h]$ and differentiable on $(x_0,x_0 + h)$, the mean value theorem implies that

$$ \frac{f(x_0 + h) - f(x_0)}{h} = f'(c_h) $$

for some $c_h \in (x_0, x_0 + h)$. As $h \to 0^{+}$, we see that $c_h \to x_0$ so if the limit $\lim_{x \to x_0^{+}} f'(x)$ exists we have

$$ f'_{+}(x_0) = \lim_{h \to 0^{+}} \frac{f(x_0 + h) - f(x_0)}{h} = \lim_{h \to 0^{+}} f'(c_h) = \lim_{x \to x_0^{+}} f'(x_0). $$

Repeating the same argument for $f'_{-}(x_0)$ we have proved that method $(2)$ works under the assumptions above.

However, it might be that one of the limits $\lim_{x \to x_0^{-}} f'(x), \lim_{x \to x_0^{+}} f'(x)$ fails to exist and yet the function $f$ is differentiable at $x = x_0$. The reason is that method $(2)$ actually checks if $f$ is continuously differentiable at $x = x_0$, not only differentiable! For example, if

$$ f(x) = \begin{cases} x^2 \sin \left( \frac{1}{x} \right) & x \neq 0, \\ 0 & x = 0 \end{cases} $$

then $f$ is differentiable at $x = 0$ with $f'(0) = 0$ but

$$ \lim_{x \to 0^{\pm}} f'(x) = \lim_{x \to 0^{\pm}} \left( 2x \sin \left( \frac{1}{x} \right) - \sin \left( \frac{1}{x} \right) \right) $$

do not exist and $f$ is not continuously differentiable at $x = 0$.

  • $\begingroup$ Very nice explanation, I appreciate the examples, thank you. $\endgroup$ May 3 '17 at 9:27

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.