Logical XOR

From WikiEducator
Jump to: navigation, search

Previous lesson: Logical OR

Introducing the Exclusive OR!

[math]\oplus[/math] : This is the XOR operator. It is also called the exclusive OR, to distinguish it from the inclusive OR of the previous lesson. Like the inclusive OR, it is a diadic operator; unlike any other operator, it is true when one and only one input is true.

Let [math]p[/math] represent the statement: It is raining.
Let [math]q[/math] represent the statement: I am hungry.
[math]p \oplus q[/math] represents the exclusive disjunction of statements [math]p[/math] and [math]q[/math]: It is raining OR I am hungry, But not both.

Truth Table

Its truth table is unique. Here it is!

[math]p \,\![/math] [math]q \,\![/math] [math]p \oplus q[/math]
T T F
T F T
F T T
F F F

Why XOR is Special

XOR is used for adding binary numbers, and is the fundamental arithmetic operation used by computers.

Next Lesson

Your next lesson is called Conditional Operator.