# XOR Equivalent for Sets

there is a particular set I would like to write but not sure about the correct notation.

Let $$T$$ be the set the satisfies the following:

$$T = \{ (x,y) \, | \, (x \in S \land y \notin S) \lor (x \notin S \land y \in S) \}$$

So for example, if $$S$$ is the set of positive even integers, then for example the pair $$(3,4) \in T$$, and so is $$(4,3) \in T$$, but not $$(10,20) \notin T$$ as well as $$(7,5) \notin T$$, i.e., exactly only one element in the pair is in $$S$$ and the other does not. I can't think of a neat notation to denote this.

In logic, there's the XOR but is there such a thing for sets?

• en.wikipedia.org/wiki/Symmetric_difference
– YSB
Oct 22, 2022 at 4:27
• @YSB it's not exactly what I'm looking for. Since I'm referring to the property of being an element, eg. $x \in S$. Oct 22, 2022 at 4:32
• If an element is not in $S$ then what is it in? There is no universal set. Your examples suggest the integers but you should say that. Oct 22, 2022 at 4:55
• Symmetric difference is the set theory version of XOR. That answers the title of the question. But the question itself is something different: a set of ordered pairs. That is not an "XOR equivalent". Oct 22, 2022 at 6:06

It’s $$(S\times \bar S) \cup (\bar S \times S)$$, where $$\bar S$$ is the complement of $$S$$.

As some have mentioned, your set is related to the symmetric difference, and you could also write it as $$(U \times S) \bigtriangleup (S \times U),$$ where $$\bigtriangleup$$ is the symmetric difference operator and $$U$$ is your "universal set".

Honestly, you’ve almost already written what you want:

$$T = \{ (x,y) \mid x \in S \text{ xor } y \in S\}$$

and you could pick one of the half-dozen symbols for ‘xor’ that are out there, though I couldn’t say which one is most commonly used. $$\oplus$$ is the one that looks the most familiar to me, though more in a computer context than a math context.

I would pick whichever notation best expressed your intentions. It might look more math-y to use the first version, but the set builder notation is also fine, and might make your intentions more immediately clear to your readers.

(If you're going to be doing this for a lot of different sets, and want a brief name, I'll just throw out that this seems like some sort of "anti-diagonal" to me. I don't think that's an existing term, but I kinda like it.)

• Ah I see, but isn't the $\times$ notation for cross product? Oct 22, 2022 at 4:35
• Yes. The cross product is a set of ordered pairs, and it looks you you want to form a set out of certain ordered pairs, no? Oct 22, 2022 at 4:37
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 16, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}