Exclusive disjunction

From MediaWiki
Revision as of 14:29, 20 October 2025 by Bfh-sts (talk | contribs) (Created page with "= Exclusive disjunction = Exclusive disjunction (often abbreviated as XOR) is the logical operation that returns true if exactly one of the propositions is true, but not both. == Symbols == * p ⊕ q (standard notation) * p XOR q (common in computer science) * (p ∨ q) ∧ ¬(p ∧ q) (definition using basic operators) == Definition == The exclusive disjunction ''p ⊕ q'' is true if either ''p'' or ''q'' is true, but false if both are true or both are false. == Tru...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Exclusive disjunction

Exclusive disjunction (often abbreviated as XOR) is the logical operation that returns true if exactly one of the propositions is true, but not both.

Symbols

  • p ⊕ q (standard notation)
  • p XOR q (common in computer science)
  • (p ∨ q) ∧ ¬(p ∧ q) (definition using basic operators)

Definition

The exclusive disjunction p ⊕ q is true if either p or q is true, but false if both are true or both are false.

Truth Table

p q p ⊕ q
T T F
T F T
F T T
F F F

Examples

  • If p = "I go jogging" and q = "I go swimming",
 then p ⊕ q = "I go jogging or swimming, but not both".
  • In Python: p ^ q (when p and q are booleans)
  • In Java: p ^ q (when p and q are booleans)