Construct the truth table for each of the logic gates above

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

GateSymbolTypical nameNotes
ANDAND gate symbolConjunction
OROR gate symbolDisjunction
NOTNOT gate symbolInverter
NANDNAND gate symbolAND followed by NOT
NORNOR gate symbolOR followed by NOT
XORXOR gate symbolExclusive‑OR
XNORXNOR gate symbolExclusive‑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\$

ABOutput (\$A\land B\$)
000
010
100
111

3.2 OR Gate \$A\lor B\$

ABOutput (\$A\lor B\$)
000
011
101
111

3.3 NOT Gate \$\overline{A}\$

AOutput (\$\overline{A}\$)
01
10

3.4 NAND Gate \$\overline{A\land B}\$

ABOutput (\$\overline{A\land B}\$)
001
011
101
110

3.5 NOR Gate \$\overline{A\lor B}\$

ABOutput (\$\overline{A\lor B}\$)
001
010
100
110

3.6 XOR Gate \$A\oplus B\$

ABOutput (\$A\oplus B\$)
000
011
101
110

3.7 XNOR Gate \$\overline{A\oplus B}\$ (optional)

ABOutput (\$\overline{A\oplus B}\$)
001
010
100
111

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.”

  1. Identify the two sub‑conditions:

    • “A and B are both true” → A ∧ B
    • “C is false” → ¬C

  2. Combine them with “or” → (A ∧ B) ∨ ¬C.

5. From Boolean Expression to Logic‑Circuit Diagram

Example – Forward direction

Expression: (A ∧ B) ∨ ¬C

  1. Break down:

    • AND of A and B → A∧B
    • NOT of C → ¬C
    • OR of the two results → final output

  2. Draw the circuit using the symbols from Section 1:

Circuit for (A AND B) OR NOT C

Example – Reverse direction (new exercise)

Given the circuit below, write the corresponding Boolean expression.

Circuit: A and B into NAND, result into NOT, then OR with C

Solution:

  1. First gate: NAND of A and B → ¬(A∧B).
  2. Second gate: NOT of the NAND output → ¬¬(A∧B) = A∧B.
  3. 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.

ABCOutput (\$A\land B\land C\$)
0000
0010
0100
0110
1000
1010
1100
1111

7. Summary of the Construction Process

  1. Identify the required logical operation (AND, OR, NOT, …).
  2. List every possible combination of inputs – use binary counting (00, 01, 10, 11 …).
  3. Apply the gate’s definition to each combination to obtain the output.
  4. Record the results in a truth table with headings A B → Output.
  5. For an English description, translate the wording into a Boolean expression (use parentheses to show order of operations).
  6. Draw the circuit by connecting the appropriate gate symbols in the order dictated by the expression.
  7. 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.