Back to homeMathematics · High School Year 1 · Change subject
Start for free
Prep 1 · Mathematics
Functions · Elementary functions

Piecewise-Defined Functions

Before you start, make sure you know: Linear functions (Secondary Year 3)
Before you start, make sure you know: Characteristics of a function (Secondary Year 3)

On a made-up water bill, the first $20\text{ m}^3$ cost $\$1$ each and, after that, each cubic meter costs $\$1.5$. Can the cost be written with a single formula? No: the rule changes at $20\text{ m}^3$. That is what piecewise-defined functions are for. By the end of the page you will solve this bill.

What a piecewise function is

Graph of a function with two pieces: a horizontal one with an open endpoint at x=0 and a slanted one that starts at the origin f(x) = 1 if x < 0 f(x) = x if 0 ≤ x ≤ 2

Each formula is only valid within its interval. A filled dot means the endpoint belongs to the piece; an open dot means it does not. In the figure, the first piece continues to the left without limit, so the domain is $(-\infty, 2]$ and the range is $[0, 2]$.

Practice★☆☆Not started
Look at the graph of the function $f(x)$ and determine its domain and its range.

Look at the graph of the function $f(x)$ and determine its domain and its range.

X Y 0 3 −3 3 −2 f(x)
Solve
Practice★☆☆Not started
Match the following description with the structure of a piecewise function: "An oven is turned on and its temperature rises at a constant rate for 10 minutes until it…

Match the following description with the structure of a piecewise function: "An oven is turned on and its temperature rises at a constant rate for 10 minutes until it reaches 200ºC. It is kept at that temperature for 40 minutes to bake a pizza, and finally it is turned off, with its temperature dropping to room temperature (20ºC) at a constant rate over 30 minutes."

Write the time intervals that would define the three sections of the temperature function $T(t)$.

Solve

Computing function values

To compute $f(a)$: first find which piece $a$ is in, and only then substitute into the formula for that piece.

Practice★☆☆Not started
Given the following piecewise function: $f(x) = \begin{cases} 2x+1 & \text{if } x < 0 \\ x^2-3 & \text{if } x \ge 0 \end{cases}$ Calculate the value of the function at…

Given the following piecewise function:

$f(x) = \begin{cases} 2x+1 & \text{if } x < 0 \\ x^2-3 & \text{if } x \ge 0 \end{cases}$

Calculate the value of the function at the points $x = -2$, $x = 0$ and $x = 3$.

Solve

Graphing and reading the graph

To graph, draw each piece only on its interval: make a table with a few points from each piece and mark the endpoints (filled if included, open if not). A constant piece is a horizontal line; a linear one, a segment or ray; a quadratic one, an arc of a parabola.

For the reverse direction (from the graph to the formula), identify each piece: if it is a line, find its slope $m$ and its y-intercept $b$ in $y=mx+b$; if it is a parabola, use its vertex. Then write the $x$-interval of each piece, taking care about which endpoints you include.

Practice★☆☆Not started
Plot the graph of the following piecewise function in your notebook: $f(x) = \begin{cases} -2 & \text{if } x \le 1 \\ 2x-4 & \text{if } x > 1 \end{cases}$ You can do it…

Plot the graph of the following piecewise function in your notebook:

$f(x) = \begin{cases} -2 & \text{if } x \le 1 \\ 2x-4 & \text{if } x > 1 \end{cases}$

You can do it on paper and send a photo with your answer.

Solve
Practice★☆☆Not started
From the graph of the function $g(x)$, determine its analytical expression knowing that it consists of two half-lines.

From the graph of the function $g(x)$, determine its analytical expression knowing that it consists of two half-lines.

X Y 0 2 4 g(x)
Solve
Practice★★☆Not started
From the graph of the function $h(x)$, which is made up of a parabolic arc and a half-line, find its analytical expression.

From the graph of the function $h(x)$, which is made up of a parabolic arc and a half-line, find its analytical expression.

X Y 0 2 −3 h(x)
Solve

Continuity at the break point

A function is continuous at a point if its graph can be drawn there without lifting your pencil. In a piecewise function, the suspicious place is the point $x=p$ where the formula changes.

Graph with a vertical jump at x=1: the first piece ends at a filled dot and the second starts at an open dot higher up jump at x = 1

When there is a jump, it is classified: if the two one-sided values exist and are different, it is a jump discontinuity; if they agree but $f(p)$ has a different value (or does not exist, an isolated open dot), it is a removable discontinuity.

Practice★☆☆Not started
Find the boundary point of the following function and determine whether it is continuous at that point:…

Find the boundary point of the following function and determine whether it is continuous at that point:

$f(x) = \begin{cases} 3x-2 & \text{if } x < 2 \\ 5-x & \text{if } x \ge 2 \end{cases}$

Solve
Practice★★☆Not started
Determine the value of the parameter $k$ so that the following piecewise function is continuous throughout its domain:…

Determine the value of the parameter $k$ so that the following piecewise function is continuous throughout its domain:

$f(x) = \begin{cases} x^2 - 1 & \text{if } x \le 2 \\ kx + 3 & \text{if } x > 2 \end{cases}$

