Section 2.4: Library of Functions; Piecewise Functions

Learning Outcomes

  • Identify base functions
  • Graph piecewise-defined functions.

Identifying Base Functions

In this text we will be exploring functions—the shapes of their graphs, their unique characteristics, their algebraic formulas, and how to solve problems with them. When learning to read, we start with the alphabet. When learning to do arithmetic, we start with numbers. When working with functions, it is similarly helpful to have a library of building-block elements. We call these our “base functions,” which form a set of basic named functions for which we know the graph, formula, and special properties. Some of these functions are programmed to individual buttons on many calculators. For these definitions we will use [latex]x[/latex] as the input variable and [latex]y=f\left(x\right)[/latex] as the output variable.

We will see these base functions, combinations of base functions, their graphs, and their transformations frequently throughout this book. It will be very helpful if we can recognize these toolkit functions and their features quickly by name, formula, graph, and basic table properties. The graphs and sample table values are included with each function shown below.

Toolkit Functions
Name Function Graph
Constant [latex]f\left(x\right)=c[/latex], where [latex]c[/latex] is a constant
Graph of a constant function.
Identity [latex]f\left(x\right)=x[/latex]
Graph of a straight line.
Absolute value [latex]f\left(x\right)=|x|[/latex]
Graph of absolute function.
Quadratic [latex]f\left(x\right)={x}^{2}[/latex]
Graph of a parabola.
Cubic [latex]f\left(x\right)={x}^{3}[/latex]
Graph of f(x) = x^3.
Reciprocal [latex]f\left(x\right)=\frac{1}{x}[/latex]
Graph of f(x)=1/x.
Reciprocal squared [latex]f\left(x\right)=\frac{1}{{x}^{2}}[/latex]
Graph of f(x)=1/x^2.
Square root [latex]f\left(x\right)=\sqrt{x}[/latex]
Graph of f(x)=sqrt(x).
Cube root [latex]f\left(x\right)=\sqrt[3]{x}[/latex]
Graph of f(x)=x^(1/3).

Key Equations

Constant function [latex]f\left(x\right)=c[/latex], where [latex]c[/latex] is a constant
Identity function [latex]f\left(x\right)=x[/latex]
Absolute value function [latex]f\left(x\right)=|x|[/latex]
Quadratic function [latex]f\left(x\right)={x}^{2}[/latex]
Cubic function [latex]f\left(x\right)={x}^{3}[/latex]
Reciprocal function [latex]f\left(x\right)=\frac{1}{x}[/latex]
Reciprocal squared function [latex]f\left(x\right)=\frac{1}{{x}^{2}}[/latex]
Square root function [latex]f\left(x\right)=\sqrt{x}[/latex]
Cube root function [latex]f\left(x\right)=\sqrt[3]{x}[/latex]

Graphing Piecewise-Defined Functions

Sometimes, we come across a function that requires more than one formula in order to obtain the given output. For example, in the toolkit functions, we introduced the absolute value function [latex]f\left(x\right)=|x|[/latex]. With a domain of all real numbers and a range of values greater than or equal to 0, absolute value can be defined as the magnitude, or modulus, of a real number value regardless of sign. It is the distance from 0 on the number line. All of these definitions require the output to be greater than or equal to 0.

If we input 0, or a positive value, the output is the same as the input.

[latex]f\left(x\right)=x\text{ if }x\ge 0[/latex]

If we input a negative value, the output is the opposite of the input.

[latex]f\left(x\right)=-x\text{ if }x<0[/latex]

Because this requires two different processes or pieces, the absolute value function is an example of a piecewise function. 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 be 0.1S if [latex]{S}\le\[/latex] $10,000 and 1000 + 0.2 (S – $10,000), if S> $10,000.

A General Note: 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] 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]

In piecewise notation, the absolute value function is

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

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

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

Example 1: Writing a Piecewise Function

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].

Example 2: Working with a Piecewise Function

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}\begin{align}&{25} &&\hspace{-5mm}\text{ if }{ 0 }<{ g }<{ 2 }\\ &{ 25+10 }\left(g - 2\right) &&\hspace{-5mm}\text{ if }{ g}\ge{ 2 }\end{align}\end{cases}[/latex]

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

How To: Given a piecewise function, sketch a graph.

  1. Indicate on the x-axis the boundaries defined by the intervals on each piece of the domain.
  2. 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 3: Graphing a Piecewise Function

Sketch a graph of the function.

[latex]f\left(x\right)=\begin{cases}\begin{align}&{ x }^{2} &&\hspace{-5mm}\text{ if }{ x }\le{ 1 }\\ &{ 3 } &&\hspace{-5mm}\text{ if } { 1 }<{ x }\le 2\\ &{ x } &&\hspace{-5mm}\text{ if }{ x }>{ 2 }\end{align}\end{cases}[/latex]

Try It

Graph the following piecewise function.

