In mathematics, we often come across with the word ''function". A mathematical function is a type of relation which gives a definite value called output corresponding to a specified input value. A function does have only one single output for each input. Usually the notation f(x) is used to denote a function. There are different types of functions in mathematics. Piecewise function is one of them. We are going to learn piecewise function in this chapter.**A piecewise function is a function whose definition changes piecewise i.e. depending on different values of the independent variable. Say if y = f(x), here, y is the dependent variable and x is the independent variable.**

The piecewise function is called so because its graph represents different pieces in it. From the piecewise defined function, we can see that the function can be continuous or not continuous and the function may be differentiable or not differentiable at the junction of different subsets of the domain. This is because the function changes piecewise in the domain for different subsets of the domain. But in general, a piecewise function is a discrete function. Let us go ahead in this page below and learn more about piecewise functions and their properties.

Related Calculators | |

Calculator Functions | Calculate Exponential Function |

Calculate Inverse Function | calculating gamma function |

Imagine you are driving a car long distance on
various highways. Due to various reasons like speed restrictions,
traffic conditions etc. you will be driving at different speeds at
different intervals. In other words, the distances you cover at
different intervals of time. The distance is a function of time with the
speed as slope. Since the speed varies at different intervals of time,
the over all distance will consist of different distance-time functions
from one time interval to another. That is the over all distance will be
a piece wise function of time.

Similarly in algebra, some functions vary differently in different intervals of the variable and such functions are called piece wise function.

Consider a function ${f}(x)$ over a selected domain of $x_{n}$ divided into n intervals(need not be equal intervals).

If the type of function at any interval is different from that in the succeeding interval, then the over all function is defined as follows.

If the type of function at any interval is different from that in the succeeding interval, then the over all function is defined as follows.

${f}(x)$ = $f_{1}(x),\ when \ 0< x\leq x_{1}$

= $f_{2}(x),\ when \ x_{1}< x\leq x_{2}$

= $f_{3}(x),\ when \ x_{2}< x\leq x_{3}$

-------------------------------------------------------------

= $f_{n}(x),\ when \ x_(n-1)< x\leq x_{n}$

Here, the domain of the function is the set of all possible values of x and the range of the function is the values of y which we have to find by substituting the values of x in the given function.

Please note that we have arbitrarily selected the inequality symbol but in actual it may be different depending on the direction of the each function piece. However, the right side inequality symbol of any piece and the left side inequality symbol of the next piece must not be same.

For the graph of the piecewise function, we must specify each piece of the function and the values of x to use for that particular piece. For graphing the function, we can use the dotted line. As per the definition of the given function, we can draw the graph in the form of pieces and to understand the behavior of the end point. For this, first we have to mark the x-axis for x values or independent values and y-axis or dependent values. Make a table for the values of independent values and dependent values which represents domain and range respectively. Lastly, with the help of these values, draw the graph of the function.

$y = f(x) = \begin{Bmatrix}

1 &when x = 0 \\

x & when 0 < x and x < 1 \\

2 & when x = 1\\

x^{2} &when 1 < x and x < 2 \\

3 & when x = 2

\end{Bmatrix}$

The limiting value when x approaches to the left side of the 0, i.e. x $\rightarrow$ 0

$\lim_{x \rightarrow 0^{-}}f(x)$ = undefined and f(0) = 1.

The limiting value when x approaches to the right side of the 0, i.e. x $\rightarrow$ 0

$\lim_{x \rightarrow 0^{+}}f(x)$ = 0 and f(0) = 1.

The limiting value when x approaches to 0 from the either side

$\lim_{x \rightarrow 0}f(x)$ = undefined and f(0) = 1.

The limiting value when x approaches to 1 from the left side i.e. x $\rightarrow$ 1

$\lim_{x \rightarrow 1^{-}}f(x)$ = 1 and f(1) = 2.

The limiting value when x approaches to 1 from the right side i.e. x $\rightarrow$ 1

$\lim_{x \rightarrow 1^{+}}f(x)$ = 1 and f(1) = 2.

The limiting value when x approaches to 1 from the either side , then

$\lim_{x \rightarrow 1}f(x)$ = 1 and f(1) = 2.

In the above definition of a piece wise function if $f_{1}(x),f_{2}(x)...... f_{n}(x)$ are all linear functions then the over all function is called piecewise linear function. The real life example described in the beginning is a piecewise linear function.

