Writing Piecewise Functions | ALGEBRA / TRIG I | (2024)

Learning Outcomes

  • Define piecewise function
  • Evaluate a piecewise function
  • Write a piecewise function given an application

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

We use piecewise functions to describe situations where a rule or relationship changes as the input value crosses certain "boundaries." Piecewise function are useful in many real-world situations. For example, we often encounter situations in business where 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 where incomes up to

$10,000\$10,000$10,000

are taxed at

10%10\%10%

and any additional income is taxed at

20%20\%20%

. The tax on a total income, S, would be

0.10.10.1

S if

SS\leS

$10,000\$10,000$10,000

and

1000+0.2(S$10,000)1000 + 0.2 (S - \$10,000)1000+0.2(S$10,000)

if S >

$10,000\$10,000$10,000

.

Piecewise Function

A piecewise function is a function where 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 of these smaller domains. We notate this idea like this:

f(x)={formula1ifxisindomain1formula2ifxisindomain2formula3ifxisindomain3 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} f(x)=formula1ifxisindomain1formula2ifxisindomain2formula3ifxisindomain3

In piecewise notation, the absolute value function is

x={xifx0xifx<0|x|=\begin{cases}x\text{ if }x\ge 0\\ -x\text{ if }x<0\end{cases}x={xifx0xifx<0

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

Given the function

f(x)={7x+3ifx<07x+6ifx0f(x)=\begin{cases}7x+3\text{ if }x<0\\7x+6\text{ if }x\ge{0}\end{cases}f(x)={7x+3ifx<07x+6ifx0

, evaluate:

  1. f(1)f (-1)f(1)

  2. f(0)f (0)f(0)

  3. f(2)f (2)f(2)

Show Solution

In order to evaluate a function for a given

xxx

value, we first have to determine which domain that

xxx

values falls into. In this example, if the

xxx

value is less than zero then we will use the first formula. If the given

xxx

value is greater than or equal to zero, then we will use the second formula.

1.

f(x)f(x)f(x)

is defined as

7x+37x+37x+3

for

x=1because1<0x=-1\text{ because }-1<0x=1because1<0

.

Evaluate:

f(1)=7(1)+3=7+3=4f(-1)=7(-1)+3=-7+3=-4f(1)=7(1)+3=7+3=4

2.

f(x)f(x)f(x)

is defined as

7x+67x+67x+6

for

x=0because00x=0\text{ because }0\ge{0}x=0because00

.

Evaluate:

f(0)=7(0)+6=0+6=6f(0)=7(0)+6=0+6=6f(0)=7(0)+6=0+6=6

3.

f(x)f(x)f(x)

is defined as

7x+67x+67x+6

for

x=2because20x=2\text{ because }2\ge{0}x=2because20

.

Evaluate:

f(2)=7(2)+6=14+6=20f(2)=7(2)+6=14+6=20f(2)=7(2)+6=14+6=20

In the following video, we show how to evaluate several values given a piecewise-defined function.

In the next example, we show how to evaluate a function that models the cost of data transfer for a phone company.

Example

A cell phone company uses the function below to determine the cost,

CCC

, in dollars for

ggg

gigabytes of data transfer.

C(g)={25if0<g<210g+5ifg2C\left(g\right)=\begin{cases}{25}\text{ if }{ 0 }<{ g }<{ 2 }\\ 10g+5\text{ if }{ g}\ge{ 2 }\end{cases}C(g)={25if0<g<210g+5ifg2

Find the cost of using

1.51.51.5

gigabytes of data and the cost of using

444

gigabytes of data.

Show Solution

To find the cost of using

1.51.51.5

gigabytes of data, C

(1.5)(1.5)(1.5)

, we first look to see which part of the domain our input falls. Because

1.51.51.5

is less than

222

, we use the first formula.

C(1.5)=$25C(1.5) = \$25C(1.5)=$25

To find the cost of using

444

gigabytes of data, C

(4)(4)(4)

, we see that our input of

444

is greater than

222

, so we use the second formula.

C(4)=10(4)+5=$45C(4)=10(4)+5=\$45C(4)=10(4)+5=$45

The function from the previous example is represented inthe graph below. We can see where the function changes from a constant to a line with a positive slopeat

g=2g=2g=2

. We plot the graphs for the different formulas on a common set of axes, making sure each formula is applied on its proper domain.

Writing Piecewise Functions | ALGEBRA / TRIG I | (1)

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

A museum charges

$5\$5$5

per person for a guided tour for a group of

111

to

999

people or a fixed $50 fee for a group of

101010

or more people. Write a function relating the number of people,

nnn

, to the cost,

CCC

.

Show Solution

Two different formulas will be needed. For n-values under

101010

,

C=5nC=5nC=5n

. For values of n that are

101010

or greater,

C=50C=50C=50

.

C(n)={5nif0<n<1050ifn10C(n)=\begin{cases}{5n}\text{ if }{0}<{n}<{10}\\ 50\text{ if }{n}\ge 10\end{cases}C(n)={5nif0<n<1050ifn10

A graph of the function for the previous example is shown below. The graph is a diagonal line from

n=0n=0n=0

to

n=10n=10n=10

and a constant after that. In this example, the two formulas agree at the meeting point where

n=10n=10n=10

, but not all piecewise functions have this property.

Writing Piecewise Functions | ALGEBRA / TRIG I | (2)In the following video, we show an example of how to write a piecewise-defined function given a scenario.

How To: Given a piecewise function, write the formula and identify the domain for each interval

  1. Identify the intervals where different rules apply.
  2. Determine formulas for the rules that describe how to calculate an output from an input in each interval.
  3. Use a bracket and "if" statements to write the function.

Summary

  • A piecewise function is a function where 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.

Contribute!

Did you have an idea for improving this content? We’d love your input.

Licenses and Attributions

CC licensed content, Shared previously

  • Ex: Determine Function Values for a Piecewise Defined Function. Authored by: James Sousa (Mathispower4u.com) . License: CC BY: Attribution

CC licensed content, Specific attribution

Writing Piecewise Functions | ALGEBRA / TRIG I | (2024)

References

Top Articles
Latest Posts
Article information

Author: Barbera Armstrong

Last Updated:

Views: 5987

Rating: 4.9 / 5 (59 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.