# What is a piecewise function in set theory (or alternative ways to describe piecewise functions)?

I have searched, but I haven't found an answer to this question. How are piecewise functions defined in set theory? And what are alternative ways to represent them?

Let's say we have a piecewise function $f:\mathbb{R}_+ \to \mathbb{R}$, that is defined by the equation

$$f(x)= \begin{cases} x & x \in [0,3] \\ 3 & x \in (3,8] \\ x^2 & x \in (8,\infty) \end{cases}$$

The graph of this function is the set

$$\text{graph } f= \{ (x,y) \mid y=f(x), x \in \mathbb{R}_+ \},$$

but how can I write out this set "graph $f$" using information from the above equation? My quess would be something like this:

$$\{ (x,y) \mid (x\in[0,3] \rightarrow y=x) \text{ or } (x \in (3,8] \rightarrow y=3) \text{ or } (x \in (8,\infty) \rightarrow y=x^2) \}$$

Is there anything else to know about piecewise functions in set theory, other than the function's graph?

• Many authors distinguish between the two arrows $\to,\mapsto.$ The function $x\mapsto x^2$ is the function whose output is the square of its input. But $f:[0,\infty) \to \mathbb R$ is how the other arrow is used. The "guess" should use the arrow in $x\mapsto x^2,$ not the one in $f:[0,\infty) \to \mathbb R. \qquad$ – Michael Hardy Jul 21 '17 at 17:36
• I am not quite sure what you mean with this. Piecewise functions are not particularly special, and the 'general' definition of $\text{graph} f$ you used works just fine. If what you wanted to is write the graph as a union of smooth graphs, then I guess you're on the right track. The only problem here seems to be an incorrect use of the logical operator $\rightarrow$ ('implies'); it should most definitely be a $\land$ ('and') here. – Fimpellizieri Jul 21 '17 at 17:36
• Logically the arrows should be replaced by "and" or by "\land". – DanielWainfleet Jul 21 '17 at 17:49
• @MichaelHardy In those set definitions I use implication arrows on purpose. Using those "function definition" arrows would be clearly wrong. – ThatSteppe Dec 17 '17 at 20:39

## 2 Answers

As a practical notation I'll recommend MPW's suggestion. But note that your proposal $$\{ (x,y) \mid (x\in[0,3] \rightarrow y=x) \lor (x \in (3,8] \rightarrow y=3) \lor (x \in (8,\infty) \rightarrow y=x^2) \}$$ will not work -- that expression will in fact produce all of $\mathbb R\times\mathbb R$.

Namely, no matter what $x$ is, one of $x\in[0,3]$ and $x\in(3,8])$ will be false. And since an implication is always true when the antecedent is false, this means that at least one of the claims you're putting "or" between will be true no matter what $x$ and $y$ are.

If you want to write the set in this style it should be either $$\{ (x,y) \mid (x\in[0,3] \land y=x) \lor (x \in (3,8] \land y=3) \lor (x \in (8,\infty) \land y=x^2) \}$$ or $$\{ (x,y) \mid (x\in[0,3] \rightarrow y=x) \land (x \in (3,8] \rightarrow y=3) \land (x \in (8,\infty) \rightarrow y=x^2) \}$$

How about just $$\Gamma_f = \{ (x,x):0\leq x \leq 3\} \cup \{ (x,3): 3<x\leq 8\} \cup \{ (x,x^2):x>8\}$$