Courses
Courses for Kids
Free study material
Offline Centres
More
Store Icon
Store

Piecewise Functions Explained with Graphs and Applications

Reviewed by:
ffImage
hightlight icon
highlight icon
highlight icon
share icon
copy icon

What Is a Piecewise Function Definition Formula and How to Solve

A piecewise-defined function is one that is described not by a one (single) equation, but by two or more. Take into account the following function definition:

\[F(x) = \left\{\begin{matrix}-2x, -1 \leq x < 0\\X^{2}, 0 \leq x < 1 \end{matrix}\right.\]

Above mentioned piecewise equation is an example of an equation for piecewise function defined, which states that the function definition is different on different parts of its domain. For the piecewise-defined function above, the domain is [−1, 1][−1, 1], but the function definition on [−1, 0][−1, 0] is distinct from that of function definition on [0, 1][0, 1].


How to Find the Domain of a Piecewise Function

Let’s learn to find the domain and range of the piecewise function 

Consider the function: y = x² if x < 0, y = x + 2 if 0 ≤  x ≤ 3, y = 4 if x > 3?

Domain: (−∞, ∞)

Range: (0, ∞) 

Solution:

It is ideal to begin graphing piecewise functions by first thoroughly reading the "if" statements and you will then possibly shorten the chance of making an error by doing so.

Having said that, we have:

\[\left\{\begin{matrix} y = x^{2} \text{ if x < 0} \\ y = x + 2 \text{ if 0 }\leq x \leq 3 \\ y = 4 \text{ if x }> 3\end{matrix}\right.\]

It is quite crucial to consider the greater/less than or equal to signs because two points on the same domain will make it such that the graph is not a function. Nonetheless:

  • When No Restrictions in the ‘if’ Statements

y = x² is a simple parabola, and you probably know that it begins at the origin, (0, 0), and stretches out indefinitely in both directions. But, our limitation is all x-values less than (<) 0, thus we will only draw the left half of the graph, and leave an open circle at the point (0, 0), as the limitation is less than 0, and does not include 0.

Our next graph is a normal linear function moved upwards by two but only appears from 0 to 3 and includes both, so we will draw the graph from 0 to 3, with shaded circles on both 0 and 3.

The ultimate function is the simplest function, a constant function of y = 4, where there is only a horizontal line at the value of 4 on the y-axis, but only after 3 on the x-axis, because of our limitation.

Let's see how it would appear without the limitation:


(Image will be uploaded soon)

  • When Adding Restrictions in the ‘if’ Statements

Now, let’s find the domain and range of a piecewise function adding the restrictions in the ‘if’ statements:

Like we said earlier, the quadratic just looks like less than zero (<0), the linear only looks like from 0 to 3, and the constant only appears followed by 3, thus:

Domain: (−∞, ∞)

Range: (0, ∞)

Our domain is all real numbers because of our x-values being continuous along the x-axis, seeing that we have one shaded circle on the linear function at x = 0, and one shaded circle on the linear function at x = 3. The constant function continues endlessly to the right thus, despite the functions visually stopping, the graph still continues, therefore, all real numbers.

Our range begins at 0, but doesn't include it, and goes until infinity because of the graph not going below y = 0, and the lowest point being the quadratic not touching the x-axis at the origin, (0, 0), and stretches out endlessly upwards.


(Image will be uploaded soon)


Solved Examples

Solving piecewise functions requires plotting graphs. Let’s understand how to deal with a piecewise-defined function

Example:

Consider the function described as follows.

\[\left\{\begin{matrix} y = x + 2 \text{ if }x < 0 \\ 2 \text{ for }0 \leq x \leq 1 \\ -x + 3 \text{ for }x > 1\end{matrix}\right.\]


seo images


Solution:

In this example, the function is piecewise-linear, since each of the three parts of the graph is a line.

Piecewise-defined functions can also contain discontinuities ("jumps"). The function in the example below consist of discontinuities at x = −2x = −2 and x = 2.


Example:

Graph the function described as given below:

\[\left\{\begin{matrix} y = 1/2x^{2} \text{ if }x < -2 \\ 0 \text{ for }-2 \leq x < 2 \\ 1/2x^{2} \text{ for }x \leq 2\end{matrix}\right.\]


seo images


Note that we take the help of small white circles in the graph in order to indicate that the endpoint of a curve is not included in the graph, and solid dots to show endpoints that are included.


Example:

Graph the function defined below.

y = logx for  0<x<1

1/(x−2)     for  x≥1


seo images


Solution:

Negative values of x and 0 are excluded in the domain since the 1st function, logx, is not defined for those values. The value x=2 is not included in the domain seeing that the 2nd function is undefined for that value (it contains a vertical asymptote there). Thus, the domain of this function is {x | 0<x<2}∪{x | x>2}. This can be illustrated using interval notation as (0,2)∪(2,∞).

FAQs on Piecewise Functions Explained with Graphs and Applications

1. What is a piecewise function in math?

A piecewise function is a function that is defined by different formulas over different intervals of the domain. Instead of one single rule, it uses multiple rules depending on the value of x.

  • Each rule applies to a specific interval (for example, x < 0 or x ≥ 0).
  • Only one rule is used for any given value of x.
  • Piecewise functions are common in algebra, calculus, and real-life modeling problems.
They are sometimes called piecewise-defined functions because the definition changes in pieces.

2. How do you evaluate a piecewise function?

To evaluate a piecewise function, substitute the given x-value into the formula that matches its interval.

  • Step 1: Identify which interval the x-value belongs to.
  • Step 2: Use the formula assigned to that interval.
  • Step 3: Substitute and simplify.
For example, if f(x) = { x² for x < 2; 3x + 1 for x ≥ 2 }, then f(3) = 3(3) + 1 = 10 because 3 ≥ 2.

3. How do you graph a piecewise function?

To graph a piecewise function, graph each rule separately on its specified interval.

  • Step 1: Draw the graph of the first formula only on its interval.
  • Step 2: Repeat for each remaining formula.
  • Step 3: Use an open circle (○) if the endpoint is not included and a closed circle (●) if it is included.
This helps clearly show where the function changes rules.

4. What is the domain of a piecewise function?

The domain of a piecewise function is the set of all x-values for which at least one rule is defined.

  • Combine all intervals given in the definition.
  • Exclude any values that make a formula undefined (such as division by zero).
For example, if a function is defined for x < 0 and x ≥ 0, then the domain is (−∞, ∞).

5. What is the range of a piecewise function?

The range of a piecewise function is the set of all possible output (y) values produced by its rules.

  • Find the range of each piece on its interval.
  • Combine all resulting y-values.
For example, if f(x) = x² for x ≥ 0, then the range is [0, ∞) because squaring non-negative numbers gives non-negative results.

6. What is an example of a piecewise function?

An example of a piecewise-defined function is f(x) = { 2x + 1 for x < 1; x² for x ≥ 1 }.

  • For x = 0: f(0) = 2(0) + 1 = 1.
  • For x = 2: f(2) = 2² = 4.
This example shows how different formulas apply depending on the value of x.

7. What is the absolute value function as a piecewise function?

The absolute value function can be written as a piecewise function: |x| = { x for x ≥ 0; −x for x < 0 }.

  • If x is positive or zero, the output is x.
  • If x is negative, the output is its opposite.
This piecewise definition explains why absolute value always gives a non-negative result.

8. How do you know if a piecewise function is continuous?

A piecewise function is continuous at a boundary point if the left-hand limit, right-hand limit, and function value are equal at that point.

  • Step 1: Find the limit from the left.
  • Step 2: Find the limit from the right.
  • Step 3: Check if both equal f(c).
If all three are equal, the function is continuous at that point; otherwise, it has a discontinuity.

9. What is the difference between a piecewise function and a normal function?

The main difference is that a piecewise function uses multiple formulas over different intervals, while a normal function typically uses one formula for all x-values.

  • Normal function example: f(x) = x².
  • Piecewise example: f(x) = { x² for x < 0; x for x ≥ 0 }.
Both are valid functions as long as each input has exactly one output.

10. Where are piecewise functions used in real life?

Piecewise functions are used to model situations where rules change under different conditions.

  • Tax brackets: Different tax rates apply to different income ranges.
  • Shipping costs: Price changes based on weight intervals.
  • Electricity billing: Different rates for different usage levels.
They are important in algebra, calculus, economics, and real-world modeling because many systems operate under changing conditions.