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 piecewise linear functions

Finding the domain and range of a piecewise function where each segment is linear.

Want to join the conversation?

  • piceratops seed style avatar for user K.Skepple
    Hi do real numbers include negatives? Because I can see you mentioned in the X can be any real number.
    (23 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user RandomDad
    What does such that mean in mathematics?
    (18 votes)
    Default Khan Academy avatar avatar for user
  • aqualine seed style avatar for user 000299
    what is domain in exact explanaition
    (12 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Stefen
      In its simplest form the domain is all the values that go into a function, and the range is all the values that come out. Sometimes the domain is restricted, depending on the nature of the function.
      f(x)=x+5 - - - here there is no restriction you can put in any value for x and a value will pop out
      f(x)=1/x - - - here the domain is restricted since x cannot be zero because 1/0 is undefined. So the domain here is all number except zero.
      f(x)=√(x-5) - - - We cannot take the square root of a negative number, so x must be greater than or equal to 5 since for x=5 and up x-5 is positive. In this case, the domain is all numbers greater than or equal to 5.

      More here:
      http://www.mathsisfun.com/sets/domain-range-codomain.html
      (16 votes)
  • mr pink red style avatar for user Bobby Smith
    In the domain and range definitions, how are skips in x written? For example, if x is more than -5 but less than 1, and more than 1 until 5. So 1 is skipped. I see how it is written in the function definition itself, but how is it written in the domain and range, which accounts for the entire span of possible outputs for all inputs? In the past two videos Sal has given examples where the functions are continuous, but not when there are skips. Even in this video where Sal combines the spans of three outputs, the spans overlap, and there is no skipping.

    Would this be written as follows: ...-5≤x≤5, x≠1...? -domain example
    Or something like this: All real values such that -5≤f(x)<1 or 1<f(x)≤5? -range example
    (11 votes)
    Default Khan Academy avatar avatar for user
    • mr pink red style avatar for user andrewp18
      That is a great question.
      Typically if the domain is something like all values between -5 and 5 inclusive excluding 1, we write:
      χ ε [-5. 5]/{1}
      Basically, we write x epsilon non strict lower bound -5 and non strict upper bound 5 and then a slash and 1 in curly brackets. Likewise, if we have the domain is all real numbers except 5 and 7, we can write:
      x ε R/{5, 7}
      (14 votes)
  • blobby green style avatar for user jpatel4567
    it is has hard to grasps concept of each video because there is seems to be that there is no objective is mention/discuss in each video except title but that is not enough and what is context or what we are doing?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Matteo Prendi
    Shouldn't all functions have a unique output? Then why is the function Sal took as an example still valid when both -3 <= x <= 1 AND 1 <= x <= 4 overlap with -3 < x < 4?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Andy Peter
      NO, a function does NOT have a unique output.

      A function have one and only one output for each input. There is nothing to do with uniqueness because it could have the same output for different inputs.

      Example: f(x) = |x|
      if we input f(5) = 5 and f(-5)= 5.
      you see here we have the same output for different inputs and that's okay.
      (6 votes)
  • blobby green style avatar for user tarikmoh8
    around why does Sal put -3 on the left side? Shouldn't he put it on the right
    (4 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user loumast17
      First you need to realize that < g(x) < is saying that the leftmost number needs to be less than the rightmost number.

      For this part we start with the function 1-x and the two endpoints are 3 and 4. If we solve 1-x for these two points we get -2 and -3 respectively. so even though to start 3 si less than 4, when we solve 3 gets us the larger result, at -2. Similarly 4 gets us the smaller result, at -3.

      So to keep it in order we need it to look like -3 < g(x) < -2 Does that make sense?

      the reason this happens is because in 1-x, we are subtracting x, so it does the reverse of the numbers being plugged in. 4 is greater than 3, but since you are subtracting you are subtracting more , making the result smaller. I also hope that makes sense. if not the main takeaway is to plug in each end point and see which is bigger and smaller.
      (5 votes)
  • leaf blue style avatar for user wooyoung jung
    What value should I choose if there isn't a greater then or equal to sign in the function definition?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • leaf blue style avatar for user Logeswaran SaCh
    I clearly understood 'Piecewise function', the only the only thing I'm stuck at is the application of this concept in real-life situation
    I meant where this concept is used in 'Daily Use'
    (2 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      Postage is often a good example. For a weight of 1-5 pounds, it costs one amount, then 5.1-10, a second amount, etc. Also, sometime when you are buying things in bulk, groups of amounts that you buy will cost the same and then goes down the more you buy (this is particularly true when a store buys things at wholesale costs).
      (4 votes)
  • male robot donald style avatar for user Joe Kownack
    Whats the point of watching this. There are no exercises after it.
    (4 votes)
    Default Khan Academy avatar avatar for user

Video transcript

So we have a piecewise linear function right over here for different intervals of x. g of x is defined by a a line or the line changes depending what interval of x we're actually in. And so let's think about its domain, and then we'll think about its range. So the domain of this, this is a review. The domain is the set of all inputs for which this function is defined, and our input variable here is x. This is a set of all x values for which this function is defined. And we see here. Anything, anything negative 6 or lower, our function isn't defined. If it, if x is negative 6 or or lower than that. I don't -- it doesn't, it doesn't fall into one of these three intervals. So there is no definition for it. It doesn't say hey do this in all other cases for x. It is just saying, look, if x falls into one of these three conditions, apply this. And if x doesn't fall into one of those three conditions, well this function g is just not defined. So, to fall into one of these three, you have to be at least greater than negative 6. So this part right over here, the low end of our domain is defined right over there, so we say, we could say, negative 6 is less than x and I'm leaving -- so let's write it here. All real numbers -- actually let me write this way x, I could write it more math-y. I could say x is a member of the real numbers such that, such that negative 6 is less than x. Negative 6 is less than x and I also think about the upper bound. So as x goes, I just wanna make sure that we fill in all the gaps between x being a greater than negative 6 and x is less than or equal to 6. So let's see. As we go up to and including negative 3, we're in this clause. As soon as we cross negative 3, we fall into this clause up to 4, but as soon as we get 4, we're in this clause up to and including 6. So x at the high end is said to be less than or equal to 6, less then or equal to 6. Now another way to say this and kind of less math-y notation is x, x can be any real number, any the real number such that, such that negative 6 is less than x is less than or equal to 6. These two statements are equivalent. So now let's think about the range of this function. Let's think about the range, and the range is, this is the set of all inputs , oh sorry, this is the set of all outputs that this function can take on, or all the values that this function can take on. And to do that, let's just think about as x goes, but x varies or x can be any values in this interval. What are the different values that g of x could take on? Let's think about that. g of x is going to be between what and what? g of x is going to be between what and what? g of x is going to be between what and what? And it might actually, this might be some equal signs there but I'm gonna worry about that in a second. So when does this thing hit its low point? o this thing hits, hits its low point when x is as small as possible. An x is going to be as small as possible when x is approaching negative 6. So if x were equal to negative 6, it can't equal negative 6 herer but if x is equal to negative 6, then this thing over here would be equal to negative 6 plus 7, would be, would be 1. So if x is greater than negative 6, g of x is going to be greater than 1, or another way to think about it is if negative 6 is less than x, then 1 is going to be less than g of x. And the reason I said that is if I put negative 6 into this, negative 6 plus 7 is equal to 1. Now this gonna hit a high end when it as large as possible. The largest value in this interval that we can take on is x being equal to negative 3. So when x is equal to negative 3, negative 3 plus 7 is equal to 4, positive 4. And it can actually take on that value because this is less than or equal to, so we can actually take on x equals negative 3 in which case g of x actually will take on positive 4. So, let' do that for each of these. Now here we have 1 minus x, so this is going to take on its smallest value when x is as large as possible. So the largest value x can approach for, it can't quite take on for, but it's going to approach for. So if x, let's see, if we said x was 4, although that's not this clause here, 1 minus x, 1 minus 4 is negative 3. So as long as x is less than 4, then negative 3 is going to be less than g of x. I wanna make sure that makes sense to you because it can be little bit confusing because this takes on its minimum value when x is approaching, or it's approaching its minimum value when x is approaching its, when x is approaching its maximum because we're subtracting it. So if you take the upper end, even though this doesn't actually include 4, but as we approach for, we could say, OK, 1 negative 4 is negative 3 so that's, so g of x is always going to be greater than that, as well it's going to be going to be a less than. Well what happens as we approach x being equal to negative 3? So, 1 minus negative 3 is going to be positive 4. So this is going to be positive 4 right over here. And these are both less than, not less than or equal to because these are both less than right over here. And now let's think about this right over here. So 2x minus 11 is gonna hit its maximum value when x is as large as possible. So its maximum value's going to be hit when x is equal to 6 So 2 times 6 is 12, minus 11. Well that's going to be 1. So its maximum value's going to be 1. It's actually going to be able to hit because x can be equal to 6. Its minimum value is going to be when x is equal to 4, and actually can be equal to 4. We have this less than or equal sign right over there. So 2 times 4 is 8, minus 11 is negative 3. So, g of x in this case can get as low as negative 3 when x is equal to 4. So now let's think about all of, all of the values that g of x can take on. So we could say, we could write this a bunch of ways, we could write g of x is going to be a member of the real numbers such that -- let's see. What's the lowest value g of x can take on? g of x can get as low as negative 3. It can even be equal to negative 3. This one just has been greater the negative 3, but here can be greater than or equal to negative 3. So negative 3 is less than or equal to g of x, and it can get as high as, it can get as high as Let's see. It's defined all the way to 1 and then -- or I shouldn't say it is defined all the way to 1. It can take on values up to 1 but it can also take on values beyond 1. It can take on values all the way up to including 4 over here. So it can take on values up to and including 4. So g of x is a member real numbers such that negative 3 is less than or equal to g of x is less than or equal to 4. So the set of all values that g of x can take on between, including and including negative 3 and positive 4.