Piecewise Function

A piecewise function is a function with multiple pieces of curves in its graph. It means it has different definitions depending upon the value of the input. i.e., a piecewise function behaves differently for different inputs.

Let us learn more about piecewise function along with how to graph it, how to evaluate it, and how to find its domain and range.

1. What is Piecewise Function?
2. Piecewise Function Graph
3. Domain and Range of Piecewise Function
4. Evaluating Piecewise Function
5. Piecewise Continuous Function
6. FAQs on Piecewise Function

What is Piecewise Function?

A piecewise function is a function f(x) which has different definitions in different intervals of x. The graph of a piecewise function has different pieces corresponding to each of its definitions. The absolute value function is a very good example of a piecewise function. Let us see why is it called so. We know that an absolute value function is f(x) = |x| and it is defined as: \(f(x)=\left\
x, & \text < if >x \geq 0 \\
-x, & \text < if >x < 0
\end\right.\). We should read this piecewise function as

Then the graph of absolute value function of f(x) has two pieces one corresponds to x (when x is in the interval [0, ∞) ) and the other piece corresponds to -x (when x is in the interval (-∞, 0)). Its graph looks as follows:

piecewise function

Piecewise Function Graph

We already know that the graph of a piecewise function has multiple pieces where each piece corresponds to its definition over an interval. Here are the steps to graph a piecewise function.

Here is an example to understand these steps.

Example: Graph the piecewise defined function \(f(x)=\left\
-2^, & x -|x|, & -2 \leq x \leq 0 \\
2-x^, & x>0
\end\right.\).

Solution:

f(x) has 3 definitions:

Let us write the intervals and their corresponding definitions. Also, let us frame tables that include the endpoints of the intervals and also several other random numbers from each interval. We will calculate the value of y in each case using the corresponding definition.

piecewise function table

Now, let us plot all these points on the graph keeping in mind the general shapes of the respective functions. Note that we have to put open dots at (-2, -0.25) (first table) and (0, 2) (last table) as their corresponding x-coordinates are excluded from the interval. Also, extend the graph in the respective intervals beyond the points shown in the tables where required.

piecewise function graph

Note that the left most (light orange colored) curve is extended to the left side as it corresponds to the interval x < -2. Also, the right-most (blue-colored) curve is extended in the interval x >0. The middle (dark orange colored) curve is NOT extended on either side as it belongs to the interval -2 ≤ x ≤ 0.

Domain and Range of Piecewise Function

To find the domain of a piecewise function, we can just look at the given function's definition. Take the union of all intervals with x and that will give us the domain. In the above example, the domain of f(x) is, U U 0>. The union of all these sets is just the set of all real numbers. So the domain of f(x) (in the above example) is R.

To find the range of a piecewise function, the easiest way is to graph it and look at the y-axis. See what y-values are covered by the graph. In the above example, all y-values less than 2 (exclude 2 as there is an open dot at (0, 2)) are covered by the graph. So its range is (or) (-∞, 2).

Similarly, we can find the domain and range of any piecewise function just by graphing it.

Evaluating Piecewise Function

To evaluate a piecewise function at any given input,

Here is an example to understand the steps.

Example: Evaluate f(4) if \(f(x)=\left\ -x^2, \text < if >x, \text < if >x>0 \\ 5, \text < if >x=0\end\right.\).

Solution:

We have to find f(4). Here x = 4 and it satisfies the condition x > 0. So the corresponding function is f(x) = -2√x.

Substitute x = 4 in this definition:

f(4) = -2 √4 = -2 (2) = -4.

Therefore, f(4) = -4.

Piecewise Continuous Function

A piecewise continuous function, as its name suggests, is a piecewise function that is continuous, It means, its graph has different pieces in it but still we will be able to draw the graph without lifting the pencil. Here is an example of a piecewise continuous function.

Its graph is shown below.

piecewise continuous function

Important Notes on Piecewise Functions

☛ Related Topics:

Piecewise Function Examples

Example 1: Graph the piecewise function \(f(x)=\left\
-2 x, & -1 \leq x x^, & 0 \leq x \end\right.\). Solution: Let us make tables for each of the given intervals using their respective definitions of the function. piecewise function example and graphingLet us just plot them and join them by curves. We do not need to extend any of the curves here as none of the intervals have the limits as ∞ or -∞. Note that we have not an open dot at (0, 0) in the first table because its a closed point in the second table and both curves meet there. piecewise function graphingNote that there was supposed to be an open dot at (0, 0) from the first table. But it has become a part of the function from the second table and hence there shouldn't be open dot at (0, 0) and the function is continuous at (0, 0). Answer: The given function is graphed.

Example 2: Find the domain and range of the piecewise function that is given in Example 1. Solution: The given intervals are -1 ≤ x < 0 and 0 ≤ x < 2. So their union is -1 ≤ x < 2. This is the domain. The domain in interval notation is [-1, 2). For the range, look at the graph in Example 1 and see what y-values are being covered. All y-values less than 4 and greater than or equal to 0 are covered. Hence range is [0, 4) Answer: Domain is [-1, 2) and range is [0, 4).

View Answer >

Great learning in high school using simple cues

Indulging in rote learning, you are likely to forget concepts. With Cuemath, you will learn visually and be surprised by the outcomes.