In piecewise linear function, each function piece varies at a constant rate, that is with a constant slopes. The graph of a piecewise linear function, therefore, will have different line segments at different intervals.

We can write a piecewise function, if we know the graph of any piecewise function. So, with the help of the graph of any function, we can find the given equation or given definition of the function and able to write it in the form of pieces.

x+1 &if x < 1 \\

x-1 &if x \geq 1

\end{matrix}\right.$

Since there is an open circle at (1, 2), the function y = f(x) = x + 1 does not apply to x = 1. But, there is a solid circle at the point (1,0). So, the function y = f(x) = x - 1 does apply to x = 1.

While studying the continuity of the piecewise function, we have to know about the continuity of each piece of the function. For this, we can follow the below steps:

1) If g(x) is the function defined on some interval and f(x) is defined on it, then both the functions f(x) and g(x) follows some continuity properties except the end point on that interval.

2) The point at where the two pieces come together is called the end point. The function f(x) is continuous at that point if both the limits of the function agree and equals to the value of the function f at that point.

If we have an absolute function in terms of pieces or steps, then that type of function is called the absolute value piecewise function. The piecewise function is the set of instructions in which we define two or more than two values for specific intervals within the domain. If f(x) is an absolute value function, then we can write it as If(x)I. So, any function in this form of If(x)I is called the absolute function and if it can be expressed in terms of pieces, then it is called the absolute value piecewise function.To graph a linear piecewise function, make a table
of values for the given functions at the vertex points and plot those
points. Join all the points by line segments.

Let us consider the following example,

${s}(t)$ = $60t \ when \ 0< x\leq 1$

= $75t, \ when \ 1< t\leq 3$

= $80t, \ when \ 3< t\leq 4$

= $40t,\ when \ 4< t\leq 5$

The table is made as follows.

t |
s(t) |

0 |
0 |

1 | 60 |

3 | 210 |

4 | 290 |

5 | 330 |

The ordered pairs that are to be plotted in the graph are, (0, 0), (1, 60), (3, 210), (4, 290) and (5, 330).

The graph of this piecewise function is shown below.

Given below are some of the word problems on piecewise functions.

Monthly Customer Charge 7.00 dollars

Distribution Charge

1st 20 therms 0.301/ therm

Next 40 therms 0.121/ therms

Over 40 therms 0.027 / therms

Gas Supply Charge 0.82 / therms

- What is the charge for using 50 therms?
- What is the charge for using 100 therms?
- Construct a function that gives the monthly charge C for x therms of gas?
- After calculating all these things graph the function.

Given below are some of the examples on piecewise functions.

As we can see the domain of the function is $(- \infty , \infty)$ on the real axis. And, the subsets of the domain are shown above. By plotting the function, we can see the piecewise nature of the function in a better way.

Different region or the different definitions of the function are plotted in different colors. So, it is easy to notice the different subsets and different definitions of the function in the corresponding subset.

The red line plotted in the figure corresponds to the region x <= -3 f(x) = -x - 3

The orange corresponds to the region -3

The green corresponds to the region 0 <= x < 3 f(x) = -2x + 3

The blue corresponds to the region x >= 3 f(x) = x - 6

The nature of the piecewise function is discussed below.

Check the continuity of the functions at the points x = -3, 0, 3

f(x) at x = -3

f(x) = -x - 3 = -(-3) - 3 = 0

f(x) = x + 3 = -3 + 3 = 0

f(x) at x = 0

f(x) = x + 3 = 0 + 3 = 3

f(x) = -2x + 3 = 0 + 3 = 3

f(x) at x = 3

f(x) = -2x + 3 = -6 + 3 = -3

f(x) = x - 6 = 3 - 6 = -3

From the plot, we can see the function is continuous but the function is not differentiable. This is because, the function is not smooth at the points x = -3, 0, 3

Given below are some of the practice problems on piecewise function. This will help you to understand the concept of piecewise function and improve your practice over piecewise function.

$f(x) = {(\cos(x) \text{if} x<=0),(3x \text{if} x>0)}$

$f(x) = {(\cos(x) \text{if} x<= 0),(1 + x^2 \text{if} x>=0)}$

Related Topics | |

Math Help Online | Online Math Tutor |