"Piecewise" or "Case by case" Functions


All of the functions in the field guide can be added, multiplied, subtracted and divide (with reasonable precautions against dividing by zero). They can be composed (if domains and co-domains match up). They can also be combined to make functions whose formulas are different on different parts of the domain. These are called piecewise functions and are useful as examples as well as for representing behavior whose governing law switches at some point in the domain.

Standard Notation

The notation

{ f1(x) for x a
f(x) =
f2(x) for x > a
indicates a function whose value is f1(x) for x meeting the first condition (x a) and f2(x) for x meeting the second condition (x > a). The conditions should not overlap.

Often piecewise functions have three or more separate functions and conditions. To see check that we understand how the conditions work, let's look at the function

{ x2 for x < -1
f(x) = x for -1 x <1
cos(x) for x > 1


f(-2) = (-2)2 = 4 because -2 is in the interval where the f(x)=x2

f(.5) = .5 because .5 is in the interval where f(x)=x

f(12) = -cos(12) because 12 is in the interval where f(x) = cos(x)

f(-1) = -1 because -1 is contained in the interval where f(x)=x. It is necessary to pay close attention to the inequalities defining the interval in order to see what happens at points where the function definition switches. The function f(x) is graphed above and to the right.

Graphing Piecewise Functions

When graphing piecewise functions it is important to indicate what happens at the ends of the pieces. In the above example, the point (-1,1), which lies on the graph of y = x2, is NOT included in the graph of y = f(x). this is indicated on the graph by an empty circle. The point (-1,-1), on the other hand, IS included. This is indicated by a solid circle. An alternative method is to use square and round brackets as one would to indicate open and closed intervals. This is illustrated on the right.


Many hand-held graphing calculators have a method for graphing piecewise functions automatically. But calculators give no indication as to what happens at the end-points of the pieces. Even worse, if you graph in "connected" mode, your calculator will simply "connect the dots". You will not see discontinuities (i.e. breaks or jumps in the graph)! This can be fixed by graphing in "dot" mode.

Exercises Field Guide HUB CQ Directory CQ Resources