[latex]f\left(x\right)=\begin{cases}{ x}^{3} \text{ if }{ x }<{-1 }\\ { -2 } \text{ if } { -1 }<{ x }<{ 4 }\\ \sqrt{x} \text{ if }{ x }>{ 4 }\end{cases}[/latex]

Try It

Q&A

Can more than one formula from a piecewise function be applied to a value in the domain?

No. Each value corresponds to one equation in a piecewise formula.

Key Concepts

    • A piecewise function is described by more than one formula.
    • A piecewise function can be graphed using each algebraic formula on its assigned subdomain.

Glossary

piecewise function
a function in which more than one formula is used to define the output

Section 2.4 Homework Exercises

1. How do you graph a piecewise function?

For the following exercises, sketch a graph of the piecewise function. Write the domain in interval notation.

2. [latex]f(x)=\begin{cases}{x}+{1}&\text{ if }&{ x }<{ -2 } \\{-2x - 3}&\text{ if }&{ x }\ge { -2 }\\ \end{cases} [/latex]

3. [latex]f\left(x\right)=\begin{cases}{2x - 1}&\text{ if }&{ x }<{ 1 }\\ {1+x }&\text{ if }&{ x }\ge{ 1 } \end{cases}[/latex]

4. [latex]f\left(x\right)=\begin{cases}{x+1}&\text{ if }&{ x }<{ 0 }\\ {x - 1 }&\text{ if }&{ x }>{ 0 }\end{cases}[/latex]

5. [latex]f\left(x\right)=\begin{cases}{3} &\text{ if }&{ x } <{ 0 }\\ \sqrt{x}&\text{ if }&{ x }\ge { 0 }\end{cases}[/latex]

6. [latex]f\left(x\right)=\begin{cases}{x}^{2}&\text{ if }&{ x } <{ 0 }\\ {1-x}&\text{ if }&{ x } >{ 0 }\end{cases}[/latex]

7. [latex]f\left(x\right)=\begin{cases}{x}^{2}&\text{ if }&{ x }<{ 0 }\\ {x+2 }&\text{ if }&{ x }\ge { 0 }\end{cases}[/latex]

8. [latex]f\left(x\right)=\begin{cases}x+1& \text{if}& x<1\\ {x}^{3}& \text{if}& x\ge 1\end{cases}[/latex]

9. [latex]f\left(x\right)=\begin{cases}|x|&\text{ if }&{ x }<{ 2 }\\ { 1 }&\text{ if }&{ x }\ge{ 2 }\end{cases}[/latex]

For the following exercises, given each function [latex]f[/latex], evaluate [latex]f\left(-3\right),f\left(-2\right),f\left(-1\right)[/latex], and [latex]f\left(0\right)[/latex].

10. [latex]f\left(x\right)=\begin{cases}{ x+1 }&\text{ if }&{ x }<{ -2 }\\ { -2x - 3 }&\text{ if }&{ x }\ge{ -2 }\end{cases}[/latex]

11. [latex]f\left(x\right)=\begin{cases}{ 1 }&\text{ if }&{ x }\le{ -3 }\\{ 0 }&\text{ if }&{ x }>{ -3 }\end{cases}[/latex]

12. [latex]f\left(x\right)=\begin{cases}{-2}{x}^{2}+{ 3 }&\text{ if }&{ x }\le { -1 }\\ { 5x } - { 7 } &\text{ if }&{ x } > { -1 }\end{cases}[/latex]

For the following exercises, given each function [latex]f[/latex], evaluate [latex]f\left(-1\right),f\left(0\right),f\left(2\right)[/latex], and [latex]f\left(4\right)[/latex].

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

14. [latex]f\left(x\right)=\begin{cases}{x}^{2}{ -2 }&\text{ if }&{ x }<{ 2 }\\{ 4+|x - 5|}&\text{ if }&{ x }\ge{ 2 }\end{cases}[/latex]

15. [latex]f\left(x\right)=\begin{cases}5x& \text{if}& x<0\\ 3& \text{if}& 0\le x\le 3\\ {x}^{2}& \text{if}& x>3\end{cases}[/latex]

For the following exercises, write the domain for the piecewise function in interval notation.

16. [latex]f\left(x\right)=\begin{cases}{x+1}&\text{ if }&{ x }<{ -2 }\\{ -2x - 3}&\text{ if }&{ x }\ge{ -2 }\end{cases}[/latex]

17. [latex]f\left(x\right)=\begin{cases}{x}^{2}{ -2 }&\text{ if}&{ x }<{ 1 }\\{-x}^{2}+{2}&\text{ if }&{ x }>{ 1 }\end{cases}[/latex]

18. [latex]f\left(x\right)=\begin{cases}{ 2x - 3 }&\text{ if }&{ x }<{ 0 }\\{ -3}{x}^{2}&\text{ if }&{ x }\ge{ 2 }\end{cases}[/latex]