Piecewise Functions

Piecewise functions describe our every day life and are everywhere. In this chapter I will explain them and show some examples.


Functions can model just about any kind of data. Real data can be problematic though. This brings us to a piecewise function in this chapter.

It is a function that has multiple parts that can't be represented by a single complete function. This means this type of function can be in several different pieces. The whole function itself is not linear but its separate pieces can be.

A function's input value its x-input. A piecewise function will behave differently depending on what that x-input is. 

\[ f(x) = \begin{cases} 1 & \text{if $|x| \leq 1$} \\ 0 & \text{if $|x| > 1$} \end{cases}\]

A piecewise function is discontinuous. It is not a continuous function. In other words, it will be defined differently for each interval.

To solve these functions:

  • See where the x-input is in the defined interval
  • Then evaluate x with the given function.


Greatest Integer Function

The greatest integer function is a type of piecewise function. 

\[ f(x) = [[x]] \]

\( [[x]] \) is the greatest integer less than or equal to x. It is a way of rounding to the kind of value that you want. It is rounding down, basically.

\[ [[5.5]] = 5 \]

\[ [[-3.5]] = -4 \]

See how that works? You are just rounding to the lower value that is an integer. That is the greatest integer function.

These functions are also divided into intervals. The intervals can be positive or negative. They are made up of real numbers, however. So no complex or imaginary numbers at this point. 

This is also a type of discontinuous function. A graph of this function can look like steps. That is always your clue that it is discontinuous, the points do not connect in a logical way. The steps can either go up or go down. 

Absolute Value Function

The absolute value function looks like a "v" shape on a graph. This makes it easy to identify. This function can also be defined as a piecewise function.

They are algebra expressions that contain absolute value symbols. These symbols look like \(f(x) = |x|\). The absolute value of this number will be its distance from 0 on the number line. 

Equations will look like \( y = |ax + b| \). The bars denote the function is absolute or always positive.

These equations are always even with or above the x-axis. The vertex of the graph is the x-intercept. You can find this by solving for \(ax + b\). 

Its domain is always real numbers but its range can be positive or negative. To shift this function vertically, the equation changes to look like \(f(x) = |x| + k\). This will make the vertex of the graph greater than zero. 

Absolute Value Inequalities 

Since these can be inequalities, the solution to an absolute value inequality will be an interval. This type of expression looks like \( |x| < 5 \). They are asking you to find all the x-values that are less than 5 units away from zero in either direction. 

So, \( -5 < x < 5 \) is what this expression is telling you. This is a good example of a less than inequality. 

There are also greater than inequalities. They are handled somewhat differently. In an inequality \( |x| > a \), you start by splitting this expression into two pieces. The pieces can be positive or negative, depending on the expression itself. 

You can also see a problem that includes a negative x-value. There is no solution to this type of problem because an absolute value can never be negative.