### 5.3 Learning Objectives

- Introduction to piecewise functions
- Define piecewise function
- Evaluate a piecewise function
- Write a piecewise function given an application

- Graph Piecewise Functions
- Given a piecewise-defined function, sketch a graph
- Write the domain and range of a piecewise function given a graph

Marginal Tax Rate | Single Taxable Income | Married Filing Jointly or Qualified Widow(er) Taxable Income | Married Filing Separately Taxable Income | Head of Household Taxable Income |
---|---|---|---|---|

10% | $0 – $9,275 | $0 – $18,550 | $0 – $9,275 | $0 – $13,250 |

15% | $9,276 – $37,650 | $18,551 – $75,300 | $9,276 – $37,650 | $13,251 – $50,400 |

25% | $37,651 – $91,150 | $75,301 – $151,900 | $37,651 – $75,950 | $50,401 – $130,150 |

28% | $91,151 – $190,150 | $151,901 – $231,450 | $75,951 – $115,725 | $130,151 – $210,800 |

33% | $190,151 – $413,350 | $231,451 – $413,350 | $115,726 – $206,675 | $210,801 – $413,350 |

35% | $413,351 – $415,050 | $413,351 – $466,950 | $206,676 – $233,475 | $413,351 – $441,000 |

39.6% | $415,051+ | $466,951+ | $233,476+ | $441,001+ |

A **piecewise function** is a function in which more than one formula is used to define the output over different pieces of the domain.

We use piecewise functions to describe situations in which a rule or relationship changes as the input value crosses certain "boundaries." For example, we often encounter situations in business for which the cost per piece of a certain item is discounted once the number ordered exceeds a certain value. Tax brackets are another real-world example of piecewise functions. For example, consider a simple tax system in which incomes up to $10,000 are taxed at 10%, and any additional income is taxed at 20%. The tax on a total income, S, would be0.1S if [latex]S\le[/latex] $10,000and 1000 + 0.2 (S - $10,000),if S> $10,000.

### Piecewise Function

A piecewise function is a function in which more than one formula is used to define the output. Each formula has its own domain, and the domain of the function is the union of all these smaller domains. We notate this idea like this:

[latex-display] f\left(x\right)=\begin{cases}\text{formula 1 if x is in domain 1}\\ \text{formula 2 if x is in domain 2}\\ \text{formula 3 if x is in domain 3}\end{cases} [/latex-display]In piecewise notation, the absolute value function is

[latex]|x|=\begin{cases}x\text{ if }x\ge 0\\ -x\text{ if }x<0\end{cases}[/latex]

## 5.3.1 Evaluate a Piecewise Defined Function

In thefirst example, we will show how to evaluate a piecewise defined function. Note how it is important to pay attention to the domain to determine which expression to use to evaluate the input.### Example 5.3.A

Given the function

[latex]f(x)=\begin{cases}7x+3\text{ if }x<0\\7x+6\text{ if }x\ge{0}\end{cases}[/latex],

evaluate:

- [latex]f (-1)[/latex]
- [latex]f (0)[/latex]
- [latex]f (2)[/latex]

Answer:1.[latex]f(x)[/latex] is defined as [latex]7x+3[/latex] for [latex]x=-1\text{ becuase }-1<0[/latex].Evaluate: [latex]f(-1)=7(-1)+3=-7+3=-4[/latex]2. [latex]f(x)[/latex] is defined as [latex]7x+6[/latex] for [latex]x=0\text{ becuase }0\ge{0}[/latex].Evaluate: [latex]f(0)=7(0)+6=0+6=6[/latex]3.[latex]f(x)[/latex] is defined as [latex]7x+6[/latex] for [latex]x=2\text{ becuase }2\ge{0}[/latex].Evaluate: [latex]f(2)=7(2)+6=14+6=20[/latex]

### Example 5.3.B

A cell phone company uses the function below to determine the cost, [latex]C[/latex], in dollars for [latex]g[/latex] gigabytes of data transfer.

[latex]C\left(g\right)=\begin{cases}{25}\text{ if }{ 0 }<{ g }<{ 2 }\\ 10g+5\text{ if }{ g}\ge{ 2 }\end{cases}[/latex]

Find the cost of using 1.5 gigabytes of data and the cost of using 4 gigabytes of data.

Answer:

To find the cost of using 1.5 gigabytes of data, C(1.5), we first look to see which part of the domain our input falls in. Because 1.5 is less than 2, we use the first formula.

C(1.5) = $25

To find the cost of using 4 gigabytes of data, C(4), we see that our input of 4 is greater than 2, so we use the second formula.

[latex]C(4)=10(4)+5=45[/latex]

### Analysis of the Solution

The function is represented inthe graph below. We can see where the function changes from a constant to a line with a positive slopeat [latex]g=2[/latex]. We plot the graphs for the different formulas on a common set of axes, making sure each formula is applied on its proper domain. **C(g) =**[latex]C\left(g\right)=\begin{cases}{25}\text{ if }{ 0 }<{ g }<{ 2 }\\ 10g+5\text{ if }{ g}\ge{ 2 }\end{cases}[/latex]

## 5.3.2 Write a Piecewise Defined Function

In the lastexample we will show how to write a piecewise defined function that models the price of a guided museum tour.### Example 5.3.C

