# Derivability of a piecewise function

Let's say I have a continuous piecewise function of a single variable, so that $y = f(x)$ if $x < c$ and $y = g(x)$ if $x>=c$. Is it right to say that the derivative of the function at $x=c$ exists iff $f'(c-)=g'(c+)$, where $f'$ and $g'$ are obtained using derivative rules?

This would seem reasonable to me, and I fail to find an example where this does not hold. However, my calculus professors have always taught me that the only way to evaluate a derivative of such a point is using the limit definition of the derivative.

-
Thanks @Mercy , but that case is not a counterexample of what I'm proposing. The function is continuous, $f'(0) = -1$, $g'(0) = 1$ and thus $f'(0) != g'(0)$. So, according to what I'm saying, $f'(0)$ doesn't exist. And this is correct. –  LGenzelis Aug 15 '14 at 6:24

No. Consider for example $c=0$, $g(x)=0$ and $f(x)=x^2\sin(1/x)$. (This example is from this other question.) The derivative $f'$ has no limit at zero, but the piecewise defined function is differentiable at zero.

The following statement is true, however: Let $f,g$ be continuously differentiable (up to $c$) and $h$ the piecewise defined function you gave. Then $h$ is continuously differentiable iff $f'(c-)=g'(c+)$. The important difference is in the continuity of the derivative.

-

In general a function $h$ is differentiable at $c$ iff $\lim_{x\rightarrow c+}\frac{h\left(x\right)-h\left(c\right)}{x-c}$ and $\lim_{x\rightarrow c-}\frac{h\left(x\right)-h\left(c\right)}{x-c}$ both exist and are equal.

In your case $\lim_{x\rightarrow c+}\frac{h\left(x\right)-h\left(c\right)}{x-c}=\lim_{x\rightarrow c+}\frac{g\left(x\right)-g\left(c\right)}{x-c}$ and $\lim_{x\rightarrow c-}\frac{h\left(x\right)-h\left(c\right)}{x-c}=\lim_{x\rightarrow c-}\frac{f\left(x\right)-g\left(c\right)}{x-c}$.

Note that existence of the last mentioned limit requires that $\lim_{x\rightarrow c-}f\left(x\right)=g\left(c\right)$ (differentiable functions are continuous).

-

As the other answers already mention, this won't work. Hoewever, if you are content with distributions such that $y(x)\stackrel!=y(x_0) + \int_{x_0}^x y'(\chi)\,d\chi$, then you could state

$$y'(x) = h'(c) + (g(x)-f(x))\delta(x-c)$$

where $h'(x)$ is $f'(x)$ or $g'(x)$ depending on the region and $\delta(x)$ is the Dirac delta distribution. This still requires that both $\lim\limits_{x\to c}f(x)$ and $\lim\limits_{x\to c}g(x)$ exist, though.

-

First you have to find RHD at $x=c$ this can be done by taking $\lim_{x\to a+}f'(x)$ provided

1. function is right continuous at $x=a$
2. there exists some right neighbourhood where $f(x)$ is differentiable
3. $\lim_{x\to a+}$ exists it is equal to + or - infinity

Similarly find LHD and if both are same then the derivative you get from here is your and.

Note, if any one of the above conditions fail you can't use this.

-
Welcome to math.SE! Please take some time to learn how to typeset formulae via LaTeX –  Tobias Kienzler Aug 15 '14 at 11:18