Some functions are defined in pieces by different formulas in different parts of the domain. We saw two of such functions in Example 1 of the previous section. We call such functions piecewise-defined functions.

Absolute Value Function

An important example of a piecewise defined function is the absolute value function f(x)=|x|, which can also be written as:

f(x)={xif x0xif x<0

The graph of this function is shown in Fig 1.

Figure1: Graph of  y=|x|

 

Sign Function

Another important piecewise defined function is the sign (or signum) function. The sign function, often denoted by sgn or sign, extracts the sign of a real number x (see Fig 2.)

sgn(x)={1if x>00if x=01if x<0

Figure 2: Graph of y=sgn(x).

 

Greatest Integer Function or Floor Function

A function that takes a real number x as input and returns the largest integer less than or equal to x is called the greatest integer function or the  floor function. It is denoted x. In fact, this function rounds down a real number to the nearest integer. For example

7=7,1.34=1,3.99=3, 7=7,1.34=2,3.99=4, 2=1,0.12=0

2=2,0.12=1

  • The greatest integer function is a function from R to Z (set of all integers)
    RZ
  • Using mathematical notations, we can write
    x=max{mZ| mx}.
  •  Other symbols for the greatest integer function are [x] and [[x]].
    Figure 3: Graph of y=x

    The graph of y=x is shown in Figure 3.
Example 1
A function f is defined by
f(x)={2x3if x>2x1if 1<x22x+1if x1 Evaluate f(2), f(0), f(1), and plot its graph.
Solution

Because 2(1,2], to evaluate f(2) we use the middle formula:
f(2)=x1|x=2=21=1. Also
0(1,2]f(0)=x1|x=0=01=1. To evaluate f(1), we note that 1(,1]. Therefore, we should use the bottom formula:

f(1)=2x+1|x=1=2×(1)+1=3. Fig 4 represents the graph of f.

Figure 3: Graph of y=f(x)={2x3if x>2x1if 1<x22x+1if x1.