A museum charges $5 per person for a guided tour with a group of 1 to 9 people or a fixed $50 fee for a group of 10 or more people. Write a **function** relating the number of people, [latex]n[/latex], to the cost, [latex]C[/latex].

Answer:Two different formulas will be needed. For *n*-values under 10, C=5n. For values of n that are 10 or greater, C=50.C(n)=[latex]\begin{cases}{5n}\text{ if }{0}<{n}<{10}\\ 50\text{ if }{n}\ge 10\end{cases}[/latex]

## 5.3.3 Analysis of the Solution

The function is represented in Figure 21. The graph is a diagonal line from [latex]n=0[/latex] to [latex]n=10[/latex] and a constant after that. In this example, the two formulas agree at the meeting point where [latex]n=10[/latex], but not all piecewise functions have this property.In the following video we show an example of writing a piecewise defined function given a scenario.https://youtu.be/58mEZ4mEnUI### Given a piecewise function, write the formula and identify the domain for each interval.

- Identify the intervals for which different rules apply.
- Determine formulas that describe how to calculate an output from an input in each interval.
- Use braces and if-statements to write the function.

## 5.3.4 Graph Piecewise Functions

In this section, we will plot piecewise functions. The function plotted below represents the cost to transfer data for a given cell phone company.We can see where the function changes from a constant to a line with a positive slopeat [latex]g=2[/latex]. When we plot piecewise functions, it is important to make sure each formula is applied on its proper domain.[latex]C\left(g\right)=\begin{cases}{25} \text{ if }{ 0 }<{ g }<{ 2 }\\10g+5\text{ if }{ g}\ge{ 2 }\end{cases}[/latex]In this case, the output is 25 for any input between 0 and 2. For values equal to or greater than 2, the output is defined as [latex]10g+5[/latex].### Given a piecewise function, sketch a graph.

- Indicate on the
*x*-axis the boundaries defined by the intervals on each piece of the domain. - For each piece of the domain, graph on that interval using the corresponding equation pertaining to that piece. Do not graph two functions over one interval because it would violate the criteria of a function.

### Example 5.3.D

Sketch a graph of the function.Given the piecewise definition [latex]f(x)=\begin{cases}−x − 3\text{ if }x < −3\\ x + 3\text{ if } x \ge −3\end{cases}[/latex]Draw the graph of f.State the domain and range of the function.

Answer:First, graph the line [latex]f(x) = −x−3[/latex], erasing the part where x is greater than -3. Place an open circle at (-3,0).Now place the line [latex]f(x) = x+3[/latex] on the graph, starting at the point (-3,0). Note that for this portion of the graph, the point (-3,0) is included, so you can remove the open circle.The two graphs meet at the point (-3,0)The domain of this function is all real numbers because (-3,0)is not included as the endpoint of [latex]f(x) = −x−3[/latex], but it is included as the endpoint for[latex]f(x) = x+3[/latex].The range of this function starts at [latex]f(x)=0[/latex] and includes 0, and goes to infinity, so we would write this as [latex]x\ge0[/latex]

### Example 5.3.E

An on-line comic book retailer charges shipping costs according to the following formula[latex-display]S(n)=\begin{cases}1.5n+2.5\text{ if }1\le{n}\le14\\0\text{ if }n\ge15\end{cases}[/latex-display]Draw a graph of the cost function.

Answer:First, draw the line[latex]S(n)=1.5n+2.5[/latex]. We can use transformations: this is a vertical stretch of the identity by a factor of 1.5, and a vertical shift by 2.5.

S(n)=1.5n+2.5

Now we can eliminate the portions of the graph that are not in the domain based on [latex]1\le{n}\le14[/latex]

S(n) = 1.5n+2.5 for 1<=n<=14

Last, add the constant function S(n)=0 for inputs greater than or equal to 15. Place closed dots on the ends of the graph to indicate theinclusion of the end points.

## Summary

- A
**piecewise function**is a function in which more than one formula is used to define the output over different pieces of the domain. - Evaluating a piecewise function means you need to pay close attention to the correct expression used for the given input

## Licenses & Attributions

### CC licensed content, Original

- Revision and Adaptation.
**Provided by:**Lumen Learning**License:**CC BY: Attribution. - Determine a Basic Piecewise Defined Function.
**Authored by:**James Sousa (Mathispower4u.com) for Lumen Learning.**License:**CC BY: Attribution.

### CC licensed content, Shared previously

- Ex: Determine Function Values for a Piecewise Defined Function.
**Authored by:**James Sousa (Mathispower4u.com) .**License:**CC BY: Attribution. - College Algebra, Unit 1.4 Function Notation.
**Authored by:**Carl Stitz and Jeff Zeager.**Located at:**https://www.stitz-zeager.com/szca07042013.pdf.**License:**CC BY: Attribution. - Ex 2: Graph a Piecewise Defined Function.
**Authored by:**James Sousa (Mathispower4u.com) .**License:**CC BY: Attribution.

### CC licensed content, Specific attribution

- Precalculus.
**Provided by:**OpenStax**Authored by:**Jay Abramson, et al..**Located at:**https://openstax.org/books/precalculus/pages/1-introduction-to-functions.**License:**CC BY: Attribution.**License terms:**Download For Free at : http://cnx.org/contents/[emailprotected]..