# Differentiation rule for piecewise definition by interval

View other differentiation rules

## Statement

### Everywhere version

Suppose  and  are functions of one variable, such that both of the functions are defined and differentiable everywhere. Consider a function , defined as follows:



Then, we have the following for continuity:

• The left hand limit of  at  equals .
• The right hand limit of  at  equals .
•  is left continuous at  iff .
•  is right continuous at  iff .
•  is continuous at  iff .

We have the following for differentiability:

•  is left differentiable at  iff , and in this case, the left hand derivative equals .
•  is right differentiable at  iff , and in this case, the right hand derivative equals .
•  is differentiable at  iff ( and ), and in this case, the derivative equals the equal values  and .

### Piecewise definition of derivative

If the conditions for differentiability at  are violated, we get the following piecewise definition for , which excludes the point  from its domain:



If the conditions for differentiability at  are satisfied, we get the following piecewise definition for , which includes the point  in its domain:



where . In particular, the value at  can be included in either the left side or the right side definition.

### Version for higher derivatives

Suppose  and  are functions of one variable, such that both of the functions are defined and  times differentiable everywhere (and hence in particular the functions and their first  derivatives are continuous), for some positive integer . Consider the function:



Then,  is  times differentiable at  if we have all these conditions: , , , . In other words, the values should match, and the values of each of the derivatives up to the  derivative should match. In that case, the  derivative of  at  equals the equal values .

The general piecewise definition of  is, in this case:



where .

### Local generalization

The above holds with the following modification: we only require  to be defined as  on the immediate left of  (i.e., on some interval of the form  for  and as  on the immediate right of  (i.e., on some interval of the form  for ). Further, we only require that  and  be defined and differentiable on open intervals containing , not necessarily on all of .

## Examples

### Example of piecewise rational function

This example is covered in the video embedded above.

Consider the function:



Note that here, in the notation we have used, we have:



Note that the function  is defined around zero, i.e., the definition extends to the point zero and the immediate right -- in fact,  is defined and infinitely differentiable on the interval .

Similarly,  is defined around zero, i.e., i.e., the definition extends to the immediate left of zero -- in fact,  is defined and infinitely differentiable on the interval .

Thus, we see that:

• , , and . Thus, we see that , so the function  is continuous at 0.
• We have  and . We see that  and . We see that , so  is not differentiable at 0.

This means that the first and higher derivatives of  do not exist at 0.

### Example of piecewise polynomial function

This example is covered in the video embedded above.

Consider the function:



Here:



We see that:

• , , and . Thus, , so  is continuous at 0.
•  and . Evaluated at 0, we get  and , so . So,  is not differentiable at 0.

### Example of piecewise polynomial function: higher derivatives

This example is covered in the video embedded above.

Consider the function:



Here, . To keep track of what we're doing, we make a table:

Expression for  Value for  at 0 Expression for  Value for  at 0 Conclusion Explanation
Function      is continuous at 0 We are also given that the function value at 0 is 0. Thus, . So,  is continuous at 0.
First derivative      is differentiable at 0, and  We already checked continuity, and we have now checked that .
Second derivative      is twice differentiable at 0, and  We already checked differentiability. Thus, it suffices to check that , which is true since both equal 2.
Third derivative      is not thrice differentiable at 0 We have .

Note that no higher derivative of  exists at zero. For instance, we do have that , but  does not exist.

Here are the explicit piecewise definitions for the derivatives of :







Note that  is not defined at 0.

For , we have:



But  does not exist.

## Caveat

In situations where the definitions given on one side of a point do not extend naturally to the point, we cannot use the above methods. In most such cases, we need to go back to the original definition of the derivative as a limit of a difference quotient.