Episode 4: XOR/XNOR

Preview

We’ve already seen the OR gate and its negation, the NOR gate. In this episode, we introduce a variation on the OR gate, called the XOR (pronounced “ex-or”) gate as well as its negation, called the XNOR (pronounced “ex-nor”) gate.

Play

First, let’s play with the inputs of the XOR gate. Notice what happens when the inputs are the same and when they’re different. How would you use words to describe how the inputs affect the output?

https://circuitverse.org/users/230255/projects/xor-efbd4996-6720-4ba4-aa09-00ec64f8162a

Does the XOR gate remind you of any gates you have already seen? You might notice that the OR gate and the XOR gate are almost identical. The X in XOR stands for “exclusive” so we sometimes call the XOR gate the “exclusive OR” gate. What is the main difference between the OR gate and the XOR gate?

Since A OR B is represented by A+B and XOR is so similar to OR, the notation for A XOR B is also similar to the notation for A OR B. Namely, A XOR B is represented by $A \oplus B$.

In the following exercises, we’ll need to type answers like “A XOR B“. We can type this in two different ways:

  1. A xor B (“xor” must be lower case), or
  2. A \oplus B (the usual Boolean representation, which looks like $A \oplus B$).

Progress

Next, let’s look at the negation of the XOR gate. Play with the inputs of the XOR gate and its negation, the XNOR gate. Notice that the symbol of the XNOR gate looks like the symbol for the XOR gate, but it has a little circle on the output, just like we saw with the negations in the previous episode. How does this change the outputs?

https://circuitverse.org/users/230255/projects/xor-xnor-3598db2f-aa68-4fd2-a60d-3d9c10d1ed98

As is usual for negations, the Boolean expression for A XNOR B combines the notation for XOR and NOT:

$( A \oplus B)’$

Practice

Now you’ve learned 3 representations (diagram symbol, truth table, and Boolean expression) of 7 different logic gates (NOT, AND, OR, XOR, NAND, NOR, and XNOR). This means you’ve learned 21 different representations! Check which representations you remember by playing the flashcard game below.