Exclusive OR is true when exactly one statement is true. See how two AND clauses, joined by OR, capture those cases, and how the truth table separates XOR from ordinary OR and logical equivalence—a small distinction with a big role in propositional logic.

Multiple Choice

In propositional logic, A XOR B is equivalent to which expression using only AND, OR, and NOT?

Exclusive or is true exactly when one of A or B is true, but not both. To express that with AND, OR, and NOT, you cover the two exclusive cases: A true and B false, or A false and B true. That gives (A ∧ ¬B) ∨ (¬A ∧ B). This matches the XOR truth table: (0,0) → false, (0,1) → true, (1,0) → true, (1,1) → false. The other expressions don’t capture that same behavior: (A ∧ B) ∨ (¬A ∧ ¬B) is true when A and B are the same (equivalence), ¬A ∨ ¬B is not the XOR pattern, and A ∨ B is true whenever at least one is true (it’s also true when both are true).

Exclusive OR: When “Either” Means One, but Not Both

In everyday conversation, “or” can be a little slippery. If someone asks whether you’d like tea or coffee, they may be happy to bring both. In propositional logic, the ordinary OR usually works that way: it is true if at least one statement is true, including when both are true. Exclusive OR, often written XOR, draws a sharper line. It is true when exactly one of two statements is true—and false when they are both true or both false.

That small difference matters in mathematics, computer science, and everyday reasoning. A computer may use XOR to compare bits, while a logic puzzle may rely on the distinction between “one of these claims holds” and “at least one of these claims holds.” To understand XOR, it helps to see how its truth pattern works and how to build it from simpler logical operations.

First, what does XOR actually say?

Suppose A and B are statements, each of which must be true or false. For example:

  • A: The library is open.

  • B: The café is open.

The statement A XOR B says that one location is open, but not both. If the library is open and the café is closed, XOR is true. The same goes if the library is closed and the café is open. If both are open—or neither is—XOR is false.

Here’s the complete pattern:

| A | B | A XOR B |

|---|---|---------|

| False | False | False |

| False | True | True |

| True | False | True |

| True | True | False |

The middle rows are the key. XOR accepts the two cases where the statements differ and rejects the two where they match. You can think of it as a logical “one, but not two” rule.

Building XOR from AND, OR, and NOT

Propositional logic often uses three basic connectives:

  • AND, written ∧, is true when both parts are true.

  • OR, written ∨, is true when at least one part is true.

  • NOT, written ¬, reverses a statement’s truth value.

XOR can be expressed using only those three operations:

(A ∧ ¬B) ∨ (¬A ∧ B)

The formula may look busy at first, but it follows the two situations where XOR is true.

The first part, A ∧ ¬B, means “A is true and B is false.” The second part, ¬A ∧ B, means “A is false and B is true.” The OR between them joins those two cases: XOR is true if either case holds.

That’s the whole idea. Rather than giving XOR a special role, the formula spells out its meaning using familiar pieces. It says: A is true while B is not, or B is true while A is not.

A truth-table check keeps things clear

When a logical formula has several symbols, a truth table is a useful way to check its meaning. Start with all possible truth values for A and B, then evaluate each part of the expression.

For (A ∧ ¬B) ∨ (¬A ∧ B):

| A | B | A ∧ ¬B | ¬A ∧ B | Full expression |

|---|---|---------|---------|-----------------|

| False | False | False | False | False |

| False | True | False | True | True |

| True | False | True | False | True |

| True | True | False | False | False |

The final column matches the XOR pattern exactly. This kind of check is more than tidy bookkeeping. It catches subtle mix-ups, especially when a formula combines negation and parentheses. A single misplaced NOT can change the meaning of an entire statement.

Why ordinary OR isn’t enough

A common source of confusion is the difference between inclusive OR and exclusive OR. In standard propositional logic, A ∨ B is inclusive: it is true if A is true, if B is true, or if both are true.

That means A ∨ B agrees with XOR in two cases: when A alone is true and when B alone is true. But it also returns true when both are true. XOR rejects that last case.

The distinction can feel fussy until it matters. Consider a sign that says, “You may enter with a staff badge or a visitor pass.” Unless the sign says otherwise, someone with both may still enter. That is an inclusive OR. A rule that allows a person to carry one credential but not both would call for an exclusive condition.

Context often tells us which meaning a speaker intends. Mathematical notation removes that guesswork by using distinct symbols and definitions.

The near-twin: equivalence

There’s another expression that looks similar to XOR but describes the opposite pattern:

(A ∧ B) ∨ (¬A ∧ ¬B)

This formula is true when A and B have the same truth value. Either both are true, or both are false. It represents logical equivalence, sometimes called XNOR in computing.

A quick comparison makes the difference plain:

  • XOR is true when A and B differ.

  • Equivalence is true when A and B match.

These two patterns divide the truth table neatly. For any pair of truth values, exactly one of XOR and equivalence is true. If the statements match, equivalence wins. If they differ, XOR does.

A compact alternative

XOR can also be written in another useful form:

(A ∨ B) ∧ ¬(A ∧ B)

The first part, A ∨ B, requires at least one statement to be true. The second part, ¬(A ∧ B), rules out the case where both are true. Put together, they say “at least one, but not both.”

This version highlights the everyday meaning of exclusive OR. The earlier version, (A ∧ ¬B) ∨ (¬A ∧ B), instead lists the two specific ways XOR can be true. Both formulas describe the same truth pattern, though one may be easier to use in a particular setting.

Why can different formulas mean the same thing? In logic, meaning comes from the truth values produced across every possible case. If two expressions match in every row of their truth tables, they are logically equivalent—even if they look quite different.

XOR beyond the page

Exclusive OR has a practical role in digital systems. Computers handle information using bits, which take the values 0 and 1. For two bits, XOR produces 1 when the bits differ and 0 when they match:

  • 0 XOR 0 = 0

  • 0 XOR 1 = 1

  • 1 XOR 0 = 1

  • 1 XOR 1 = 0

This makes XOR handy for comparing bits. If two bit strings are combined position by position with XOR, the result marks the positions where they differ. That idea appears in areas such as error detection and data handling.

There’s an appealing simplicity to the rule: sameness gives 0; difference gives 1. It also explains why XOR appears in discussions of parity, where a system tracks whether a collection contains an even or odd number of 1s. The same basic truth pattern scales from two statements to more involved digital operations.

One small distinction, a lot of clarity

XOR is not just another name for OR. It makes a more precise claim: exactly one of the statements is true. Using AND, OR, and NOT, that claim becomes (A ∧ ¬B) ∨ (¬A ∧ B)—the two exclusive cases joined together.

Once the distinction clicks, the symbols become easier to read. Ordinary OR opens the door if one or both statements hold. XOR opens it only when one holds and the other does not. Two tiny words—“but not both”—do a surprising amount of logical work.