Piecewise functions, like the name suggests, are functions that are made up of pieces of other functions called sub-functions.
For example, the absolute value function can be rewritten in the following piecewise notation:
$\left|x\right|$|x| |
$=$= |
$-x$−x | when $x<0$x<0 | |
$x$x | when $x>0$x>0 |
Defined this way, the absolute value function can be seen as the graph of two lines. The line on the left is the graph of $y=-x$y=−x. However, it is only defined for values of $x$x that are less than $0$0. The graph on the right is the graph of $y=x$y=x. However, it is only defined for values of $x$x that are larger than or equal to $0$0.
Graphing a piecewise function is the same as graphing multiple functions with restricted domains on the same graph. Let's consider the following example.
Graph the following function:
$f(x)$f(x) |
$=$= |
$x^2+2$x2+2 | when $x\le1$x≤1 | |
$3x$3x | when $x>1$x>1 |
Think: We can see that this function is composed of a quadratic function and a linear function. We can graph each function over the smaller domain and put them on the same graph.
Do: To begin we can graph the quadratic function, $y=x^2+2$y=x2+2
Using what we know about graphing quadratic functions, we have a vertex at $(0,2)$(0,2).As we are only graphing the parabola for $x\le1$x≤1 then we need to evaluate this endpoint.
$y=1^2+2=3$y=12+2=3
So our endpoint is $(1,3)$(1,3)
We might like at least another point on the curve, so let's use $(-2,6)$(−2,6)
So far we have this piece of the graph drawn.
Now we turn our attention to the second piece, $y=3x$y=3x
The line graph will begin at $x=1$x=1 so we can evaluate this endpoint and we obtain $(1,3)$(1,3). This means it will connect with the end point of the parabola.
We need two points to draw a straight line so let's use $(3,9)$(3,9).
Adding this to our graph we get the full picture of our hybrid function.
Let's have a look at a piecewise function and see if we can determine its equation from the graph.
Determine the equation of the hybrid function drawn below.
Think: We can see this time that the function is composed of three different functions pieced together. Working from left to right we can see a linear function (we'll call this $h(x)$h(x)), a constant function (call this $j(x)$j(x)) , and then a quadratic function (call this $k(x)$k(x)). Let's use the endpoints of each sub-function to find the subdomains. Then we can use the key characteristics to find the equations of each sub-function.
Do: Describe the intervals for which each sub-function is defined. If an endpoint is included with more than one function, we can choose which function to include it with, as long as we don't include it more than once.
$f(x)$f(x) | $=$= | $h(x)$h(x) | when $x<-1$x<−1 | |
$j(x)$j(x) | when $-1\le x<2$−1≤x<2 | |||
$k(x)$k(x) | when $x\ge2$x≥2 |
The function $h(x)$h(x) is a linear function with a slope of $1$1 and a $y$y-intercept (if the graph were to continue) at $\left(0,8\right)$(0,8). Therefore, $h(x)=x+8$h(x)=x+8.
The function $j(x)$j(x) is a constant function or a horizontal line always equal to $7$7. Therefore, $j(x)=7$j(x)=7.
The parabola $k(x)$k(x) connects on to $j(x)$j(x) with its vertex at the point $\left(2,7\right)$(2,7). Its vertex is a maximum point with a dilation factor of $1$1. Therefore, $k(x)=-(x-2)^2+7$k(x)=−(x−2)2+7.
Putting this all together we have:
$f(x)$f(x) | $=$= | $x+8$x+8 | when $x<-1$x<−1 | |
$7$7 | when $-1\le x<2$−1≤x<2 | |||
$-\left(x-2\right)^2+7$−(x−2)2+7 | when $x\ge2$x≥2 |
Consider the function:
$f\left(x\right)$f(x) | $=$= | $\frac{2}{3}x+4$23x+4, | $x<0$x<0 | |
$x+4$x+4, | $0\le x\le1$0≤x≤1 | |||
$-2x+7$−2x+7, | $x>1$x>1 |
Graph the function.
What is the domain of the function?
$\left(-\infty,0\right)$(−∞,0)$\cup$∪$\left(0,1\right)$(0,1)$\cup$∪$\left(1,\infty\right)$(1,∞)
$\left(5,\infty\right)$(5,∞)
$\left[1,\infty\right)$[1,∞)
$\left(-\infty,\infty\right)$(−∞,∞)
What is the range of the function?
$\left[0,\infty\right)$[0,∞)
$\left(-\infty,\infty\right)$(−∞,∞)
$\left(-\infty,5\right]$(−∞,5]
$\left[5,\infty\right)$[5,∞)
What is the function represented by the graph?
$y$y | $=$= | $\editable{}$, | $x$x$<$<$\editable{}$ | |||
$\editable{}$, | $x$x$\ge$≥$\editable{}$ |
If each piece of a piecewise function is a horizontal line segment, then we call it a step function (or sometimes a staircase function).
The greatest integer function is a special type of step function. The greatest integer function, denoted $f(x)=\lfloor x\rfloor$f(x)=⌊x⌋ returns the greatest integer less than or equal to a number $x$x. We can think of it like a function that rounds down a real number to the nearest integer.
For example, $\lfloor0\rfloor=0$⌊0⌋=0 , $\lfloor1.7\rfloor=1$⌊1.7⌋=1 , and $\lfloor\pi\rfloor=3$⌊π⌋=3. Just be sure to remember the ordering of negative numbers. For example, $\lfloor-2.4\rfloor=-3$⌊−2.4⌋=−3.
Notice that in the graph of the greatest integer function, the intervals are closed on the left-hand side and open on the right.
Just as we can perform transformations on other functions, we can perform transformations on the greatest integer function to obtain an entire family of functions.
The graph shows the amount (in dollars) an internet cafe charges its customers.
How much does Parvaneh have to pay if she uses their internet service for $2$2 hours and $40$40 minutes?
How much does Parvaneh have to pay if she uses their internet service for $4$4 hours?
What is the maximum number of hours that Parvaneh can use for $\$15$$15?
Graph the greatest integer function given by $f\left(x\right)$f(x)$=$=$\lfloor-x\rfloor$⌊−x⌋ for $-3\le x\le3$−3≤x≤3.
Graph the greatest integer function given by $f\left(x\right)$f(x)$=$= $\lfloor2x\rfloor$⌊2x⌋ for $-2\le x\le2$−2≤x≤2.