Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In other words, how do you differentiate a piecewise function?

Are they just done in several parts, as if differentiating more than one function, and so then the derivative is also a piecewise function? I imagine then that if the seperate functions that make up the 'pieces' of the piecewise derivative are the same, then the derivative can then be rewritten as a non-piecewise function.

Is that the general idea?

share|cite|improve this question
Not only the general idea, but the exact idea! (Though I guess you have to be a teeny bit careful about differentiability at the endpoints when gluing together to make your non-piecewise derivative.) – Cam McLeman Jan 6 '12 at 18:02
That's the kind of response I like. Thanks! Maybe you can take a look at my follow up question… – Korgan Rivera Jan 6 '12 at 18:22

The general idea would be to compute $$ \lim_{x \to x_0} \frac{ f(x) - f(x_0) }{x - x_0}. $$ Now it would help if we could save ourselves some time in particular cases. When the derivative of the function is just well-known by standard techniques, go for it. If your function is piece-wise defined, then you can look at the domain where the pieces are well-known differentiable functions. For instance $$ |x| = \begin{cases} x & \text{ if } x > 0 \\ -x & \text{ if } x < 0 \\ 0 & \text{ if } x = 0. \end{cases} $$ Note that I haven't included $0$ in either of the cases. Why? Because a single point can be treated alone, and the other constraints on the domain are open sets, that is, for every point in the set $\{ x > 0 \}$, when I get close enough to any point $x_0$ from that set, I am sure that I am still in that set. The same goes for $x < 0$. Although for $x = 0$ I don't have such luxury ; if I want to compute the derivative, I have to consider two "pieces" of my piece-wise defined function, which is not very nice to deal with.

Since $x$ and $-x$ are differentiable functions and that they coincide with $|x|$ over open intervals (here $x$ coincides with $|x|$ over $\{ x > 0 \}$ and $-x$ coincides with $|x|$ over $\{ x < 0\}$, everywhere there I can say that their derivatives are equal (i.e. $+1$ when $x > 0$ and $-1$ when $x < 0$). I cannot say the same for $x = 0$ because no differentiable function coincides with $|x|$ over an open interval containing $0$, since $|x|$ is not differentiable there.

Hope that helps,

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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