- Introduction to piecewise functions
- Worked example: evaluating piecewise functions
- Evaluate piecewise functions
- Evaluate step functions
- Worked example: graphing piecewise functions
- Piecewise functions graphs
- Worked example: domain & range of step function
- Worked example: domain & range of piecewise linear functions
- Absolute value & piecewise functions: FAQ
A piecewise function is a function built from pieces of different functions over different intervals. For example, we can make a piecewise function f(x) where f(x) = -9 when -9 < x ≤ -5, f(x) = 6 when -5 < x ≤ -1, and f(x) = -7 when -1
Want to join the conversation?
- Where in mathematics would you see piecewise functions?(56 votes)
- Where ever input thresholds (or boundaries) require significant changes in output modeling, you will find piece-wise functions.
In your day to day life, a piece wise function might be found at the local car wash: $5 for a compact, $7.50 for a midsize sedan, $10 for an SUV, $20 for a Hummer.
Or perhaps your local video store: rent a game, $5/per game, rent 2-3 games, $4/game, rent more than 5 games, $3/per game.
Ask your folks about tax brackets, another piece-wise function.
Hmmm, something more scientific? How about modeling the fuel usage of a space shuttle from launch to docking with the ISS. Each phase, launch, staging, orbit insertion, course correction and docking is a piece that has a very different characteristics of fuel consumption, and will require a different expression with different variables (air resistance, weight, gravity, burn rates etc.) at each stage in order to model it correctly.
So this piece wise stuff may seem arcane or just a very special (infrequent) case, but it is not, it is a fixture in the mathematical landscape, so enjoy the view!
Keep Studying!(213 votes)
- Edit: The Algebra I section has been expanded to include some modules that fill in these gaps nicely, and a few others.
Great job, Khan Academy! I am enjoying the new exercises, and I feel they really help fill in some small gaps that were there in the content. I believe those new modules added significant value to the lessons in that section of the KA content.
These are a couple of the new modules added to address this:
There were about 10 new modules added in the Algebra I "Functions" section, I believe. Very nice!
Kudos, and thanks!
(old question kept for historical purposes)
There is an exercise in the Algebra I content-- "Domain of a function" ( https://www.khanacademy.org/mission/algebra/task/6652614144688128 ).
One or more of the questions is all about the domain for a piecewise function. The Hint text says, "f(x) is a piecewise function, so we need to examine where each piece is undefined." (and goes on from there).
I have been looking and looking for Algebra I content that mentions piecewise functions, to make sure I learn it at the earliest point that I should have learned it. I have only been able to find it in the Algebra II lessons. It's interesting (and kind of cool) that this video just came out as I've been looking for it.
Is this the first time piecewise functions are explained in the Khan Academy lessons? If so, I think some of the problems in the set I linked, or at least the Hint text for them, might be out of place. If not, can anyone point me to a lesson where they are explained or at least mentioned earlier than the "Domain of a function" lesson in Algebra I? I can't find them mentioned on this playlist, for example: https://www.khanacademy.org/math/algebra/algebra-functions -- and definitely not anywhere earlier than the exercise I mentioned.
Algebra II is the first time piecewise functions are explained on KA. The playlist 'Domain and Range' (Which includes the exercise 'Domain of a Function') is on both Algebra I & II.
Clarissa :)(18 votes)
- Does the order in which you list the different pieces of the function matter? If so, would you go from least to greatest x-values or y-values?(11 votes)
- No, you can order the pieces as you like. But usually you will find the order from the least to the greatest x-values, so you can use it as instructions from the left of the right in die graph.(13 votes)
- Why did Sal put the y coordinates before the x coordinates in his function? Is this going to give a wrong coordinate in the final output?
EX— -9, -9 < x ≤ -5(11 votes)
- You could have done it in any order as only the end product counts because if you read it left to right it will say, draw a line at y=-9 with a domain of -9 to -5 only including -5.(4 votes)
- Wait! At1:35Sal defines the first function as (-9, -9<x≤-5]. Now from my understanding the input or domain is still the x variable and the output or y. Although this is arranged with the y variable first and then the x variable. Why not x,y? (-9<x≤-5,-9)?(8 votes)
- What he's saying is that the output is -9 when -9<x≤-5. Perhaps the inclusion of the word could have avoided confusion.(2 votes)
- I tried solving the exercise for piecewise functions. But the hints to the answers talk about the point being hollow and filled. I mean there is an exercise even before a video to explain the content. So is there is a video regarding this under another section?(5 votes)
- This video shows a bit how to use open and closed circles. https://www.khanacademy.org/math/algebra-basics/core-algebra-graphing-lines-slope/core-algebra-graphing-linear-inequalities/v/solving-and-graphing-linear-inequalities-in-two-variables-1
An open circle means "Does not include this value" (so like < & >). A closed circle means "Also includes this point" (like <= & >=). A good way to remember is that an open circle (○) is not colored in so the point it is on is NOT included. A closed circle (•) is colored in so it INCLUDES the point it is on. I hope this answers your question. Let me know if it doesn't.(8 votes)
- Can't you just do the vertical line test on two of those little parts, and prove that this is not a function?(4 votes)
- We can't use the vertical line test because there is more than one line. To use the vertical line test, the relation needs to be continuous(all the dots on a line are connected by one line). Since piecewise-functions are discontinuous, you can not use the vertical line test.
Hope this helps. :)(7 votes)
- why does sal put -9, 6 and -7 at the left of the equation. What does it represent and mean??(7 votes)
- what confuses me is the whole thing anyone care to slow it down for me thank you(6 votes)
- can the pieces ever be vertical?(1 vote)
- No... vertical lines are not functions. Since you are working with piecewise functions, all the pieces need to be functions.(10 votes)
- [Voiceover] By now we're used to seeing functions defined like h(y)=y^2 or f(x)= to the square root of x. But what we're now going to explore is functions that are defined piece by piece over different intervals and functions like this you'll sometimes view them as a piecewise, or these types of function definitions they might be called a piecewise function definition. Let's take a look at this graph right over here. This graph, you can see that the function is constant over this interval, 4x. And then it jumps up in this interval for x, and then it jumps back down for this interval for x. Let's think about how we would write this using our function notation. If we say that this right over here is the x-axis and this is the y=f(x) axis. Then, let's see, our function f(x) is going to be equal to, there's three different intervals. So let me give myself some space for the three different intervals. Now this first interval is from, not including -9, and I have this open circle here. Not a closed in circle. So not including -9 but x being greater than -9 and all the way up to and including -5. I could write that as -9 is less than x, less than or equal to -5. That's this interval, and what is the value of the function over this interval? Well we see, the value of the function is -9. It's a constant -9 over that interval. It's a little confusing because the value of the function is actually also the value of the lower bound on this interval right over here. It's very important to look at this says, -9 is less than x, not less than or equal. If it was less than or equal, then the function would have been defined at x equals -9, but it's not. We have an open circle right over there. But now let's look at the next interval. The next interval is from -5 is less than x, which is less than or equal to -1. Over that interval, the function is equal to, the function is a constant 6. It jumps up here. Sometimes people call this a step function, it steps up. It looks like stairs to some degree. Now it's very important here, that at x equals -5, for it to be defined only one place. Here it's defined by this part. It's only defined over here. So that's why it's important that this isn't a -5 is less than or equal to. Because then if you put -5 into the function, this thing would be filled in, and then the function would be defined both places and that's not cool for a function, it wouldn't be a function anymore. So it's very important that when you input - 5 in here, you know which of these intervals you are in. You can't be in two of these intervals. If you are in two of these intervals, the intervals should give you the same values so that the function maps, from one input to the same output. Now let's keep going. We have this last interval where we're going from -1 to 9. >From -1 to +9. And x starts off with -1 less than x, because you have an open circle right over here and that's good because X equals -1 is defined up here, all the way to x is less than or equal to 9. Over that interval, what is the value of our function? Well you see, the value of our function is a constant -7. A constant -7 and we're done. We have just constructed a piece by piece definition of this function. Actually, when you see this type of function notation, it becomes a lot clearer why function notation is useful even. Hopefully you enjoyed that. I always find these piecewise functions a lot of fun.