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.

## College Algebra

### Course: College Algebra>Unit 11

Lesson 2: Piecewise functions

# Introduction to piecewise functions

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?
• 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.
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!
• 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.

Thanks!
• Hey!
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 :)
• 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?
• 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.
• 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
• 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.
• Wait! At Sal 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)?
• What he's saying is that the output is -9 when -9<x≤-5. Perhaps the inclusion of the word could have avoided confusion.
• 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?
• Can't you just do the vertical line test on two of those little parts, and prove that this is not a function?
• 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. :)
• what confuses me is the whole thing anyone care to slow it down for me thank you