3.2 Logic Gates and Logic Circuits
This section covers the seven basic logic gates required for the Cambridge AS Computer‑Science syllabus, their symbols, concise definitions, and complete truth tables. You will also learn how to move between English statements, Boolean expressions and circuit diagrams.
Learning Objectives
- Identify and draw the standard symbol for each required gate (AND, OR, NOT, NAND, NOR, XOR). XNOR is shown as an optional A‑Level extension.
- State the logical function of each gate in one clear sentence.
- Construct the full truth table for every gate.
- Translate a short English description into a Boolean expression.
- Convert a Boolean expression into a logic‑circuit diagram – and the reverse.
1. Gate Symbols
| Gate |
Symbol |
Typical name |
Notes |
| AND |
 |
Conjunction |
|
| OR |
 |
Disjunction |
|
| NOT |
 |
Inverter |
|
| NAND |
 |
AND followed by NOT |
|
| NOR |
 |
OR followed by NOT |
|
| XOR |
 |
Exclusive‑OR |
|
| XNOR |
 |
Exclusive‑NOR (equivalence) |
Optional – appears only in A‑Level material. |
2. One‑Sentence Definitions
- AND – outputs 1 only when **both** inputs are 1.
- OR – outputs 1 when **at least one** input is 1.
- NOT – outputs the opposite (inverse) of its single input.
- NAND – outputs 0 only when **both** inputs are 1 (the negation of AND).
- NOR – outputs 1 only when **both** inputs are 0 (the negation of OR).
- XOR – outputs 1 when the two inputs are **different**.
- XNOR – outputs 1 when the two inputs are **the same** (the negation of XOR).
3. Truth Tables
3.1 AND Gate $A\land B$
| A | B | Output ($A\land B$) |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
3.2 OR Gate $A\lor B$
| A | B | Output ($A\lor B$) |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
3.3 NOT Gate $\overline{A}$
| A | Output ($\overline{A}$) |
| 0 | 1 |
| 1 | 0 |
3.4 NAND Gate $\overline{A\land B}$
| A | B | Output ($\overline{A\land B}$) |
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
3.5 NOR Gate $\overline{A\lor B}$
| A | B | Output ($\overline{A\lor B}$) |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
3.6 XOR Gate $A\oplus B$
| A | B | Output ($A\oplus B$) |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
3.7 XNOR Gate $\overline{A\oplus B}$ (optional)
| A | B | Output ($\overline{A\oplus B}$) |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
4. From English Description to Boolean Expression
Example 1 – Single‑gate description
“The output is true when exactly one of the inputs A or B is true.”
- Key phrase: “exactly one … is true”.
- This matches the definition of an exclusive‑OR.
- Boolean expression:
A ⊕ B or (A ∧ ¬B) ∨ (¬A ∧ B).
Example 2 – Multi‑gate description (new)
“The output is true when A and B are both true **or** C is false.”
- Identify the two sub‑conditions:
- “A and B are both true” →
A ∧ B
- “C is false” →
¬C
- Combine them with “or” →
(A ∧ B) ∨ ¬C.
5. From Boolean Expression to Logic‑Circuit Diagram
Example – Forward direction
Expression: (A ∧ B) ∨ ¬C
- Break down:
- AND of A and B →
A∧B
- NOT of C →
¬C
- OR of the two results → final output
- Draw the circuit using the symbols from Section 1:

Example – Reverse direction (new exercise)
Given the circuit below, write the corresponding Boolean expression.

Solution:
- First gate: NAND of A and B →
¬(A∧B).
- Second gate: NOT of the NAND output →
¬¬(A∧B) = A∧B.
- Third gate: OR with C →
(A∧B) ∨ C.
6. Extended Example – 3‑Input AND Gate
When a gate has more than two inputs the rule is unchanged: the output is 1 only if **all** inputs are 1.
| A | B | C | Output ($A\land B\land C$) |
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
7. Summary of the Construction Process
- Identify the required logical operation (AND, OR, NOT, …).
- List every possible combination of inputs – use binary counting (00, 01, 10, 11 …).
- Apply the gate’s definition to each combination to obtain the output.
- Record the results in a truth table with headings
A B → Output.
- For an English description, translate the wording into a Boolean expression (use parentheses to show order of operations).
- Draw the circuit by connecting the appropriate gate symbols in the order dictated by the expression.
- To check your work, you can reverse the process: start from a circuit, read each gate, and write the equivalent Boolean expression.
Mastering these steps prepares you for more complex combinational circuits such as adders, multiplexers and decoders, which are covered later in the Cambridge A‑Level Computer Science syllabus.