SOLVETUTORMATH SOLVER

Instrument MI-01-681 · Mathematics

XOR Calculator

XOR is true exactly when its two inputs disagree. Enter A and B as 0 or 1, and this sheet returns the exclusive-or result.

Instrument MI-01-681
Sheet 1 OF 1
Rev A
Verified
Type 05 — Algebra SER. 2026-01681

A XOR B

1

A XOR B = A + B − 2AB

The working Every figure verified twice
  1. result = 1 + 0 − 2·1·0 = 1
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

XOR, short for 'exclusive or,' is a logic operation on two binary inputs (each either 0 or 1, standing for false or true) that returns 1 exactly when the two inputs DIFFER from each other, and 0 when they match. This sets it apart from the two other basic logic gates: OR returns 1 whenever EITHER input is 1 (including when both are), and AND returns 1 only when BOTH inputs are 1 — XOR sits in between, specifically excluding the both-true case that plain OR would still count.

The algebraic form A + B − 2AB reproduces XOR's truth table without needing a lookup: when both inputs are 0, the whole expression is 0; when exactly one input is 1, the 2AB term is 0 (since one of A or B is 0) and the sum reduces to the lone 1; when both inputs are 1, A + B gives 2 but the 2AB term subtracts exactly 2 back out, correctly landing on 0. The subtracted term is precisely what excludes the both-true case OR would otherwise count.

XOR shows up constantly in digital electronics and computing beyond its role as a basic logic gate — it's the core operation behind binary addition's carry-free digit sum, simple encryption schemes (XOR-ing data with a key, then XOR-ing again with the same key, exactly recovers the original), and parity-bit error detection, all relying on the same defining property: XOR-ing a value with itself always returns 0, and XOR-ing twice with the same second value always undoes the first XOR.

AB=A+B2ABA \oplus B = A + B - 2AB
A, B — the two binary inputs, each 0 (false) or 1 (true); A XOR B — the exclusive-or result, 1 if A and B differ, 0 if they match.
  • Enter the first input into the Input A field, as 0 or 1.
  • Enter the second input into the Input B field, as 0 or 1.
  • Read A XOR B: the sheet returns 1 if the two inputs differ, or 0 if they match.

Worked example — 1 XOR 0

With A = 1 and B = 0, the two inputs differ, so XOR returns 1. Checking the formula: A + B − 2AB = 1 + 0 − 2×1×0 = 1 − 0 = 1, matching the expected result directly.

Compare A = 1 and B = 1, where the two inputs match: A + B − 2AB = 1 + 1 − 2×1×1 = 2 − 2 = 0. The 2AB term exactly cancels the sum whenever both inputs are 1, correctly excluding that both-true case the way plain OR would not.

Questions

What does XOR mean?

XOR stands for 'exclusive or,' a logic operation on two binary inputs that returns 1 (true) exactly when the two inputs differ from each other, and 0 (false) when they match — unlike plain OR, which also returns true when both inputs happen to be true.

How is XOR different from OR?

OR returns true whenever at least one input is true, including the case where both are true. XOR specifically excludes that both-true case, returning true only when exactly one of the two inputs is true and the other is false.

What is the algebraic formula for XOR?

A + B − 2AB, using 0 and 1 for the two inputs. This produces the same results as XOR's truth table: 0 when both inputs match, 1 when they differ, computed with plain arithmetic rather than a lookup table.

Is XOR symmetric — does the order of A and B matter?

No, the order doesn't matter — A XOR B always gives the identical result as B XOR A, since the formula A + B − 2AB treats both inputs identically and addition and multiplication don't care about order.

Where is XOR used outside of logic gate diagrams?

It's the basis of binary addition's digit-by-digit sum (without carrying), simple encryption schemes where XOR-ing with a key and then XOR-ing again with that same key exactly recovers the original data, and parity-bit error detection in digital communications.

References