Solve
Practice★★★Not started
Determine the values of the parameters $a$ and $b$ so that the function $f(x)$ is continuous at $x=1$ and passes through the point $(4, 9)$.…

Determine the values of the parameters $a$ and $b$ so that the function $f(x)$ is continuous at $x=1$ and passes through the point $(4, 9)$.

$f(x) = \begin{cases} ax^2 + b & \text{if } x < 1 \\ 3x - 2 & \text{if } 1 \le x \le 3 \\ ax - b & \text{if } x > 3 \end{cases}$

Once $a$ and $b$ are found, check mathematically whether the function is also continuous at $x=3$.

Solve

Absolute value as a piecewise function

With two absolute values, mark on the number line the points where each inside expression equals $0$: they divide the line into pieces. On each piece decide the sign of each bar.

Practice★☆☆Not started
Express the modulus function $f(x) = |3x - 6|$ as a piecewise function.

Express the modulus function $f(x) = |3x - 6|$ as a piecewise function.

Solve
Practice★★☆Not started
Express the function $f(x) = |x - 2| + 3x$ as a piecewise function without using modulus signs, and calculate the values of $f(0)$ and $f(5)$.

Express the function $f(x) = |x - 2| + 3x$ as a piecewise function without using modulus signs, and calculate the values of $f(0)$ and $f(5)$.

Solve
Practice★★★Not started
Express the function $f(x) = |x + 3| - |2x - 4|$ as a piecewise function, removing the modulus signs, and simplify the expression for each of the resulting sections.

Express the function $f(x) = |x + 3| - |2x - 4|$ as a piecewise function, removing the modulus signs, and simplify the expression for each of the resulting sections.

Solve

Modeling situations with pieces

Piecewise functions describe rates, cell phone plans, and motion that changes behavior. The method:

  1. Identify the thresholds (where the rule changes).

  2. Write a formula for each piece with its interval.

  3. Check whether the pieces join up or there is a jump at the thresholds.

Graph of the cost of a parking lot: a horizontal piece up to one hour and then an increasing line that continues with no jump 30 pesos 20t + 10 t (hours)

When the data give speed (like the speed of a train that accelerates), each piece is a line that passes through the endpoints of the piece. To accelerate from $0$ to $v_1$ in $T$ seconds, $v(t)=\dfrac{v_1}{T}\,t$.

Practice★☆☆Not started
A central parking lot charges a fee of $40$ pesos for the first hour of stay (or fraction thereof). After the first hour, it charges at a rate of $30$ pesos for each…

A central parking lot charges a fee of $40$ pesos for the first hour of stay (or fraction thereof). After the first hour, it charges at a rate of $30$ pesos for each additional hour, billing the extra time proportionally to the exact minutes of stay. Write the piecewise function $C(x)$ representing the total cost in terms of the hours $x$ that the car stays in the parking lot.

Solve
Practice★★☆Not started
A cell phone company offers a data plan that works as follows: a monthly fixed fee of $300$ pesos is paid, which includes the first $5$ GB of downloads. If that limit is…

A cell phone company offers a data plan that works as follows: a monthly fixed fee of $300$ pesos is paid, which includes the first $5$ GB of downloads. If that limit is exceeded, each additional gigabyte (or proportional fraction) is charged at $40$ pesos.

Write the function $C(x)$ representing the monthly cost in terms of the gigabytes $x$ consumed, and calculate how much a customer who consumed $3$ GB and another who consumed $8.5$ GB will pay.

Solve
Practice★★☆Not started
A commuter train starts from a station and accelerates at a constant rate until it reaches a speed of $20$ m/s in $10$ seconds. It maintains that cruising speed for $30$…

A commuter train starts from a station and accelerates at a constant rate until it reaches a speed of $20$ m/s in $10$ seconds. It maintains that cruising speed for $30$ seconds and, finally, brakes uniformly until coming to a complete stop at the next station in $5$ seconds. Write the piecewise function $v(t)$ describing the speed of the train in terms of the time elapsed since starting.

Solve

Rates and taxes with cumulative brackets

In many rate structures the new price applies only to the excess over the threshold, not to all of the usage. Each piece starts from the total accumulated in the previous one.

This type of function is continuous: each piece starts where the previous one ended, and the slope of each piece is the price per unit in that piece.

Practice★★☆Not started
An electricity bill for a home has a standing charge of $200$ pesos per month. In addition, the first $100$ kWh consumed are charged at $2.40$ pesos/kWh. If $100$ kWh is…

An electricity bill for a home has a standing charge of $200$ pesos per month. In addition, the first $100$ kWh consumed are charged at $2.40$ pesos/kWh. If $100$ kWh is exceeded, the excess consumption is charged at $3$ pesos/kWh. Write the function $F(x)$ giving the total bill amount in terms of the kWh $x$ consumed.

Solve
Practice★★☆Not started
In a fictional country, income tax is calculated as follows: for the first $200\,000$ pesos of income no tax is paid ($0$%). For the amount exceeding $200\,000$ pesos up…

