This question is a little too broad, and it would be easier to discuss if the situation in which you need to write a piece-wise function was known: for example, if you are modeling a real-life process, or if you are given some points that belong to the function.

To...

## See

This Answer NowStart your **48-hour free trial** to unlock this answer and thousands more. Enjoy eNotes ad-free and cancel anytime.

Already a member? Log in here.

This question is a little too broad, and it would be easier to discuss if the situation in which you need to write a piece-wise function was known: for example, if you are modeling a real-life process, or if you are given some points that belong to the function.

To answer this question in general, let's define piecewise functions, starting with the definition of a function.

A function is a rule that puts into correspondence a value of dependent variable (*y*) to a value of independent variable (*x*). For each value of an independent variable, **there can be only one value** of dependent variable. In other words, for any value of *x,* there can be only one value of *y*. (It is possible, however, for a function to have several values of *x* corresponding to the same value of *y*, as in `y = x^2` .) The rule specifying a function can be expressed as a algebraic equation, table, graph, or verbal statement.

A piecewise function has a feature of this rule being *different *for different intervals of independent variable. For a function given algebraically, it looks like a different equation for different intervals of *x. *For example,

`{(y = x if x>=0),(y = -2 if x<0):}`

This can also be written as

`y = {(x if x>=0),(-2 if x<0):}` .

If there are more than two intervals, a piecewise function will look similar:

`y = {(1 if x>=2), (x-1 if 0 <x <2), (x if x<=0):}`

Note that when you are writing the piecewise function, you need to arrange the intervals in logical order (right to left, as above, or left to right). Also, special attention needs to be paid to the ends of the intervals: make sure that they do not overlap. For example, if *x* = 0 value is included in the bottom "piece," it cannot be included anywhere else. This means that to evaluate the function at *x* = 0, the bottom equation needs to be used: `y = x = 0` (not the middle one, which would give you `y = x - 1 = -1` ). Notice that the function could be discontinuous (have a break in the graph) at the end of an interval, as it is here at *x* = 0, or it might not be. For *x* = 2 in the example above, the top and middle branches have the same value *y = *1.

As a real-life example of a piecewise function, consider a salesman getting 5% commission when his sales exceed $50,000. Then, if *c* is commission amount, and *s* is sales, the commission would be a piecewise function expressed as

`c = {(0 if 0<=s <50000), (0.05*s if s>=50000):}` .

Here, the domain of the function is all non-negative *s* (as evident from the context), and it is broken up into two intervals of the sales being less than $50,000, and greater or equal to $50,000.