Objectives: Students should be able to —
- 1 Identify, define and recognise the symbols of the standard logic gates: NOT, AND, OR, NAND, NOR and XOR.
- 2 State the function of each logic gate and write its Boolean expression and truth table.
- 3 Use logic gates to create logic circuits from a given problem or logic expression.
- 4 Complete a truth table for a given problem, logic expression or logic circuit.
- 5 Write a logic statement for a given problem, logic expression or truth table.
- 6 Draw a logic circuit to represent a given logic statement or truth table.
- 7 Use a NAND gate or NOR gate as a building block to construct other gates.
- 8 Re-draw a logic circuit by replacing one or more gates with specific equivalent gates.
- 9 Recognise that all logic gates have a maximum of two inputs (except NOT, which has one).
Part 10a — Logic Gates, Truth Tables & Logic Circuits
9 Questions · NOT · AND · OR · NAND · NOR · XOR · building-block replacement
Logic Gates, Symbols & Truth Tables
(a) What is a Logic Gate?
- A logic gate is a device that performs a Boolean logic operation on one or more binary inputs and then produces a single binary output.
- Several logic gates are combined together to form a logic circuit, designed to carry out a specific function.
- Logic gates are the fundamental building blocks of digital integrated circuits in computers, memory chips and controlling devices.
(b) Describe a Truth Table with its purpose.
- A truth table is a chart with rows and columns used to trace the output from a logic gate or logic circuit.
- Each column of the table shows a different possible input and a single output of the logical function for the given gate or circuit.
- Each row of the table breaks down the logical function by listing all possible input values to calculate and find its output.
- The NOT gate is the only logic gate with one input; the other five gates have two inputs.
(c) Name and describe the three basic logic gates with symbol.
The three basic logic gates are: 1. NOT-gate, 2. AND-gate, 3. OR-gate.
NOT gate
Output X is 1 if the input A is NOT 1. Logic notation: X = NOT A Boolean expression: X = Ā
| Input A | Output X |
|---|---|
| 0 | 1 |
| 1 | 0 |
AND gate
Output X is 1 if both inputs (A is 1 AND B is 1). Logic notation: X = A AND B Boolean expression: X = A · B
| A | B | X |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR gate
Output X is 1 if either input (A is 1 OR B is 1) or both are 1. Logic notation: X = A OR B Boolean expression: X = A + B
| A | B | X |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Note: • (dot) = AND, + (plus) = OR, bar above letter (e.g. Ā) = NOT.
NAND gate — combination of AND followed by NOT
Logic notation: X = NOT (A AND B) Boolean expression: X = (A · B) (bar over whole term).
Output X is 1 if both inputs (A AND B) are NOT 1.
| A | B | A·B | X |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
NOR gate — combination of OR followed by NOT
Logic notation: X = NOT (A OR B) Boolean expression: X = (A + B) (bar over whole term).
Output X is 1 if neither input (A NOR B) is 1.
| A | B | A+B | X |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 |
XOR (ExOR) gate — Exclusive OR
Logic notation: X = A XOR B Boolean expression: X = A ⊕ B
Equivalent to X = (A OR B) AND NOT (A AND B) or X = (A · B̄) + (Ā · B).
Output X is 1 if either input (A is 1 OR B is 1), but NOT both. ExOR stands for Exclusive OR — it is similar to OR, except that it excludes the case "OR BOTH 1" (i.e. 1 ⊕ 1 = 0).
| A | B | A⊕B | X |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
Note: NAND = inverse of AND, NOR = inverse of OR, XOR output is true only when both inputs are different.
Building Logic Circuits from Real-World Problems
Step 1 — Logic statement:
Output X = 1, if (A is ON AND B is OFF) OR (B is ON AND C is OFF).
Since ON means 1 and OFF means 0 (i.e. NOT 1):
X = 1, if (A is 1 AND B is NOT 1) OR (B is 1 AND C is NOT 1)
Step 2 — Boolean expression:
X = (A · B̄) + (B · C̄)
Step 3 — Draw each AND group, then join with OR:
Output X = 1 when A=1, B=0 (any C), or B=1, C=0 (any A).
Process parameters table:
| Parameter | Symbol | Binary | Condition |
|---|---|---|---|
| Chemical reaction rate | R | 0 / 1 | < 40 mol/ltr/sec / ≥ 40 mol/ltr/sec |
| Process temperature | T | 0 / 1 | > 115 °C / ≤ 115 °C |
| Concentration of chemicals | C | 0 / 1 | = 4 mol / > 4 mol |
Step 1 — Convert each condition into logic statements:
- reaction rate < 40 → R is 0 → R is NOT 1
- concentration > 4 AND temperature > 115 °C → C is 1 AND T is 0 → C is 1 AND T is NOT 1
- reaction rate ≥ 40 AND temperature > 115 °C → R is 1 AND T is 0 → R is 1 AND T is NOT 1
Step 2 — Boolean expression (sum of products):
X = R̄ + (C · T̄) + (R · T̄)
Step 3 — Draw circuit: three groups joined by OR gates.
Circuit:
Step 1 — Write statements for each gate from left to right (input side to output side):
- First AND gate: (A is 1 AND B is 1)
- OR gate: (B is NOT 1 OR C is 1)
Step 2 — Identify the final joining gate (AND) and connect:
Output X = 1, if (A is 1 AND B is 1) AND (B is NOT 1 OR C is 1)
Boolean expression: X = (A · B) · (B̄ + C)
Using NAND / NOR Gates as Universal Building Blocks
(a) NAND → NOT gate
When a single input signal is passed through a NAND gate (both inputs tied together), the circuit formed is equivalent to a NOT gate.
X = (A · A)̄ = Ā
| Input A | Working (A·A) | X = (A·A)̄ |
|---|---|---|
| 0 | (0·0) | 1 |
| 1 | (1·1) | 0 |
(b) NAND → AND gate
When a NAND gate is inverted (its output passed through another NAND-as-NOT), the circuit formed is equivalent to an AND gate.
X = ((A · B)̄)̄ = A · B
| A | B | P1=(A·B)̄ | X = P1̄ |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
(c) NAND → OR gate
When both input signals to a NAND gate are inverted first (each input passed through a NAND-as-NOT), the circuit formed is equivalent to an OR gate (De Morgan's law).
X = (Ā · B̄)̄ = A + B
| A | B | P1=(Ā·B̄)̄ | X |
|---|---|---|---|
| 0 | 0 | (1·1)̄=0 | 0 |
| 0 | 1 | (1·0)̄=1 | 1 |
| 1 | 0 | (0·1)̄=1 | 1 |
| 1 | 1 | (0·0)̄=1 | 1 |
(a) NOR → NOT gate
When a single input signal is passed through a NOR gate (both inputs tied together), the circuit formed is equivalent to a NOT gate.
X = (A + A)̄ = Ā
| Input A | Working (A+A) | X = (A+A)̄ |
|---|---|---|
| 0 | (0+0) | 1 |
| 1 | (1+1) | 0 |
(b) NOR → OR gate
When a NOR gate is inverted (its output passed through another NOR-as-NOT), the circuit formed is equivalent to an OR gate.
X = ((A + B)̄)̄ = A + B
| A | B | P1=(A+B)̄ | X = P1̄ |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 |
(c) NOR → AND gate
When both input signals to a NOR gate are inverted first (each input passed through a NOR-as-NOT), the circuit formed is equivalent to an AND gate (De Morgan's law).
X = (Ā + B̄)̄ = A · B
| A | B | P1=(Ā+B̄)̄ | X |
|---|---|---|---|
| 0 | 0 | (1+1)̄=0 | 0 |
| 0 | 1 | (1+0)̄=0 | 0 |
| 1 | 0 | (0+1)̄=0 | 0 |
| 1 | 1 | (0+0)̄=1 | 1 |
Method:
- Identify the AND gates followed by a NOT gate, and replace that group with a single NAND gate (since "NOT of AND" = NAND).
- Replace the plain AND gates with "NOT of NAND" (i.e. a NAND gate followed by a NAND-as-NOT inverter) — inverse twice leaves the AND unchanged.
Original circuit (groups labelled):
Final circuit using only NAND gates:
Note: every gate in the redrawn circuit is a NAND gate; the AND gates are produced by NAND followed by a NAND-as-inverter.
(a) NOR-only circuit — label gate outputs and complete truth table.
Assign names to each gate output: G1 = Ā, G2 = B̄, G3 = (G1 + G2)̄, X = G3̄.
| A | B | G1=Ā | G2=B̄ | G3=(G1+G2)̄ | X = G3̄ |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 | 0 |
Equivalent single gate: The output column matches the truth table of a NAND gate. So the circuit can be replaced by a single NAND gate.
(b) NAND-only circuit — label gate outputs and complete truth table.
Assign names: G1 = Ā, G2 = B̄, G3 = (G1 · G2)̄, X = G3̄.
| A | B | G1=Ā | G2=B̄ | G3=(G1·G2)̄ | X = G3̄ |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 1 | 0 | 0 | 1 | 0 |
Equivalent single gate: The output column matches the truth table of a NOR gate. So the circuit can be replaced by a single NOR gate.
Part 10b — Logic Statement, Logic Circuit & Truth Table
7 Questions · statement→circuit · circuit→statement · truth-table→expression · gate replacement
Create a Logic Circuit from a Logic Statement & Complete the Truth Table
(a) Draw the logic circuit.
Solution: Convert the statement to 1's first: X = 1, if (B is NOT 1 AND S is NOT 1) OR (P is NOT 1 AND S is 1).
Step 1: Join NOT of B and NOT of S using AND — "B is NOT 1 AND S is NOT 1".
Step 2: Join NOT of P and S using AND — "P is NOT 1 AND S is 1".
Step 3: Join outputs of Step 1 and Step 2 using OR.
(b) Complete the truth table.
Group G1 = B̄ · S̄, Group G2 = P̄ · S, Output X = G1 + G2.
| B | S | P | G1=B̄·S̄ | G2=P̄·S | X=G1+G2 |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 1 |
| 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 0 |
Step 1: Draw logic circuit for the first inner group (A XOR B).
Step 2: Draw logic circuit for the second inner group (B OR NOT C).
Step 3: Join the two group outputs with a final AND gate.
Boolean expression: X = (A ⊕ B) · (B + C̄)
(a) Draw the logic circuit.
Step 1: Inner group (B NOR C) — NOR gate.
Step 2: Invert that output with a NOT gate → NOT (B NOR C).
Step 3: Second inner group (A AND NOT B) — NOT of B then AND with A.
Step 4: Join groups of Step 2 and Step 3 with OR → ((A AND NOT B) OR (NOT (B NOR C))).
Step 5: Join the output of Step 4 with input C using a final AND gate to produce X.
(b) Complete the truth table.
Groups: G1 = A · B̄, G2 = NOT (B NOR C) = NOT (B+C)̄ = B + C, G3 = G1 + G2, X = G3 · C.
| A | B | C | G1=A·B̄ | G2=B+C | G3=G1+G2 | X=G3·C |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 | 1 | 0 |
| 1 | 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 1 | 1 | 1 |
Write a Logic Statement for a Given Logic Circuit & Complete the Truth Table
Circuit:
(a) Write a logic statement.
Step 1: Start at the input side and write a statement for each gate moving toward the output.
Step 2: Gate outputs: (A XOR C) and (B NAND NOT C).
Step 3: Join both with OR →
X = 1, if (A is 1 XOR C is 1) OR (B is 1 NAND C is NOT 1)
X = (A ⊕ C) + (B NAND C̄)
(b) Complete the truth table.
Groups: G1 = A ⊕ C, G2 = B · C̄, G3 = G2̄ (NAND output), X = G1 + G3.
| A | B | C | G1=A⊕C | G2=B·C̄ | G3=G2̄ | X |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 1 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 |
Write a Logic Expression for a Given Truth Table & Draw the Logic Circuit
Truth table:
| A | B | C | X |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
(a) Write a logic expression.
Step 1: Identify the input conditions producing X = 1 and write each as a product of inputs.
Step 2: The X = 1 rows are:
- A=1, B=0, C=0 → X = 1, if (A is 1 AND B is NOT 1 AND C is NOT 1)
- A=1, B=1, C=1 → X = 1, if (A is 1 AND B is 1 AND C is 1)
Step 3: Join the products with OR (sum of products):
X = (A AND NOT B AND NOT C) OR (A AND B AND C)
X = (A · B̄ · C̄) + (A · B · C)
(b) Draw the logic circuit (each gate max 2 inputs, no simplification).
Truth table:
| A | B | C | X |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 0 |
(a) Write the logic expression (sum of products).
Step 1: Identify each row with X = 1 and write as a product:
- (0,0,0) → Ā · B̄ · C̄
- (0,0,1) → Ā · B̄ · C
- (1,0,0) → A · B̄ · C̄
- (1,0,1) → A · B̄ · C
Step 2: Join with OR:
X = (Ā · B̄ · C̄) + (Ā · B̄ · C) + (A · B̄ · C̄) + (A · B̄ · C)
(b) Show that X = (NOT A AND NOT B) OR (A AND NOT B) produces the same output.
Groups: G1 = Ā · B̄, G2 = A · B̄, X = G1 + G2.
| A | B | C | G1=Ā·B̄ | G2=A·B̄ | X=G1+G2 |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 1 |
| 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 |
The output column matches the truth table in part (a) exactly, so the simplified expression X = (Ā · B̄) + (A · B̄) = B̄ produces the same output. (In fact, B̄ alone is the simplest equivalent — proving the simplification was correct.)
Re-draw a Logic Circuit by Replacing Logic Gates & Describe Their Purpose
Original circuit (uses 6+ gates):
(a) Re-draw using only 4 logic gates (max 2 inputs each).
Step 1: Replace each "NOT of OR" with a single NOR gate.
Step 2: Replace each "NOT of AND" with a single NAND gate.
The four gates are: NOR (A+B)̄, NOR (B+C)̄, NAND G3=(G1·G2)̄, XOR X=G3⊕C.
(b) Complete the truth table.
Groups: G1 = (A + B)̄, G2 = (B + C)̄, G3 = (G1 · G2)̄, X = G3 ⊕ C.
| A | B | C | G1=(A+B)̄ | G2=(B+C)̄ | G3=(G1·G2)̄ | X=G3⊕C |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 1 | 0 |
(c) Describe the purpose of a logic gate in a logic circuit.
- To carry out a logical operation on one or more binary inputs.
- To control the flow of electricity through a logic circuit.
- An input is given and the logic of the gate is applied to give a single binary output.
Revision: Statements and Key Computing Terms
| Statement | Key Term |
|---|---|
| A device that performs a Boolean logic operation on one or more binary inputs to produce a single binary output. | Logic Gate |
| A combination of several logic gates designed to carry out a specific function. | Logic Circuit |
| A chart with rows and columns used to trace the output of a logic gate or circuit for every possible input. | Truth Table |
| A sentence describing when the output X = 1, using AND / OR / NOT / NAND / NOR / XOR. | Logic Statement |
| A mathematical shorthand using · for AND, + for OR, an overbar for NOT, and ⊕ for XOR. | Boolean Expression |
| The gate that inverts a single input — output is 1 when input is 0. | NOT gate (Inverter) |
| The gate that outputs 1 only when both inputs are 1. Boolean: X = A · B | AND gate |
| The gate that outputs 1 when at least one input is 1. Boolean: X = A + B | OR gate |
| Inverse of AND — outputs 0 only when both inputs are 1. Boolean: X = (A · B)̄ | NAND gate |
| Inverse of OR — outputs 1 only when both inputs are 0. Boolean: X = (A + B)̄ | NOR gate |
| Exclusive OR — outputs 1 when inputs are different. Boolean: X = A ⊕ B | XOR (ExOR) gate |
| A gate that can be used to construct any other logic gate (both NAND and NOR have this property). | Universal Gate |
| The rule showing that (A · B)̄ = Ā + B̄ and (A + B)̄ = Ā · B̄. | De Morgan's Law |
| Method of writing a Boolean expression as OR-ed products, e.g. X = (A · B̄) + (Ā · B). | Sum-of-Products (SOP) |
| A small bubble drawn on a gate's output (or input) to indicate logical inversion (NOT). | Inversion Bubble |
| The two binary states used in logic gates — ON (1) and OFF (0). | Logic Levels |
| Label given to each gate's output (G1, G2, G3 …) when completing a truth table for a multi-gate circuit. | Working column |