Computer ScienceExam code: 0984

Logic Gates and Circuits

Boolean Logic

For each gate the format is the same: the circuit symbol, the rule in plain English, the Boolean notation (Cambridge papers and mark schemes write it with the words AND, OR, NOT, NAND, NOR and XOR), and the truth table.

AND

Circuit symbol for an AND gate: a flat-backed D-shape with two inputs and one output
Source: Truth Tables by Save My Exams

Rule: the output is 1 only when every input is 1. If any input is 0, the output is 0.

Boolean notationRead aloud
A · B, AB, A ∧ B"A AND B"
ABA AND B
000
010
100
111

A quick way to remember the rule: an AND gate is like two switches in series; current only flows through if both are closed.

OR

Circuit symbol for an OR gate: a curved-back shield shape with two inputs and one output
Source: Truth Tables by Save My Exams

Rule: the output is 1 when at least one input is 1. The output is 0 only when every input is 0.

Boolean notationRead aloud
A + B, A ∨ B"A OR B"
ABA OR B
000
011
101
111

Think of an OR gate as two switches in parallel: closing either one (or both) lets current flow.

NOT

Circuit symbol for a NOT gate: a triangle pointing right with a small NOT bubble on its tip, one input and one output
Source: Truth Tables by Save My Exams

Rule: the output is the inverse of the input. A 1 becomes a 0; a 0 becomes a 1. NOT has exactly one input.

Boolean notationRead aloud
¬A, A̅, NOT A"NOT A"
ANOT A
01
10

A NOT gate is also called an because it flips its input.

XOR (exclusive OR)

Circuit symbol for an XOR gate: an OR shield shape with an extra curved line across its back, two inputs and one output
Source: Logic Gates by Save My Exams

Rule: the output is 1 when exactly one input is 1. If both inputs are the same (both 0 or both 1), the output is 0.

Boolean notationRead aloud
A ⊕ B, A XOR B"A XOR B"
ABA XOR B
000
011
101
110

The easiest way to keep XOR straight: the output is 1 when the inputs differ, and 0 when they match.

NAND (NOT AND)

Circuit symbol for a NAND gate: an AND D-shape with a small NOT bubble on its output
Source: Logic Gates by Save My Exams

Rule: the output is the opposite of AND. NAND outputs 0 only when every input is 1; in every other case the output is 1.

Boolean notationRead aloud
¬(A · B), A NAND B"A NAND B"
ABA NAND B
001
011
101
110

NAND is drawn as an AND gate with a small circle on the output. The circle is the "NOT bubble" and it flips the result.

NOR (NOT OR)

Circuit symbol for a NOR gate: an OR shield shape with a small NOT bubble on its output
Source: Logic Gates by Save My Exams

Rule: the output is the opposite of OR. NOR outputs 1 only when every input is 0; in every other case the output is 0.

Boolean notationRead aloud
¬(A + B), A NOR B"A NOR B"
ABA NOR B
001
010
100
110

NOR is drawn as an OR gate with the same NOT bubble on the output.

Side-by-side comparison

It is worth memorising this single table; almost every logic-gates question depends on it.

ABANDORXORNANDNOR
0000011
0101110
1001110
1111000

Two patterns are worth noticing:

  • The NAND column is the AND column with every value flipped.
  • The NOR column is the OR column with every value flipped.

That is exactly what the "N" in NAND and NOR means.

Quick check

5 short questions on this note. See what has stuck, and where to look if something hasn't.

About 2 minutes

Build on this topic