If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# 2011 Calculus AB free response #6a

Continuity of piecewise-defined functions. Created by Sal Khan.

## Want to join the conversation?

• This is the only video that came up in the search relating to piecewise functions. I'm learning about these in high school functions, statistics, and trigonometry, and I was just wondering what is the definition of a piecewise function?- I can't find it anywhere in simplified terms. And I'm nowhere near at a level to understand all this calculus. • Shouldn't he check if the slope is continuous also? As in find the derivatives of the two functions at zero and make sure they're equal. If I'm not mistaken, a continuous function must also have a continuous slope. • Can you also do this problem by setting the derivatives of both pieces equal to each other? • No you could not. I'll start by telling what definition of continuity we're using then at the end I'll give you some intuition as to why your proposed solution would be incorrect.

The definition of continuity we are dealing with here is that a function f is continuous at some point 'c' if the the limit as x approaches 'c' exists, and is equal to f(c).

So to solve this problem we only need to confirm two primary conditions by going through the following checklist:

I. Does the limit as x approaches c exist?.
i) Does the limit as x approaches c from the 'left' exist?
ii) Does the limit as x approaches c from the 'right' exist?
iii) Do the limits from i) and ii) equal each other?

II. Is the function at f(c) defined, (as in, does it exist)?
i) Does the limit obtained from I. equal the function at f(c), (as in, does it have the same value)?

If the answer to the all of the above is 'yes', then the function is continuous at that point.
(To extend the continuity to an interval the conditions here need to be met):
http://en.wikipedia.org/wiki/Piecewise_function#Continuity

There are other ways to define continuity though and I encourage you to take a peek at some of them here:

http://en.wikipedia.org/wiki/Continuous_function#Definition

Some of the definitions are a bit abstract though, but if you're familiar with some of the concepts presented there you might learn something by taking a peek at examples presented there.

Now, I promised you I'd try to give you some intuition as to why proposed solution would not work and so I'll try. Although I'm not substitute for Sal ;)
Now, the derivatives of the piecewise function are not equal to each other. It's certainly possible to have a piecewise function where the derivatives are the same at some point but my take on what you're asking is to check the derivative of our piecewise function AT the point in question, so I'll go through why if our function jumps then its derivative doesn't exist there and why that matters. Recall that what all we did in the original solution to the original problem was to check that there were no jumps or holes in the piecewise function, but if we HADN'T checked for that, this is what could occur:
(If you want to read the reasons more thoroughly and put forward more formally then read on here):
http://en.wikipedia.org/wiki/Derivative#Continuity_and_differentiability

So, the derivative is the slope of the function at a given point. So let's say we make a function where f(x)=1 for x less than 0, but then f(x)=10 for all x equal to greater than 0. So, our function is two straight lines that 'jumps' at x=0 from one to ten.
Now, let's remember that the definition of a derivative involved taking some point a, then another one super super close with a distance of h away, so a+h, and then drawing a line between the two and then our derivative would be the slope of that line as those points got closer and closer together. So the limit* as h->0.
*The limit from both the left and the right.

Now, if our point is zero, then we're way up at f(x)=10, and if we subtract h from our point x=0, then no matter how small of an h we choose f(x-h) is going to end up being 1. If we try to draw the line between f(x)=10 and f(x)=1, we just end up with a vertical line, and the slope of a vertical line is essentially infinity.

Well, what about the other side of our point x=0? If we have add h to our point x=0, then then point f(x+h) will be on our line f(x)=10 no matter how small of an h we choose. So the line connecting f(x) and f(x+h) will then be a horizontal line with a slope of zero.

The definition of a limit requires that the limit exist from both the left and the right and be equal to each other, and here we got a slope of infinity on the left and zero from the left, so the limit does not exist and thus neither does the derivative!

So if the derivative exists then we can say the function is continuous. However! Just because the derivative doesn't exist doesn't mean the function isn't continuous!

This is why we used the other method to solve this problem, it's doing almost the same things (checking the limits of h-> of x+-h) but instead of calculating the derivative we check to see if the limits equal the value of our function at whatever point we've picked to make sure our function doesn't 'jump' or have a gap at that point!

For some further insight setting the derivatives 'equal' to each other, note that the derivative of the function is:
-2cos(x) for x less than or equal to zero
-4e^(-4x) for x less than or equal to zero

Now, let's see what happens when we try to take the limit as x approaches zero.
As x approaches zero from the left f(x)=-2
But as x approaches zero from the left f(x)=-4!
So the derivatives do NOT equal each other at x=0 and the graph of the derivatives 'jumps' at zero.

This means that if we had tried to take the derivative at x=0 (assuming that's what you meant by setting the derivatives equal to each other?) we would have come up with that the derivative doesn't exist and we'd be no closer to our answer.

I hoped that helped clear things up a bit and I'm really sorry that it's so long!
I mean, if anyone ever reads this far they should probably get a medal! Thank you for reading and I can only hope it has been of some use to someone! ^_^
• I am learning about piecewise functions in my high school Calculus AB class. Is there a way to graph the function on a TI-84 Calculator? • In my high school AP Calculus class we are learning about the Intermediate Value Theorem. I can't find any videos about IVT though. Does anybody know where I could find one? • What is the point of a piece-wise function? How can this be applied to real world data/problems? • Piecewise functions are extremely useful when you are analyzing situations in which the way that two (or more) variables interact is not consistent.

For example, if you are measuring the way that a substance absorbs energy as it is being heated, you will have one type of relationship below the melting point, a completely different relationship during melting, and then a third relationship after melting. Piecewise functions are really the only useful way to describe such data.

And, even outside of the realm of scientific research, piecewise functions are extremely useful. In business, costs and revenue might be quite distinct in the summer months compared to the winter. Rather than attempting a single formula to model such finances, you would instead develop a piecewise function that varies depending on what month of the year it is. 