Main content

## Piecewise functions

# Introduction to piecewise functions

CCSS.Math: ,

## Video transcript

- [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.