In real world situations it can be difficult to describe events with a single smooth function. We sometimes need to use piecewise functions to describe these situations. Piecewise functions are functions that are defined to be smooth functions for specific intervals of the independent variable, most commonly the x-variable.
So by now you've probably seen the graph of the ups of value of x at some point. It just looks like a v, okay and this is really your first introduction what is called a piecewise function. Okay because really what we're looking at are 2 line segments okay we know that the absolute value is the distance from x to 0 and distance is always positive so the absolute value of x in essence just makes everything positive. So if x is positive absolute value of x is just equal to x. If x is negative it's the opposite okay and so really what we can do is we can define this function as 2 separate pieces okay. What we can say is we can say f of x is equal to we can say x if x is greater than or equal to 0 or negative x if x is less than 0. Okay and so we could change the equal to on either one of these because they're equal at 0, but basically what we've done is divided the absolute value of x into 2 different regions. The line x if we're dealing with positive numbers which will give us this portion over here or negative x if x is less than 0 which will give us this segment over here. Okay really what we have is just some domain restrictions on our graph, we look at one graph if x is in it one region we look at another graph if x is in the other region. Okay, so piecewise functions can typically occur in as many regions as possible often times you don't really deal with anything more than 2 or 3 but in theory we could have a piecewise graph that has 20 different regions and it would still be acceptable. Okay so really all we do is we graph the function in the region that is respective region that is given.