Question about the exclusive or operator

501 Views Asked by At

Let $R_1$ be the “less than” relation on the set of real numbers and let $R_2$ be the “greater than” relation on the set of real numbers, that is, $R_1 = \{(x, y) | x < y\}$ and $R_2 = \{(x, y) | x > y\}$. What is $R_1 ⊕ R_2$?

Solution: $R_1 ⊕ R_2 = R_1 ∪ R_2 − R_1 ∩ R_2 = \{(x, y) | x = y\}$.

Why do we need to subtract $R_1 ∩ R_2$? Isn't intersection of $R_1$ and $R_2$ already empty? i.e. a number can't be both less than or greater than $y$.

2

There are 2 best solutions below

0
On

You have a most unfortunate typo. Your alleged solution $$ R_1 ⊕ R_2 = R_1 ∪ R_2 − R_1 ∩ R_2 = \{(x, y) \mid x = y\} $$ should, instead, read $$ R_1 ⊕ R_2 = R_1 ∪ R_2 − R_1 ∩ R_2 = \{(x, y) \mid x \neq y\}. $$ The reason is fairly simple: $(x,y)\in R_1\cup R_2$ iff $(x,y)\in R_1$ or $(x,y)\in R_2$; thus, $(x,y)\in R_1\cup R_2$ iff $x<y$ or $x>y$. Note that the condition $x<y$ or $x>y$ is the same as the condition $x\neq y$. Hence, $R_1\cup R_2=\{(x,y)\mid x\neq y\}$. Now, you are certainly correct that $R_1\cap R_2=\emptyset$ (we cannot have both $x>y$ and $x<y$). Thus, we see that $$ R_1\cup R_2-R_1\cap R_2=R_1\cup R_2-\emptyset=R_1\cup R_2=\{(x,y)\mid x\neq y\}, $$ as indicated in the corrected version.

0
On

We're "subtracting" as part of the definition of $R_1 \oplus R_2$; the solution is showing how to find $R_1 \oplus R_2$ proceeding from the definition. In this case, $R_1 \cap R_2 = \emptyset$, but that's not true in general.

Also, your work is somewhat incorrect: $R_1 \cap R_2 = \{(x, y) \mid x = y\}$, so \begin{align*} R_1 \oplus R_2 &= R_1 \cup R_2 \setminus R_1 \cap R_2 \\ &= \{(x, y) \mid x \lt y \text{ or } x \gt y \} \setminus \{(x, y) \mid x = y\}\\ &= \{(x, y) \mid x \neq y \} \end{align*}

(Thanks to almagest for the correction)