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.

Main content

2011 Calculus AB free response #6a

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

Want to join the conversation?

  • blobby green style avatar for user kitkatkittymegan
    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.
    (15 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Stephen Warner
    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.
    (6 votes)
    Default Khan Academy avatar avatar for user
  • leaf grey style avatar for user Brandon Miller
    Can you also do this problem by setting the derivatives of both pieces equal to each other?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leaf red style avatar for user Azirapheil
      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! ^_^
      (7 votes)
  • blobby green style avatar for user mimikay5859
    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?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • leaf blue style avatar for user Elizabeth Ward
    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?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user LHS
      MIT OpenCourseware (OCW) should have one. Sorry I don't have the exact link but find a single variable calculus course (18.01) and browse their lecture notes or videos.

      Basically, the IVT just says that if your continuous function moves from a height of y1 to y2 then it has to hit every single value in-between. It's intuitively obvious, but the proof is technical.
      (3 votes)
  • winston default style avatar for user Ammad Hashmi
    What is the point of a piece-wise function? How can this be applied to real world data/problems?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      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.
      (2 votes)
  • blobby green style avatar for user Grace Allyn Veldsma
    if you have a set of information for g(x) and you can build an equation but you only have half the information you need for h(x) (ex. y=2.43(x)+b) how do you find your missing information for the second piece of your piecewise function with what you are given?
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

Problem number six. Let f be defined by f of x is equal to-- and we have two cases. When x is less than or equal to 0, f is 1 minus 2 sine of x. When x is greater than 0, f is e to the negative 4x. Show that f is continuous at x equals 0. So for something to be continuous at x equals 0, let's think about what has to happen. So if I have a function here-- So that is my x-axis. And let's say this is my y-axis. And we care about what happens at x equals 0. So x equals 0 there. And let's say that this is our function. So maybe our function maybe looks something like this. I don't know. Well, this one in particular probably looks something like this. This one in particular might look-- who knows. And then it might look something like that. And the particulars are that important. We just have to think about what they're asking. In order for it to be continuous here, so the limit as we approach 0 from the left should be equal to the value of the function at 0. So the limit of f of x should be equal to f of 0, which should be equal to the limit as we approach from the right, which should be equal to the limit as we approach 0 from the right. So that should be equal to the limit as x approaches 0 from the right of f of x. And the reason why this matters is, if this wasn't the case, if f of 0 wasn't the same as the limit, then we might have a gap right over there. So you could have limits. So you could have a situation like this, where you have a gap right over there. And then it looks something like that. So the two limits from the left and the right both exist, and the limit at that point would exist. But if the function itself does not equal that value there, if it equals something else, then the function would not be continuous. So that's why the limit has to be equal to the value of the function in order for it to be continuous. So let's think about whether all of these things equal each other. First of all, let's just think about the value of the function there. So remember, we're doing part a. F of 0 is equal to-- we're going to use this first case, because that's the case for x is less than or equal to 0. So f of 0 is going to be equal to 1 minus 2 sine of 0. Well, sine of 0 is 0, 2 times 0 is 0. So this whole thing is 0. 1 minus 0 is 1. Fair enough. Now let's think about the limit as x approaches 0 from the left-hand side. So as we approach 0 from the left-hand side of f of x. So as we approach 0 from the left-hand hand side, we're dealing with values of x that are less than 0. So once again, we're dealing with this first case up here. So this is the limit as x approaches 0 from the left-hand side of 1 minus 2 sine of x. Now, sine of x is continuous. It's a continuous function. So this is going to be the same thing as 1 minus 2 sine of 0, which we've already figured out, which is exactly equal to 1. So this is equal to 1. So the value of the limit as we approach from the left is the same as the value of the function. Now let's do it for as we approach from the right-- as we approach from values of x greater than 0. So let's think about the limit as we approach 0 from the right of f of x. So here, we're dealing with values of x that are larger than 0. So we're dealing with this case right over here. So that's going to be the limit as x approaches 0 from the right of e to the negative 4x. And for the x's that we care about, or actually in general, this is a continuous function. This is a continuous function. So this is going to be the same thing as e to the negative 4 times 0, which is just e to the 0, which is just 1. So this, once again, is equal to 1. So the function is equal to 1 at that point, the limit as we approach from the left is equal to 1, and the limit as we approach from the right is equal to 1. So the function is continuous there.