Introduction to Piecewise Functions
Piecewise functions (or piecewise functions) are just what they are named: pieces of different functions (subfunctions) all on one graph. The easiest way to think of them is if you drew more than one function on a graph, and you just erased parts of the functions where they aren’t supposed to be (along the \(x\)’s). Thus, the \(y\)’s are defined differently, depending on the intervals where the \(x\)’s are.
Note that there is an example of a piecewise function’s inverse here in the Inverses of Functions section.
Here’s an example and graph:
Piecewise Function 
Graph 
\(\displaystyle f\left( x \right)=\left\{ \begin{align}2x+8\,\,\,\,\,&\text{ if }x\le 2\\{{x}^{2}}\,\,\,\,\,\,\,\text{ }\,&\text{ if }x>2\end{align} \right.\) (There are other ways to display this, such as using a “for” instead of an “if”, and using commas or semicolons instead of the “if”.) Domain: \(\mathbb{R},\,\,\,\text{or}\,\,\left( {\infty ,\infty } \right)\) Range: \(\mathbb{R},\,\,\,\text{or}\,\,\left( {\infty ,\infty } \right)\) 
What this means is for every \(x\) less than or equal to –2, we need to graph the line \(2x+8\), as if it were the only function on the graph. For every \(x\) value greater than –2, we need to graph \({{x}^{2}}\), as if it were the only function on the graph. Then we have to “get rid of” the parts that we don’t need. Remember that we still use the origin as the reference point for both graphs!
See how the vertical line \(x=2\) acts as a “boundary” line between the two graphs?
Note that the point \((–2,4)\) has a closed circle on it. Technically, it should only belong to the \(2x+8\) function, since that function has the less than or equal sign, but since the point is also on the \({{x}^{2}}\) graph, we can just use a closed circle as if it appears on both functions. See, not so bad, right?
Evaluating Piecewise Functions
Sometimes, you’ll be given piecewise functions and asked to evaluate them; in other words, find the \(y\) values when you are given an \(x\) value. Let’s do this for \(x=6\) and \(x=4\) (without using the graph). Here is the function again:
\(\displaystyle f\left( x \right)=\left\{ \begin{align}2x+8\,\,\,\,\,&\text{ if }x\le 2\\{{x}^{2}}\,\,\,\,\,\,\,\text{ }\,&\text{ if }x>2\end{align} \right.\)
We first want to look at the conditions at the right first, to see where our \(x\) is. When \(x=6\), we know that it’s less than –2, so we plug in our \(x\) to \(2x+8\) only. \(f(x)\) or \(y\) is \((2)(6)+8=4\). We don’t even care about the \(\boldsymbol{{x}^{2}}\)! It’s that easy. You can also see that we did this correctly by using the graph above.
Now try \(x=4\). We look at the right first, and see that our \(x\) is greater than –2, so we plug it in the \({{x}^{2}}\). (We can just ignore the \(2x+8\) this time.) \(f(x)\) or \(y\) is \({{4}^{2}}=16\).
Graphing Piecewise Functions
You’ll probably be asked to graph piecewise functions. Sometimes the graphs will contain functions that are noncontinuous or discontinuous, meaning that you have to pick up your pencil in the middle of the graph when you are drawing it (like a jump!). Continuous functions means that you never have to pick up your pencil if you were to draw them from left to right.
And remember that the graphs are true functions only if they pass the Vertical Line Test.
Let’s draw these piecewise functions and determine if they are continuous or noncontinuous. Note how we draw each function as if it were the only one, and then “erase” the parts that aren’t needed. We’ll also get the Domain and Range like we did here in the Algebraic Functions section.
Piecewise Function  Graph 
\(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}2x+8\,\,\,\,\,\,\text{if }x\le 4\\\frac{1}{2}x2\,\,\,\,\,\,\,\,\,\text{if }x>4\end{array} \right.\) Continuous Domain: \(\mathbb{R},\,\,\,\text{or}\,\,\left( {\infty ,\infty } \right)\) Range: \(\left( {0,\infty } \right)\) 

\(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}x+4\,\,\,\,\,\,\,\,\,\text{if }x<1\\2\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if 1}\le x<4\\x5\,\,\,\,\,\,\,\,\,\text{if }x\ge 4\end{array} \right.\) NonContinuous Domain: \(\mathbb{R},\,\,\,\text{or}\,\,\left( {\infty ,\infty } \right)\) Range: \(\mathbb{R},\,\,\,\text{or}\,\,\left( {\infty ,\infty } \right)\) 
We can actually put piecewise functions in the graphing calculator:
Piecewise Function Screens  Steps and Notes 
Enter the piecewise function on three lines:
Here’s the graph: 
To put the piecewise function \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}x+4\,\,\,\,\,\,\,\,\,\text{if }x<1\\2\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if 1 }\le x<4\\5+x\,\,\,\,\,\text{if }x\ge 4\end{array} \right.\) in the calculator, you can enter the function on three lines by dividing the function in each interval by a “test inequality” of that interval (and watch parentheses!).
The reason we divide by the intervals or inequalities is because the calculator will return a 1 if the inequality (such as \(x<1\)) is true; for example, \((x+4)\) will just end up \((x+4)/(1)\) when \(x<1\). When \(x\ge 1\), we are dividing by 0, so nothing will be drawn. Here is what we can put in the calculator: \(\displaystyle \begin{array}{l}{{Y}_{1}}=\left( {x+4} \right)/\left( {x<1} \right)\\{{Y}_{2}}=\left( 2 \right)/\left( {x\ge 1\text{ and }x<4} \right)\\{{Y}_{3}}=\left( {5+x} \right)/\left( {x\ge 4} \right)\end{array}\) Note that you can also enter this on one line by multiplying the conditions instead of dividing, and using plus signs between each of the three functions/intervals: \(\displaystyle {{Y}_{1}}=\left( {x+4} \right)\left( {x<1} \right)+\left( 2 \right)\left( {x\ge 1\text{ and }x<4} \right)+\left( {5+x} \right)\left( {x\ge 4} \right)\). Here are the keystrokes for using three lines. Note that you use 2nd MATH (TEST) to get to the screen that has the \(\le \), \(\ge \), and so on. For example, 2nd MATH 6 gets you \(\le \). Use 2nd MATH (TEST), right to LOGIC, then 1, for the “and” in \({{Y}_{2}}\). 
How to Tell if Piecewise Function is Continuous or NonContinuous
To tell if a piecewise graph is continuous or noncontinuous, you can look at the boundary points and see if the \(y\) point is the same at each of them. (If the \(y\)’s were different, there’d be a “jump” in the graph!)
Try this for the functions we used above:
Piecewise Function  Check Boundary Points 
\(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}2x+8\,\,\,\,\,\,\,\text{if }x\le 4\\\frac{1}{2}x2\,\,\,\,\,\,\,\,\,\,\text{if }x>4\end{array} \right.\)  Check \(x=4\) in both parts of the function, since 4 is the “boundary point”:
\(\begin{array}{l}2(4)+8=0\\\,\,\,\frac{1}{2}(4)2=0\end{array}\) Since \(0=0\), this piecewise function is continuous. 
\(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}x+4\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }x<1\\2\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if 1 }\le x<4\\5+x\,\,\,\,\,\,\,\,\,\text{if }x\ge 4\end{array} \right.\)  Check \(x=1\) in the first two parts of the function. Note in the second part, \(y\) is always 2:
\(\begin{array}{l}1+4=5\\\,\,\,\,\,\,\,\,\,2=2\end{array}\) Since \(5\ne 2\), we can stop here, and note that this piecewise function is noncontinuous. If the \(y\)’s were equal, we’d have to go one to check the next boundary point at \(x=4\). 
Obtaining Equations from Piecewise Function Graphs
You may be asked to write a piecewise function, given a graph. Now that we know what piecewise functions are all about, it’s not that bad! To review how to obtain equations from linear graphs, see Obtaining the Equations of a Line, and from quadratics, see Finding a Quadratic Equation from Points or a Graph.
Here are the graphs, with explanations on how to derive their piecewise equations:
Piecewise Function Graph  Procedure to get Function 
We see that our “boundary lines” are at \(x=2\) and \(x=1\). We know that our function will look something like this (notice open and closed endpoints):
\(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\text{ }……\,\,\,\,\,\,\,\,\text{if }x<2\\\text{ }……\,\,\,\,\,\,\,\,\text{if }\text{2 }\le x<1\\\text{ }……\,\,\,\,\,\,\,\,\text{if }x\ge 1\end{array} \right.\) Pick two points \((–2,0)\) and \((–3,2)\) on the leftmost line to get the equation \(y=2x4\). The middle function is \(y={{x}^{2}}2\), and the rightmost function is just the horizontal line \(y=2\). Thus, the piecewise function is: \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}2x4\,\,\,\,\,\,\,\text{if }x<2\\\text{ }{{x}^{2}}2\,\,\,\,\,\,\,\,\,\,\text{if }\text{2}\le x<1\\\text{ 2}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }x\ge 1\end{array} \right.\) 

