Skip to content

Logic Gates and Truth Tables

1.4.3 Boolean algebra · Paper 1 · 2 flashcards · 6 questions

Logic gates are the fundamental building blocks of digital circuits. All computer processors are built from combinations of these simple gates.

Definition
A logic gate is an electronic circuit that performs a logical operation on one or more binary inputs and produces a single binary output.

NOT Gate

Definition
The NOT gate (inverter) has one input and outputs the opposite value.
Example
Truth Table:
ANOT A
01
10
Symbol: Triangle with circle at output
Expression: Q = ¬A

AND Gate

Definition
The AND gate outputs 1 only when ALL inputs are 1.
Example
Truth Table:
ABA AND B
000
010
100
111
Expression: Q = A ∧ B

OR Gate

Definition
The OR gate outputs 1 when AT LEAST ONE input is 1.
Example
Truth Table:
ABA OR B
000
011
101
111
Expression: Q = A ∨ B

XOR Gate (Exclusive OR)

Definition
The XOR gate outputs 1 when inputs are DIFFERENT.
Example
Truth Table:
ABA XOR B
000
011
101
110
Expression: Q = A XOR B

NAND Gate

Definition
The NAND gate is AND followed by NOT - outputs 0 only when ALL inputs are 1.
Example
Truth Table:
ABA NAND B
001
011
101
110
NAND is a "universal gate" - can create any other gate using only NANDs.

NOR Gate

Definition
The NOR gate is OR followed by NOT - outputs 1 only when ALL inputs are 0.
Example
Truth Table:
ABA NOR B
001
010
100
110
NOR is also a "universal gate" - can create any other gate using only NORs.
Key Point
GateOutput ruleExpression
NOTInverts single inputQ = ¬A
AND1 only if all inputs are 1Q = A ∧ B
OR1 if at least one input is 1Q = A ∨ B
XOR1 if inputs are differentQ = A ⊕ B
NANDNOT(AND), 0 only if all inputs are 1Q = ¬(A ∧ B)
NORNOT(OR), 1 only if all inputs are 0Q = ¬(A ∨ B)

Truth Tables and Logic Circuits for an Expression

Exam questions ask for a truth table or a logic gate diagram for a given expression, or for the expression that a circuit represents.

Key Point
Truth table:
• An expression with n inputs needs 2^n rows: 4 rows for two inputs, 8 for three, 16 for four
• List the inputs by counting up in binary, so that no combination is missed
• Add a column for each bracket or NOT, then combine those columns to get the output

Logic circuit:
• Draw one gate for each operator in the expression, starting with the brackets and the NOTs
• The output of one gate becomes an input to the next
• Label every input and the final output

Circuit to expression:
• Work from the inputs towards the output, writing the expression at the output of each gate
• Put brackets round the expression from a gate when it feeds into another gate
Worked Example
Worked Example: Q = (A ∧ B) ∨ ¬C
ABCA ∧ B¬CQ
000011
001000
010011
011000
100011
101000
110111
111101
The circuit has three gates:
• A and B are the inputs to an AND gate
• C is the input to a NOT gate
• The outputs of the AND gate and the NOT gate are the two inputs to an OR gate, whose output is Q