Algebra
Textbooks
Boundless Algebra
Functions
Properties of Functions
Algebra Textbooks Boundless Algebra Functions Properties of Functions
Algebra Textbooks Boundless Algebra Functions
Algebra Textbooks Boundless Algebra
Algebra Textbooks
Algebra
Concept Version 11
Created by Boundless

Piecewise Functions

A piecewise function is defined by multiple subfunctions that are each applied to separate intervals of the input

Learning Objective

  • Graph a piecewise function and determine its domain and range


Key Points

    • Piecewise functions are defined using the common functional notation, where the body of the function is an array of functions and associated subdomains.
    • The absolute value, $\left | x \right |$ is a very common piecewise function.  For a real number, its value is $-x$ when $x<0$ and its value is $x$ when $x\geq0$.
    • Piecewise functions may have horizontal or vertical gaps (or both) in their functions. A horizontal gap means that the function is not defined for those inputs.
    • An open circle at the end of an interval means that the end point is not included in the interval, i.e. strictly less than or strictly greater than. A closed circle means the end point is included.

Terms

  • subdomain

    A domain that is part of a larger domain.

  • absolute value

    For a real number, its numerical value without regard to its sign; formally, $-1$ times the number if the number is negative, and the number unmodified if it is zero or positive.

  • piecewise function

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


Full Text

In mathematics, a piecewise function is a function in which more than one formula is used to define the output over different pieces of the domain.  Piecewise functions are defined using the common functional notation, where the body of the function is an array of functions and associated intervals.  We use piecewise functions to describe situations in which a rule or relationship changes as the input value crosses certain “boundaries.”

Graphing Piecewise Functions

Example 1: Consider the piecewise definition of the absolute value function:

$\displaystyle \left | x \right |= \left\{\begin{matrix} -x, & if\ x<0\\ x, & if\ x\geq0 \end{matrix}\right.$

For all $x$-values less than zero, the first function $(-x)$ is used, which negates the sign of the input value, making the output values positive. Allowing $y=f(x)$, where $f(x)=|x|$, some ordered pair examples of $(x,|x|)$ are: 

$\displaystyle (-2,2) \\ (-1,1) \\ (-0.5,0.5)$

For all values of $x$ greater than or equal to zero, the second function $(x)$ is used, making the output values equal to the input values.  Some ordered pair examples are:

$\displaystyle (2,2) \\ (1,1) \\ (0.5,0.5)$

After finding and plotting some ordered pairs for all parts ("pieces") of the function the result is the V-shaped curve of the absolute value function below.

Absolute Value Graph: Piecewise Function

The piecewise function, $\left | x \right |= \left\{\begin{matrix} -x, & if\ x<0\\ x, & if\ x\geq0 \end{matrix}\right.$, is  the graph of the absolute value function.  Each part of the function is graphed based upon the specific domain chosen.  

Example 2: Graph the function and determine its domain and range:

$\displaystyle f(x)= \left\{\begin{matrix} x^2, & if\ x \leq 1\\ 3, & if\ 1<x\leq 2\\ x, & if\ x>2\\ \end{matrix}\right.$

Start by choosing values for $x$ for the first piece of the function, such as: 

$\displaystyle x=-2,-1,0,1$

 Substitute those values into the first part of the piecewise function $f(x)=x^2$:

$\displaystyle f(-2)=4 \\ f(-1)=1 \\ f(0)=0 \\ f(1)=1 $

Those points satisfy the first part of the function and create the following ordered pairs: 

 $\displaystyle (-2,4)\\ (-1,1)\\ (0,0)\\ (1,1)$

For the middle part (piece), $f(x)=3$ (a constant function) for the domain $1<x\leq 2$, a few ordered pairs are: 

$\displaystyle (1.5,3)\\ (1.8, 3)\\ (2,3)$

For the last part (piece), $f(x)=x$ for the domain $x>2$, a few ordered pairs are:

$\displaystyle (2.5,2.5)\\ (3,3)\\ (4,4)$

Now graph all the ordered pairs:

Piecewise Function

The piecewise function $f(x)= \left\{\begin{matrix} x^2, & if\ x \leq 1\\ 3, & if\ 1<x\leq 2\\ x, & if\ x>2\\ \end{matrix}\right.$ has three parts (pieces).  Depending on the value of the domain, each piece is different.  

Notice the open and closed circles in the graph.  This has to do with the specific domains for each part of the function.  An open circle at the end of an interval means that the end point is not included in the interval, i.e. strictly less than or strictly greater than. A closed circle means the end point is included (equal to).

The domain of the function starts at negative infinity and continues through each piece, without any gaps, to positive infinity.  Since there is an closed AND open dot at $x=1$ the function is piecewise continuous there.  When $x=2$, the function is also piecewise continuous.  Therefore the domain of this function is the set of all real numbers, $\mathbb{R}$.

The range begins at the lowest $y$-value, $y=0$ and is continuous through positive infinity.  Even though there looks like a gap from $y=1$ to $y=2$, the piece of the function $f(x)=x^2$ includes those values.  Therefore the range of the piecewise function is also the set of all real numbers greater than or equal to $0$, or all non-negative values: $y \geq 0$. 

[ edit ]
Edit this content
Prev Concept
Relative Minima and Maxima
One-to-One Functions
Next Concept
Subjects
  • Accounting
  • Algebra
  • Art History
  • Biology
  • Business
  • Calculus
  • Chemistry
  • Communications
  • Economics
  • Finance
  • Management
  • Marketing
  • Microbiology
  • Physics
  • Physiology
  • Political Science
  • Psychology
  • Sociology
  • Statistics
  • U.S. History
  • World History
  • Writing

Except where noted, content and user contributions on this site are licensed under CC BY-SA 4.0 with attribution required.