We see that our “boundary line” is at \(x=5\). Since the lines meet at \((5,4)\), it doesn’t matter where we put the \(\le \) or \(\ge \) sign; we just can’t put it both places, or it wouldn’t be a function. We have so far:
\(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\text{ }……\,\,\,\,\,\,\,\,\,\text{if }x<5\\\text{ }……\,\,\,\,\,\,\,\,\,\text{if }x\ge 5\end{array} \right.\) Again, we have to look at each line separately to determine their equations. Either take 2 points from each line to get these, or derive from slopes and \(y\)–intercepts; the piecewise function is: \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\frac{6}{5}x2\,\,\,\,\,\,\,\text{if }x<5\\\frac{2}{5}x+2\,\,\,\,\,\,\,\text{if }x\ge 5\end{array} \right.\) 
Absolute Value as a Piecewise Function
You may be asked to write an absolute value function as a piecewise function. You might want to review Solving Absolute Value Equations and Inequalities before continuing on to this topic.
Let’s say we have the function \(f\left( x \right)=\left x \right\). From what we learned earlier, we know that when \(x\) is positive, since we’re taking the absolute value, it will still just be \(x\). But when \(x\) is negative, when we take the absolute value, we have to take the opposite (negate it), since the absolute value has to be positive. Make sense? So, for example, if we had \(5\), we just take what’s inside the absolute sign, since it’s positive. But for \(–5\), we have to take the opposite (negative) of what’s inside the absolute value to make it \(\displaystyle 5\,\,(–5=5)\).
This means we can write this absolute value function as a piecewise function. Notice that we can get the “turning point” or “boundary point” by setting whatever is inside the absolute value to 0. Then we’ll either use the original function, or negate the function, depending on the sign of the function (without the absolute value) in that interval.
For example, we can write \(\displaystyle \left x \right=\left\{ \begin{array}{l}x\,\,\,\,\,\,\,\,\,\text{if }x\ge 0\\x\,\,\,\,\,\text{if }x<0\end{array} \right.\). Also note that, if the function is continuous (there is no “jump”) at the boundary point, it doesn’t matter where we put the “less than or equal to” (or “greater than or equal to”) signs, as long as we don’t repeat them! We can’t repeat them because, theoretically, we can’t have two values of \(y\) for the same \(x\), or we wouldn’t have a function.
Here are more examples, with explanations. You can also check these in the graphing calculator using \({{Y}_{1}}=\) and MATH NUM 1 (abs). (You might want to review Quadratic Inequalities for the second example below):
Absolute Value Function  Method to get Piecewise Function 
\(g\left( x \right)=\left {2x+3} \right\)  First find the “boundary line”. We do this by setting what’s inside the absolute value to 0, and then solving for \(\boldsymbol{x}\).
When \(2x+3\ge 0\), we get \(\displaystyle x\ge \frac{3}{2}\) (actually, we can keep the \(\ge \) when we solve). When \(2x+3\) is positive (nonnegative, actually), we just take it “as is”, but if it’s negative, we have to negate the whole thing. Therefore, the piecewise function is: \(\displaystyle \left {2x+3} \right=\left\{ \begin{array}{l}2x+3\,\,\,\,\,\,\,\,\,\text{if }x\ge \frac{3}{2}\text{ }\\2x3\,\,\,\,\,\text{if }x<\frac{3}{2}\end{array} \right.\) Try it – it works! 
\(f\left( x \right)=\left {{{x}^{2}}4} \right\)  First find the “boundary line(s)”; we set what’s inside the absolute value to 0.
When \({{x}^{2}}4\ge 0\), we get \(x\le 2\) or \(x\ge 2\) (try some numbers!). When \({{x}^{2}}4\) is positive (nonnegative, actually), we just take it “as is”, but if it’s negative, we have to negate it. The piecewise function is: \(\displaystyle \left {{{x}^{2}}4} \right=\left\{ \begin{array}{l}{{x}^{2}}4\,\,\,\,\,\text{if }x\le 2\\4{{x}^{2}}\,\,\,\,\,\text{if }2<x<2\\{{x}^{2}}4\,\,\,\,\,\text{if }x\ge 2\text{ }\end{array} \right.\) or \(\displaystyle \left {{{x}^{2}}4} \right=\left\{ \begin{array}{l}{{x}^{2}}4\,\,\,\,\,\,\text{if }x\le 2\text{ }\,\,\text{or}\,\,\text{ }x\ge 2\\4{{x}^{2}}\,\,\,\,\,\,\,\text{if }2<x<2\end{array} \right.\) Again (since the function is continuous), it really doesn’t matter where we have the \(\le \) and \(\ge \) (as opposed to \(<\) and \(>\)), as long as we don’t repeat them. 
\(f\left( x \right)=2x+\left {x+2} \right\)  This one’s a little trickier, since we have an \(x\) inside and outside the absolute value. For the “boundary line”, we only use what is inside the absolute value.
When \(x+2\ge 0\), we get \(x\ge 2\). When \(x+2\) is positive (nonnegative, actually) (\(x\ge 2\)), we just take it “as is”, but if it’s negative, we have to negate it to make it \(x2\). For the piecewise function, we have to use the whole function, including the part that’s outside the absolute value. So, the piecewise function is: \(\displaystyle 2x+\left {x+2} \right=\left\{ \begin{array}{l}2x+x+2\,\,\,\,\,\text{if }x\ge 2\\2xx2\,\,\,\,\,\text{if }x<2\end{array} \right.\) Simplify: \(\displaystyle 2x+\left {x+2} \right=\left\{ \begin{array}{l}3x+2\,\,\,\,\,\,\,\text{if }x\ge 2\\x2\,\,\,\,\,\,\,\,\,\,\text{if }x<2\end{array} \right.\) Try some values less than and great then –2; they should work! 
\(g\left( x \right)=\left {{{x}^{2}}4x5} \right\)  This one is best solved with a sign chart since we have a quadratic and we need to know where the function is positive and negative.
First, factor the quadratic inside the absolute value function to \(\left( {x5} \right)\left( {x+1} \right)\). Then use a sign chart to see where the factors are positive and negative, and remember that where the factors are positive (nonnegative, actually), we use the function “as is”, and where the factors are negative, we negate the function: \(\displaystyle \left {{{x}^{2}}4x5} \right=\left\{ \begin{array}{l}{{x}^{2}}4x5\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }x\le 1\,\,\,\,\text{or}\,\,\,\,x\ge 5\\{{x}^{2}}+4x+5\,\,\,\,\,\,\,\,\,\text{if }1<x<5\text{ }\end{array} \right.\) 
\(\displaystyle g\left( x \right)=\frac{{\left {x+2} \right}}{{x+2}}\)  This is a rational function, since there’s a variable in the denominator.
When \(x+2\ge 0\), we get \(\displaystyle x\ge 2\). When \(x+2\) is positive (nonnegative, actually), we just take it “as is”, but if it’s negative, we have to negate what’s in the absolute value: \(\displaystyle \frac{{\left {x+2} \right}}{{x+2}}=\left\{ \begin{array}{l}\frac{{x+2}}{{x+2}}\,\,(=1)\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }x\ge 2\\\frac{{x2}}{{x+2}}\,\,(=1)\,\,\,\,\,\,\text{if }x<2\end{array} \right.\). But we have to be careful, since \(x\ne 2\) (domain restriction: the denominator would be 0). Therefore, the piecewise function is: \(\displaystyle \frac{{\left {x+2} \right}}{{x+2}}=\left\{ \begin{array}{l}1\,\,\,\,\,\,\,\,\,\,\text{if }x>2\\1\,\,\,\,\,\,\text{if }x<2\end{array} \right.\). 
You may also be asked to take an absolute value graph and write it as a piecewise function:
Absolute Value Graph  Method to get Piecewise Function 
We see that our “boundary line” is at \(x=0\), so what’s inside the absolute value sign must be \(x\) or a factor of \(x\). (This is because to get the boundary line with an absolute value function, we set what’s inside the absolute value to 0, and solve for \(x\)).
When \(x>0\), we can see that the equation of the line is \(y=2x2\). When \(x<0\), the equation is \(y=2x2\). We can write this as a piecewise function: \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}2x2\,\,\,\,\,\,\,\text{if }x>0\\2x2\,\,\,\text{if }x\le 0\end{array} \right.\) We can also write this as a transformed absolute value function: \(y=2\left x \right2\) or \(y=\left {2x} \right2\) (since 2 is positive, it can be inside or outside the \(\left {\,\,} \right\)). (This makes sense since when what’s inside the \(\left {\,\,} \right\) is \(> 0\), we use the regular function \(y=2x2\), and when what’s inside the is \(< 0\), we negate the absolute value part to make it \(y=\left( {2x} \right)2\)). 

We see that our “boundary lines” are at \(x=2\) and \(x=2\), so what’s inside the absolute value sign must have factors of \(x2\) and \(x+2\).
When \(x<2\) or \(x>2\), we can see that the graph looks like the normal part of the graph \(y={{x}^{2}}4\). (I figured this out by knowing the factors, and taking a good guess!) When \(2<x<2\), the equation \(y={{x}^{2}}4\) is flipped, or negated (flipped over the \(x\)axis). We can write this as a piecewise function: \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}{{x}^{2}}4\,\,\,\,\,\,\,\,\,\text{if }x<2\text{ or }x>2\\{{x}^{2}}\text{+ 4}\,\,\,\,\,\,\text{if }2\le x\le 2\end{array} \right.\) We can see that this started out a transformed quadratic function \(y={{x}^{2}}4\) with an absolute value around it, since all \(y\) values are positive: \(y=\left {{{x}^{2}}4} \right\). 

We see that our “boundary line” is at \(x=2\), so what’s inside the absolute value sign must be \(x+2\).
When \(x>2\), we can see that the equation of the line is \(y=x1\). When \(x<2\), the line is \(y=x+3\). We can write this as a piecewise function: \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}x1\,\,\,\,\,\,\text{if }x>2\\x+3\,\,\,\,\,\,\,\,\,\,\text{if }x\le 2\end{array} \right.\) It’s probably easier to write this as a transformed absolute value function. We can see that the parent absolute value function is flipped vertically, move to the left 2, and up 1. Our absolute value equation is \(y=\left {x+2} \right\,\,+\,\,1\). This is the same as the piecewise function above. Try it – it works! 
Transformations of Piecewise Functions
Let’s do a transformation of a piecewise function. We learned how about Parent Functions and their Transformations here in the Parent Graphs and Transformations section. You’ll probably want to read this section first, before trying a piecewise transformation. Let’s transform the following piecewise function flipped around the \(x\)axis, vertically stretched by a factor of 2 units, 1 unit to the right, and 3 units up.
So, let’s draw \(2f\left( x1 \right)+3\), where:
\(\displaystyle f\left( x \right)=\left\{ \begin{align}x+4\,\,\,\,\,\,\,\,&\text{ if }x<1\\2\,\,\,\,\,\,\,\,&\text{ if 1 }\le x<4\\x5\,\,\,\,\,\,\,\,&\text{ if }x\ge 4\end{align} \right.\)
Make sure to use the “boundary” points when we fill in the tchart for the transformation. Remember that the transformations inside the parentheses are done to the \(x\) (doing the opposite math), and outside are done to the \(y\). To come up with a tchart, as shown in the table below, we can use key points, including two points on each of the “boundary lines”.
Note that because this transformation is complicated, we can come up with a new piecewise function by transforming the three “pieces” and also transforming the “\(x\)”s where the boundary points are (adding 1, or going to the right 1), since we do the opposite math for the “\(x\)”s. To get the new functions in each interval, we can just substitute “\(x1\)” for “\(x\)” in the original equation, multiply by –2, and then add 3. For example, for the first part of the piecewise function, \(\displaystyle 2f\left( {x1} \right)+3=2\left[ {\left( {x1} \right)+4} \right]+3=2\left( {x+3} \right)+3=2x3\). So we have:
\(\displaystyle 2f\left( {x1} \right)+3=\left\{ \begin{array}{l}2\left( {\left( {x1} \right)+4} \right)+3=2x3,\,\,\,\,\text{ }\,\,\text{ if }x1<1\,\,\,\,\left( {x<2} \right)\\2\left( 2 \right)+3=1,\,\,\,\,\text{ }\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{ if }\,\text{ 2 }\le x<5\\2\left( {\left( {x1} \right)5} \right)+3=2x+15,\,\,\,\,\,\,\text{ if }x\ge 5\end{array} \right.\)
Here are the “before” and “after” graphs, including the tchart:
Piecewise Parent Function  Tchart  Transformation of Function 
\(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}x+4\,\,\,\,\,\,\,\,\text{if }x<1\\2\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if 1 }\le x<4\\x5\,\,\,\,\,\,\,\,\text{if }x\ge 4\end{array} \right.\) 
Transformation: Reflected across around the \(x\)axis, vertically stretched by a factor of 2 units, shifted 1 unit to the right, and 3 units up. 
\(\displaystyle 2f\left( {x1} \right)+3=\left\{ \begin{array}{l}2x3\,\,\,\,\,\,\,\,\,\text{if }x<2\\1\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if 2}\le x<5\\2x+15\,\,\,\,\,\,\text{if }x\ge 5\end{array} \right.\) 
Piecewise Function Word Problems
Problem:
Your favorite dog groomer charges according to your dog’s weight. If your dog is 15 pounds and under, the groomer charges $35. If your dog is between 15 and 40 pounds, she charges $40. If your dog is over 40 pounds, she charges $40, plus an additional $2 for each pound.
(a) Write a piecewise function that describes what your dog groomer charges. (b) Graph the function. (c) What would the groomer charge if your dog weighs 60 pounds?
Solution:
(a) We see that the “boundary points” are 15 and 40, since these are the weights where prices change. Since we have two boundary points, we’ll have three equations in our piecewise function. We have to start at 0, since dogs have to weigh over 0 pounds: \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\text{ }……\,\,\,\,\,\,\,\,\,\text{if }0<x\le 15\\\text{ }……\,\,\,\,\,\,\,\,\,\text{if }15<x\le 40\\\text{ }……\,\,\,\,\,\,\,\,\,\text{if }x>40\end{array} \right.\)
We are looking for the “answers” (how much the grooming costs) to the “questions” (how much the dog weighs) for the three ranges of prices. The first two are just flat fees ($35 and $40, respectively). The last equation is a little trickier; the groomer charges $40 plus $2 for each pound over 40. Let’s try real numbers: if your dog weighs 60 pounds, she will charge $40 plus $2 times \(20\,\,(60–40)\). We’ll turn this into an equation: \(40+2(x–40)\), which simplifies to \(2x–40\) (see how 2 is the slope?).
The whole piecewise function is: \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\text{ }35\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }0<x\le 15\\\text{ }40\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }15<x\le 40\\\text{ }40+2\left( {x40} \right)\,\,\,\,\,\,\text{if }x>40\end{array} \right.\) or \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\text{ }35\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }0<x\le 15\\\text{ }40\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }15<x\le 40\\\text{ }2x40\,\,\,\,\,\,\,\text{if }x>40\end{array} \right.\)
(b) Let’s graph:Note that this piecewise equation is noncontinuous. Also note a reasonable domain for this problem might be \(\left( {0,200} \right]\) (given dogs don’t weigh over 200 pounds!) and a reasonable range might be \(\left[ {35} \right]\cup \left[ {40,360} \right]\).
(c) If your dog weighs 60 pounds, we can either use the graph, or the function to see that you would have to pay $80.
Problem:
You plan to sell tshirts as a fundraiser. The wholesale tshirt company charges you $10 a shirt for the first 75 shirts. After the first 75 shirts you purchase up to 150 shirts, the company will lower its price to $7.50 per shirt. After you purchase 150 shirts, the price will decrease to $5 per shirt. Write a function that models this situation.
Solution:
We see that the “boundary points” are 75 and 150, since these are the number of tshirts bought where prices change. Since we have two boundary points, we’ll have three equations in our piecewise function. We’ll start with \(x\ge 1\), since, we assume at least one shirt is bought. Note in this problem, the number of tshirts bought (\(x\)), or the domain, must be a integer, but this restriction shouldn’t affect the outcome of the problem.
\(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\text{ }……\text{ if }1\le x\le 75\\\text{ }……\text{ if }75<x\le 150\\\text{ }……\text{ if }x>150\end{array} \right.\)
We are looking for the “answers” (total cost of tshirts) to the “questions” (how many are bought) for the three ranges of prices.
For up to and including 75 shirts, the price is $10, so the total price would \(10x\). For more than 75 shirts but up to 100 shirts, the cost is $7.50, but the first 75 tshirts will still cost $10 per shirt. The second function includes the $750 spent on the first 75 shirts (75 times $10), and also includes $7.50 times the number of shirts over 75, which would be \((x75)\). For example, if you bought 80 shirts, you’d have to spend \(\$10\times 75=\$750\), plus \(\$7.50\times 5\,\) (80 – 75) for the shirts after the 75th shirt.
Similarly, for over 150 shirts, we would still pay the $10 price up through 75 shirts, the $7.50 price for 76 to 150 shirts (75 more shirts), and then $5 per shirt for the number of shirts bought over 150. We’ll pay \(10(75)+7.50(75)+5(x150)\) for \(x\) shirts. Put in numbers and try it!
The whole piecewise function is: \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\text{ }10x\text{ }\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }1\le x\le 75\\\text{ 10}\left( {75} \right)+7.5\left( {x75} \right)\text{ }\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{ if 7}5<x\le 150\\\text{ 10}\left( {75} \right)+7.5\left( {75} \right)+5\left( {x150} \right)\text{ }\,\text{if }x>150\end{array} \right.\) or \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\text{ }10x\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }1\le x\le 75\\\text{ }7.5x\text{ }+\text{ }187.5\,\,\,\,\,\text{if 7}5<x\le 150\\\text{ }5x+562.5\,\,\,\,\,\,\,\,\,\,\,\text{if }x>150\end{array} \right.\)
Problem:
A bus service costs $50 for the first 400 miles, and each additional 300 miles (or a fraction thereof) adds $10 to the fare. Use a piecewise function to represent the bus fare in terms of the distance in miles.
Solution:
This is actually a tricky problem, but let’s first think first about the “boundary point”, which is 400. It’s pretty straightforward when the ride is less than 400 miles; the cost is $50.
For greater than 400 miles, we have to subtract out the first 400 miles (but remember to include the first $50), divide the number of miles left by 300 miles (and round up, if there’s a fractional amount), and multiply that by $10.
The tricky part is when we “round up” for a portion of the next 300 miles. We can use a “ceiling” function (designated by \(\left\lceil {} \right\rceil \)); this function gives the least integer that is greater than or equal to its input; for example, the ceiling of both 3.5 and 4 is 4.
Thus, this is what we have: \(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}\text{ }50\text{ }\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{if }0\le x\le 400\\\text{ }50+\left( {10\times \left\lceil {\frac{{x400}}{{300}}} \right\rceil } \right)\text{ }\,\,\,\,\,\text{ if }x>400\end{array} \right.\)
Let’s try it! If we have a 1500mile ride, the cost would be \(\displaystyle 50+\left( {10\times \left\lceil {\frac{{1500400}}{{300}}} \right\rceil } \right)\text{ }=50+\left( {10\times 4} \right)=\$90\).
Problem:
What value of \(\boldsymbol{a}\) would make this piecewise function continuous?
\(\displaystyle f\left( x \right)=\left\{ \begin{array}{l}3{{x}^{2}}+4\,\,\,\,\,\text{ if }x<2\\5x+\boldsymbol{a}\,\,\,\,\,\,\,\,\text{if }x\ge 2\end{array} \right.\)
Solution:
For the piecewise function to be continuous, at the boundary point (where the function changes), the two \(y\) values must be the same. We can plug in –2 for \(x\) in both of the functions and make sure the \(y\)’s are the same: \(\begin{align}3{{x}^{2}}+4&=5x+a\\3{{\left( {2} \right)}^{2}}+4&=5\left( {2} \right)+a\\12+4&=10+a\\a&=26\end{align}\)
If \(a=26\), the piecewise function is continuous!
Learn these rules, and practice, practice, practice!
More Practice: Use the Mathway widget below to try write a Piecewise Function. Click on Submit (the blue arrow to the right of the problem) and click on Write the Absolute Value as Piecewise to see the answer.
You can also type in your own problem, or click on the three dots in the upper right hand corner and click on “Examples” to drill down by topic.
If you click on Tap to view steps, or Click Here, you can register at Mathway for a free trial, and then upgrade to a paid subscription at any time (to get any type of math problem solved!).
On to Matrices and Solving Systems with Matrices – you are ready!