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: domain & range of step function

Finding the domain and range of a piecewise function that is constant in each segment. Such functions are called "step functions.".

Want to join the conversation?

  • aqualine ultimate style avatar for user Jhonejay007123
    Can there be a video for when y isn't a static number, when we have equations for x and y? Because I do not know how to get the range for those, nonetheless graph it.
    The only way I can think of doing it, is guess and check from the domain, but there has to be an easier way, is there?
    (34 votes)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user Anshari Hasanbasri
      This answer is a year late, I'm also new to this topic, but I'll try to answer. I don't know if you had done this or not by saying "guess and check for the domain". But anyway, for example, we had a piecewise function like this :
                / 2x+3 , 0 < x <= 2
      f(x) = { x+2 , 2 < x <= 6
      \ 3x , 6 < x <= 11

      Find the range of each clause separately.

      For
      2x+3 , 0 < x <= 2
      , since this is a straight line (with a slope), you just need to find the y values for the endpoints.
      If x were 0,
      2*0+3 = 3

      If x were 2,
      2*2+3 = 7

      What is the range of this clause? that would be
      3 < y <= 7
      or it can be expressed more 'mathy' as
      y or the range of the clause = (3, 7]
      (this means all real values from 3 to 7 (3 is not included, 7 included))

      Now you can find the other clauses' y values the same way. You'll get the range of the clauses :

      range of 2x+3 = (3, 7]
      range of x+2 = (4, 8]
      range of 3x = (18, 66]

      I'm not sure if this is legit, but the range of the whole function is the union of sets (3, 7], (4, 8], (18, 66] or (3, 7] U (4, 8] U (18, 66]

      Am I making myself clear? Please correct me if I made any mistakes. Hope this helps
      (34 votes)
  • blobby green style avatar for user ayobami.famojuro.hsct
    This answer is a year late, I'm also new to this topic, but I'll try to answer. I don't know if you had done this or not by saying "guess and check for the domain". But anyway, for example, we had a piecewise function like this :
    / 2x+3 , 0 < x <= 2
    f(x) = { x+2 , 2 < x <= 6
    \ 3x , 6 < x <= 11
    (3 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      If you want the person who submitted the question to actually see your response, you must use the "reply" link underneath the question. This ties your response to the question and the person who posted the question gets notified. If you don't do this, the chance of that person seeing your response is pretty low.
      (6 votes)
  • duskpin tree style avatar for user smartin
    If the lowest number is 0, how can -7 be an input value?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • winston baby style avatar for user lw630744
    So -7 is the x and 6 is the y and then we will switch y's with 11, and make a line, correct?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leafers ultimate style avatar for user Christelle Winter
      No, inside the parenthesis, the left hand side is the y and the right hand side is the x.
      When x is between (and including) 6 and 11, y is always equal to -7.
      You can imagine that someone has collected data of temperature in one location every day for a month. The data shows that between day 6 and day 11, the temperature was -7 every day.
      Hope that helps!
      (3 votes)
  • primosaur seedling style avatar for user Bharath
    Can there be a problem like:
    f(x)= 1 , 0<x≤2
    5 , 4≤x<6
    -7 , 6≤x≤11
    Where here there is no function defined for 3, if there is how do we find the domain?

    Thanks
    (2 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user alsoalis
    If the intervals for x were 0<x<2 and 4<x<6 (as integers) then would the domain be {1,6}?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      There are a couple of issues with your result:

      1) {1, 6} is roster notation for a set. It tells you the set includes 2 numbers, the 1 and the 6. Interval notation uses parentheses or square brackets.

      2) Interval notation assumes the interval is across all real numbers within the interval. It would not be limited to integers. And, your two inequalities have a gap. All the numbers from 2 up thru 4 are not included.

      The best way to write your domain would be to use set builder notation: {x | x ε Integers, 0<x<2 and 4<x<6}
      (3 votes)
  • blobby green style avatar for user Antonio Di Fenza
    I'm confused here: I remember learning that a function is such only insofar as there's one (and one) only output for a given input. Isn't this case different?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      No. Each input creates only one output, so it is a function. Notice the domain restrictions for each step happen to use the same numbers, but the end/start numbers are included in one step and excluded from the other step. Thus, there is no case where one input creates 2 outputs.

      Hope this helps.
      (3 votes)
  • mr pants teal style avatar for user Qasim Hashmi
    So would it be called a "piecewise function" or "piecewise defined function"
    (1 vote)
    Default Khan Academy avatar avatar for user
  • leafers ultimate style avatar for user N.
    If I have an equation for an output value of f(x), like x-2, how would I write the range for that? Is it just all real numbers?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • mr pants teal style avatar for user Anu
      Unless a definite domain is defined, we assume, all those numbers for which the function is defined as domain. In this case, yes, for all values of x, x-2 can be defined. So yes, the domain is real numbers.

      If the function is x^1/2, then the domain can only be positive real numbers, as negative numbers have no roots.

      Hope this helps!
      (1 vote)
  • duskpin ultimate style avatar for user Lauren Kenison
    How would you write the domain and range in interval notation?
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

I have a piecewise defined function here, and my goal is to figure out its domain and its range. So first let's think about the domain. And just a bit overview, the domain is the set of all inputs for which our function is defined. And over here, an input variable is x, so to think about, it's the set of all the values that x can take on, and actually have this function be defined, and actually figure out what f of x is. And when we look at this, we see, okay, if 0 is less than x is less than or equal to 2. We're in this clause, it's x crosses 2 and it is greater than 2. We follow this clause As we approach 6 but right when we get to 6, we fall into this clause right over here, all the way up to and including 11. But if we get larger than 11, the function is no longer defined. I don't know which of these to use. And if we're 0 or less, the function is longer defined as well. So in order for this to be defined, x has to be greater than 0 or if we say 0 is less than x, and you see that part right over there. And x has to be less than or equal to 11. and x has to be less then or equal to 11. It's defined for everything in between. As we, as we see, once again, as we get to 2, we're here. As we cross 2, between 2 and 6, we're here, and at 6, from 6 to 11 we're over here. So we're defined for all real numbers in this interval. So our domain is -- actually let me write this all, all real values, are all real all real values. maybe -- Let me write that way. All real value such that, such that, 0 is less than x, is less than or equal to 11. So now think about the range. Let's think about the range of this piecewise defined function. And that's a set of all values that this function can actually take on. and this one is, is maybe deceptively simple because there're only three values that this function can take on. You can take on, f of x can be equal to 1. It can be equal to 5, or it could be equal to negative 7. So the range here, we could say that f of x needs to be a member of, this is just a fancy mathy symbol, just to say this is a member of the set 1, 5, negative 7. f of x is going to take, is going to take on one of these three values. Another way to say it is that f of x is going to be equal 1, 5 or negative 7. This is maybe a little less -- a little -- a less a less mathy way, a less precise way of saying the same thing. But one way or another, f of x can only take on one over these three values.