Read · 1 min

OR and XOR are two different operations, although they are similar in some ways. Here's how they work.

OR evaluates to True if one or more of the inputs are True, and False if they're all False.

\begin{matrix} & & A\
& & False & True\
B & False & 0 & 1\
& True & 1 & 1 \end{matrix}

XOR is the same as OR, but it evaluates to False if both inputs are True.

\begin{matrix} & & A\
& & False & True\
B & False & 0 & 1\
& True & 1 & 0 \end{matrix}

That's the difference between "OR" and "XOR"! :)

It may be useful to know for the sample problems below that ∨\lor is a logical OR and ∧\land is a logical AND.

Interactive · 3 questions

OR vs. XOR

When describing binary operations, OR and XOR (exclusive or) are different. Intuitively OR means that one is true and the other isn't, but as an operator, it's slightly different.

Logical Operator

OR takes two values, pp and qq, and if at least one is true, then it returns true. XOR takes those two values again, but if exactly one is true (and the other is false), it returns true.

Here is the truth table for OR and XOR:

pqp   OR   qp   AND   q0000011110111110\begin{array}{c|c|c|c} p & q & p \,\,\, \text{OR} \,\,\, q & p \,\,\, AND \,\,\, q \\ \hline 0 & 0 & 0 & 0 \\ 0 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 \\ 1 & 1 & 1 & 0 \\ \end{array}

We can use the symbol ∨\lor to describe OR and ⊕\oplus to describe XOR.

So, in terms of logical operations, what is True⊕(True∨False)\text{True} \oplus (\text{True} \lor \text{False})?

Choose one answer

Read · 1 min

In common English, "or" can sometimes have an ambiguous meaning. However, in mathematics, that will not do, so we create two separate operations to cover everything that "or" could possibly mean.

The first of these is the inclusive or, denoted ∨\lor. That means that either or both statements connected by the ∨\lor can be true.

A∨BA \lor B is true ⇔\Leftrightarrow AA and/or BB is/are true.

A∨BA \lor B is false ⇔\Leftrightarrow AA and BB are both false.

On the other hand, the exclusive or, denoted, ⊕\oplus, means that exactly one of the two statements involved must be true.

A⊕BA \oplus B is true ⇔\Leftrightarrow AA is true and BB is false or AA is false and BB is true.

A⊕BA \oplus B is false ⇔\Leftrightarrow both statements are true or both statements are false.

In terms of set theory, ∨\lor is the logical equivalent of the union of two sets, and ⊕\oplus is the logical equivalent of the symmetric difference of two sets. Therefore, for an arbitrary xx:

[(x∈A)∨(x∈B)]⇔(x∈A∪B)[(x \in A) \lor (x \in B)] \Leftrightarrow (x \in A \cup B)

[(x∈A)⊕(x∈B)]⇔(x∈AΔB)[(x \in A) \oplus (x \in B)] \Leftrightarrow (x \in A \Delta B)

Read · 1 min

Q & A on Or vs. Xor

Q: How are these operators represented on Venn Diagrams? A: A Venn Diagram has three regions: two for each of the two "categories" separately and a third for the overlap. "Or" represents the entire diagram; "Xor" represents the entire diagram minus the middle section.

Q: How are these operators represented in set theory? A: Let the sets in question be AA and BB. "Or" can be represented in one of these ways, where xx is an element in relation to sets AA and BB:

x∈A∪Bx \in A \cup B

(x∈A)∨(x∈B)(x \in A) \lor (x \in B)

In a similar vein, the "Xor" operator can be written as

((x∈A)∨(x∈B))∧(x∉A∩B)((x \in A) \lor (x \in B)) \land (x \notin A \cap B)

x∈(A∪B)−(A∩B)x \in (A \cup B) - (A \cap B)

Q: Why would anybody want to write these operators out in terms of set theory?

A: It makes writing set containment proofs much easier. For example, here is a proof that the two expressions above are logically equivalent:

x∈(A∪B)−(A∩B)⇔x \in (A \cup B) - (A \cap B) \Leftrightarrow

(x∈A−A∩B)∨(x∈B−A∩B)⇔(x \in A - A \cap B) \lor (x \in B - A \cap B) \Leftrightarrow

((x∈A)∧(x∉A∩B))∨((x∈B)∧(x∉A∩B))⇔((x \in A) \land (x \notin A \cap B)) \lor ((x \in B) \land (x \notin A \cap B)) \Leftrightarrow

(x∉A∩B)∧((x∈A)∨(x∈B))(x \notin A \cap B) \land ((x \in A) \lor (x \in B))

See, isn't that easier than writing things out in words for every step?

Read · 1 min

Write the expression below using or and xor notation.

In addition to xx being equal to 44, we know that yy is equal to either 22 or −2-2.

Write out the following statement using words.

((x=7)∧(y=3))∨((x=5)∧(y≠3))((x = 7) \land (y = 3)) \lor ((x = 5) \land (y \neq 3))

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems