Truth tables for logic gates

Logic Gates and Truth Tables

A logic gate is an electronic component inside a CPU that takes one or more binary inputs (0 or 1) and produces a single binary output based on a fixed rule. These gates are the building blocks of all digital circuits. A truth table is a systematic way to show every possible combination of inputs and the corresponding output for a logic gate. For a gate with two inputs, there are 22 = 4 possible input combinations; for one input, there are 21 = 2 combinations.

AQA requires knowledge of four logic gates: NOT, AND, OR, and XOR. Each has a distinct behaviour and a distinct use in computing systems.

The Four Logic Gates

NOT Gate - Inverter

The NOT gate has a single input and produces the opposite value as its output. If the input is 1 (true), the output is 0 (false), and vice versa. It is sometimes called an inverter because it inverts the input signal.

Input AOutput (NOT A)
01
10

Rule: Output = opposite of input. Output is 1 when input is 0; output is 0 when input is 1.

Used for: toggling a state (turning something on when it is off), creating conditional logic such as "if the door is NOT locked, trigger the alarm", and inverting signals in circuits.

AND Gate

The AND gate has two inputs and outputs 1 only when both inputs are 1. If either input (or both) is 0, the output is 0. This reflects the logical idea "A and B must both be true for the result to be true".

Input AInput BOutput (A AND B)
000
010
100
111

Rule: Output is 1 only when A = 1 AND B = 1. All other combinations produce 0.

Used for: checking that multiple conditions are simultaneously satisfied, e.g. "unlock the safe if the correct PIN is entered AND a fingerprint is recognised". Also used in processors to mask (select) specific bits from a binary number.

OR Gate

The OR gate has two inputs and outputs 1 when at least one input is 1. The output is only 0 when both inputs are 0. This reflects "A or B (or both) must be true".

Input AInput BOutput (A OR B)
000
011
101
111

Rule: Output is 0 only when A = 0 AND B = 0. Any input of 1 produces output 1.

Used for: combining multiple trigger conditions, e.g. "sound the alarm if the front door OR the back door is opened". Also used in processors to set specific bits in a binary number to 1 (bit setting).

XOR Gate - Exclusive OR

The XOR gate (Exclusive OR) outputs 1 when the inputs are different from each other. When both inputs are the same (both 0 or both 1), the output is 0. This is the key distinction from OR: OR outputs 1 when both inputs are 1, but XOR does not.

Input AInput BOutput (A XOR B)
000
011
101
110

Rule: Output is 1 when inputs differ (one is 0, one is 1). Output is 0 when both inputs are the same.

Used for: detecting differences between two signals, binary addition (the XOR gate produces the sum bit when adding two single bits), and simple encryption/decryption operations where a value is XORed with a key.

Summary Reference Table

GateInputsRule (when output = 1)Key use
NOT1Input is 0Invert / toggle a signal
AND2Both inputs are 1Check multiple conditions are all met
OR2At least one input is 1Check at least one condition is met
XOR2Inputs are differentDetect difference; binary addition sum bit

 Key Takeaways

  • A truth table lists every possible input combination for a logic gate and shows the corresponding output.
  • NOT inverts a single input: 0 becomes 1, 1 becomes 0.
  • AND outputs 1 only when both inputs are 1 - all inputs must be true.
  • OR outputs 1 when at least one input is 1 - any input being true is sufficient.
  • XOR (Exclusive OR) outputs 1 only when the two inputs are different - it differs from OR in that two 1s produce 0.