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

Worked example: evaluating piecewise functions

A piecewise function is a function that is defined in separate "pieces" or intervals. For each region or interval, the function may have a different equation or rule that describes it. We can evaluate piecewise functions (find the value of the function) by using their formulas or their graphs.

Want to join the conversation?

  • duskpin tree style avatar for user Yvonne Huang
    What is the E symbol mean? ()
    (13 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Izzy
    Brackets mean included and parenthesis mean up to the number but not including it, correct? Or have I learned them in the wrong order?
    (12 votes)
    Default Khan Academy avatar avatar for user
  • piceratops seedling style avatar for user Suleman Ali
    You matched g(4.0001) with -3 open circle but you didn't match g(9) with 3 you said because its a open circle and there is no closed circle so it is undefined why ?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Stefen
      For this third piece of the piece wise function, we have that when 4 < x < 9, then f(x) = 3. Notice that x cannot be equal to 4 or 9; it has to be greater than 4 and less than 9.

      If they had asked for g(4), that would be undefined to since the open circle on 4 means that the value 4 is NOT included. BUT any value ever so slightly greater than 4 IS included, so g(4.0001), which is 0.0001 greater than 4, so it IS included.

      Now when x=9, f(x) is undefined. BUT if we got close to x=9, say x=8.999, then that would be defined and g(8.999)=-3.
      (14 votes)
  • male robot donald style avatar for user Woke and Broke
    someone please explain what empty and filled circles mean
    (4 votes)
    Default Khan Academy avatar avatar for user
    • duskpin sapling style avatar for user Iris Nogueroles Langa
      Empty and filled circles tell you whether a value is included or not.

      Empty circle = Used for < and >
      Filled circle = Used for ≤ and ≥

      For example, at , the instructor says t is less than or equal to -10 in the first function. Therefore, you plot a full circle at the point where t = -10 and graph the function for the values less than -10 from there.

      On the other hand, the second function is for values -10 < t < -2. This means you plot an empty circle at the point where t = -10 and an empty circle at the point where t = -2. You then graph the values in between.

      Finally, for the third function where t ≥ -2, you plot the point t = -2 with a full circle and graph the values greater than this.

      When you combine all three pieces, you can see the piecewise function at .

      Hope this helps!
      (11 votes)
  • marcimus pink style avatar for user musajaved6
    At , which case would we use if we wanted to find out h(0) ?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      You would use the 1st option. The domains for each piece are defined using interval notation. Since the 1st piece is defined for x = (-infinity, 0], the square bracket tells us that this is <=0. On the next piece, you will see x = (0, 8]. The parentheses on the 0 tell us that zero is not in this domain, while the square bracket on the 8 tells us the 8 is in the domain for this piece.
      Hope this helps.
      (6 votes)
  • duskpin ultimate style avatar for user Arki🖤
    What are some real-world scenarios that can be modeled by a piece-wise function?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      Postage is often piecewise, the cost depends on the weight in ranges. If you buy products from a company, they often charge shipping costs according to how much you spend (and these are in a range of numbers). Plumbers and other salaries are often piecewise because they will charge for the full hour for any part of the hour the work, so it steps up by the hour.
      (7 votes)
  • starky ultimate style avatar for user José Sánchez
    in t^2-5t why (-10)^2 and not -10^2?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      In the first correct method, you are squaring the number -10
      In the second method, you only square 10 and changing the sign
      The importance is that a negative times a negative is a positive, so squaring any negative number will always give you a positive
      And later on, you will find that you cannot take the square root of a negative number unless you go into a part of Math called imaginary numbers
      (2 votes)
  • blobby green style avatar for user 234220
    can you explains this word mean please "∈"
    (4 votes)
    Default Khan Academy avatar avatar for user
  • mr pants orange style avatar for user casey_eyring
    What's the explanation/convention behind a parenthesis for infinity ∞ in a set? In other words, why is it (-∞, 5] or [-1, ∞)? Why not [-∞, 5] or (-1, ∞]?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      The square bracket is only used then the interval includes a specific number, like the 5 or the -1. It says that specific value is included in the interval. Since infinity is not a specific number and represents an infinite set of values, we always use a parentheses.

      Hope this helps.
      (5 votes)
  • blobby green style avatar for user 😊
    how to evaluate piecewise function from its graph?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user loumast17
      First you need to be comfortable finding the slope of a line on a graph, basically it's taking two points and subtracting the two ys and dividing that by the difference of the two x coordinates. . You will potentially have to do this for each segment.

      Now you need to look at what the domain is (or x values) each segment of the piecewise function covers, and pay attention to if the ending/ beginning dots of each line are filled in or hollow. Say the first line segment has a hollow dot at x=0 and a filled one at x=5, the y value does not come into play just yet. Then this part of the equation will have the appropriate function for a line (which you would find the slope and y intercept for) for 0 < x ≤ 5. We have the less than or equal to sign on the right since the dot at 5 for this line is filled in.
      (4 votes)

Video transcript

- [Instructor] Consider the following piecewise function and we say f(t) is equal to and they tell us what it's equal to based on what t is, so if t is less than or equal to -10, we use this case. If t is between -10 and -2, we use this case. And if t is greater than or equal to -2, we use this case. And then they ask us what is the value of f(-10)? So t is going to be equal to -10, so which case do we use? So let's see. If t is less than or equal to -10, we use this top case, right over here and t is equal to -10, that's the one that we're trying to evaluate. So we wanna use this case right over here. So f(-10) is going to be equal to -10, everywhere we see a t here, we substitute it with a -10. - 10 squared minus 5 times, actually I don't have a denominator there, I don't know why I wrote it so high. So it's gonna be -10 squared minus 5 times -10. So let's see. - 10 squared, that's positive 100 and then negative, or subtracting 5 times -10, this is going to be subtracting -50 or you're going to add 50, so this is going to be equal to 150. f(10) is 150, 'cause we used this case up here, 'cause t is -10. Let's do another one of these examples. So, here we have consider the following piecewise function, alright. What is the value of h(-3)? See when h is -3, which case do we use? We use this case if our x is between negative infinity and zero. And -3 is in between negative infinity and zero, so we're gonna use this case right over here. If it was positive three, we would use this case. If it was positive 30, we would use this case. So we're going to use the first case again and so for h(-3), we're gonna take -3 to the third power. So let's see. h(-3) is going to be -3 to the third power which is -27. And we're done. That's h(-3). Because we're using this case, you could almost ignore these second two cases right over here. Let's do one more example. This one's a little bit different. Below is a graph of the step function g(x) so we can see g(x) right over here. It starts when x equals -9, it's at 3, and then it jumps up, and then it jumps down. Match each expression with its value. So g(-3.0001), so -3.0001, so that's right over here and g of that, we see is equal to 3. So this is going to be equal to 3 right over here. g(3.99999) 3.99999, almost 4, so let's draw a dotted line right here, it's gonna be almost 4, well g(3.99999) is going to be 7. We see that right over there. So that is equal to 7. g(4.00001). So g(4) is still 7, but as soon as we go above 4, we drop down over here, so g(4.00001) is going to be -3. I wanna, actually, let's focus on that a little bit more. How did I know that? Well I know that g(4) is 7 and not -3 because we have this dot is circled in up here and it's hollow down here. But as soon as we get any amount larger than 4, then the function drops down to this. So 4.0000, as many, just slightly above 4, the value of our function is going to be -3. Now let's do g(9). So g(9), that's when x is 9 and we go down here. You might be tempted to say it's -3, but you see, at this point right over here, we have an open circle. So that means that while it's not, you can't say that the function is -3 right over there and there's no other place where we have a filled-in circle for x equals 9 so the function g actually isn't defined at x equals 9. So I'm gonna put undefined right over there.