In a fictional country, income tax is calculated as follows: for the first $200\,000$ pesos of income no tax is paid ($0$%). For the amount exceeding $200\,000$ pesos up to $400\,000$ pesos, $10$% is paid. For the amount exceeding $400\,000$ pesos, $20$% is paid.

Write the piecewise function $I(x)$ calculating the tax payable in terms of income $x$.

Solve
Practice★★★Not started
A water tank with a capacity of $6000$ liters is initially empty. A pump is turned on that pumps water at a constant rate of $50$ liters per minute. After $60$ minutes,…

A water tank with a capacity of $6000$ liters is initially empty. A pump is turned on that pumps water at a constant rate of $50$ liters per minute. After $60$ minutes, a second auxiliary pump is turned on, adding an additional flow rate of $30$ liters per minute. Write the piecewise function $V(t)$ representing the volume of water in the tank in terms of time, and calculate how long in total it will take to fill the tank completely.

Solve

Maxima, areas, and intersections

Maxima and minima. On a quadratic piece, the vertex only counts if its $x$ is inside the interval of the piece. Also check the joining points.

Areas. When the graph and the $x$-axis enclose a figure, split it by pieces: a constant piece gives a rectangle ($\text{base}\times\text{height}$) and a linear piece that starts at the axis gives a triangle ($\tfrac{1}{2}\,\text{base}\times\text{height}$).

Intersections. To intersect a piecewise function with another function, solve the equation piece by piece and keep only the solutions that fall within the interval of that piece.

Practice★★☆Not started
Given the piecewise function: $f(x) = \begin{cases} -x^2+4x & \text{if } x < 3 \\ x-2 & \text{if } x \ge 3 \end{cases}$ Plot its graph and determine its local maximums…

Given the piecewise function:

$f(x) = \begin{cases} -x^2+4x & \text{if } x < 3 \\ x-2 & \text{if } x \ge 3 \end{cases}$

Plot its graph and determine its local maximums and minimums, if any.

Solve
Practice★★★Not started
Given the piecewise function: $f(x) = \begin{cases} 2x & \text{if } 0 \le x \le 2 \\ k & \text{if } 2 < x \le 6 \end{cases}$ Calculate the value of the parameter $k$ so…

Given the piecewise function:

$f(x) = \begin{cases} 2x & \text{if } 0 \le x \le 2 \\ k & \text{if } 2 < x \le 6 \end{cases}$

Calculate the value of the parameter $k$ so that the total area of the geometric figure enclosed between the graph of the function and the x-axis ($X$-axis) is exactly $24$ square units.

Solve
Practice★★★Not started
Find analytically the points of intersection between the piecewise function $f(x) = \begin{cases} x^2 - 4 & \text{if } x < 0 \\ -2x + 4 & \text{if } x \ge 0 \end{cases}$…

Find analytically the points of intersection between the piecewise function $f(x) = \begin{cases} x^2 - 4 & \text{if } x < 0 \\ -2x + 4 & \text{if } x \ge 0 \end{cases}$ and the line $y = x + 2$.

Solve

Combined problems

The most complete problems mix everything: recognizing the pieces in a graph, writing the formula, checking continuity, and optimizing. Recommended order: (1) draw a sketch, (2) write each piece with its interval, (3) use continuity to find parameters, (4) answer what is asked (maximum, domain, range, type of discontinuity).

To read a graph and classify discontinuities: the domain is the $x$ values where there is a graph (check open and filled dots), the range is the $y$ values it reaches, and at each break point check whether there is a jump or a removable discontinuity.

Practice★★★Not started
A theater offers a ticket price of $200$ pesos if up to a maximum of $50$ people attend. To encourage attendance by large groups, for each person exceeding $50$, the…

A theater offers a ticket price of $200$ pesos if up to a maximum of $50$ people attend. To encourage attendance by large groups, for each person exceeding $50$, the ticket price for all attendees is reduced by $2$ pesos.

Write the total revenue function of the theater $I(x)$ in terms of the number of attendees $x$ (as a piecewise function) and determine how many people must attend for the theater to obtain the maximum possible revenue.

Solve
Practice★★★Not started
Look at the following graph of the function $p(x)$ and determine its complete analytical expression. From it, state its domain, its range and classify any…

Look at the following graph of the function $p(x)$ and determine its complete analytical expression. From it, state its domain, its range and classify any discontinuities it exhibits.

X Y 0 −3 3 4 p(x)
Solve
Practice★★★Not started
A test rocket takes off vertically. During the first $10$ seconds, its height in meters is modeled by the linear function $h(t) = 5t$. At $10$ seconds the engine turns…

A test rocket takes off vertically. During the first $10$ seconds, its height in meters is modeled by the linear function $h(t) = 5t$. At $10$ seconds the engine turns off and the rocket follows a parabolic free-fall trajectory $h(t) = at^2 + bt + c$, such that the transition is continuous. Knowing that the rocket impacts the ground at $50$ seconds, find the expression of the parabola and determine the maximum height reached by the rocket.

Solve

Summary

See all the exercises in this section