# Defining Absolute Function in Set Notation

I am trying to define the Absolute function in set notation. $$|x|= \begin{cases} x, \text{ if x \ge 0} \\ -x, \text{ if x < 0} \end{cases}$$

Here are my two attempts: $$f_1=\{(x,y)\in\mathbb{R \times R}: (x\ge0\implies y=x) \land (x<0\implies y=-x)\}$$ $$f_2=\{(x,y)\in\mathbb{R \times R}: (x\ge0\land y=x) \lor (x<0\land y=-x)\}$$

The first attempt is restating the definition but in set notation.

The set written should be ONLY one set. No unions are allowed.

Questions:

1) Which definition is correct(or both are wrong) ? Explain why.

2) Is there any mechanical way for writing functions in set notation given their cases ?

3) Assuming one of the above are correct how can I prove that it is a function ? If none are correct then provide correct one with explanation.

4) I am not sure but I think $f_1=f_2$. Is that right ?

• I would write $$\{(x,x)\mid x\in \mathbb R, x\ge 0\}\cup\{(-x,x)\mid x\in\mathbb R, x \ge 0 \}$$ – Henning Makholm Oct 31 '16 at 22:32
• @HenningMakholm I wrote it that way first. But I am trying to have it all in one set notation not two sets. – Nameless Oct 31 '16 at 22:34

One possibility could be $\;\{(x,y) \in \mathbb{R} \times \mathbb{R}^+ \mid x^2 = y^2\}\;$.