Form 5 · Chapter 1

Logic Gates

Logic gates are the basic building blocks of digital circuits that take binary inputs (0 and 1) and produce an output based on a particular logical operation.

Basic Logic Gates

A logic gate takes one or more binary inputs and produces a single binary output (0 or 1). The three basic gates are:

  • AND gate — the output is 1 only when all inputs are 1.
  • OR gate — the output is 1 when any input is 1.
  • NOT gate — inverts the input; 0 becomes 1 and 1 becomes 0.

Key idea

Remember the difference between AND and OR: AND needs ALL inputs to be 1 to give 1, while OR only needs ONE input to be 1.

Combination Gates

Several other gates are built from the basic gates:

  • NAND gate — the inverse of AND; the output is 0 only when all inputs are 1.
  • NOR gate — the inverse of OR; the output is 1 only when all inputs are 0.
  • XOR gate (exclusive OR) — the output is 1 when the inputs are different, and 0 when the inputs are the same.

Truth Tables

A truth table lists every possible combination of inputs and the resulting output of a gate. The table below compares the AND, OR and XOR gates for two inputs A and B:

ABA AND BA OR BA XOR B
00000
01011
10011
11110

Example

An alarm sounds only when the door is open AND the alarm switch is on. This is an AND gate: both conditions must be true (1) before the output (alarm) becomes 1.

Remember

AND = all 1; OR = any 1; NOT = invert; XOR = different inputs give 1. Combination circuits can be formed by connecting several basic gates together.

Stuck on this topic? A verified JomKelas tutor can walk you through it.

Find a verified tutor