Physics Topic

Logic Gates and Truth Tables

  1. Read notes
  2. Flashcards
  3. Quiz
  4. Confident

Study focus - 3 things

  1. A logic gate takes inputs that are high (1) or low (0) and gives an output that is 1 or 0. A truth table lists every combination of inputs with the output each one gives, so a two-input gate has 4 rows
  2. AND: output 1 only when both inputs are 1. OR: output 1 when at least one input is 1. NOT: one input, and the output is the opposite. NAND is AND followed by NOT, and NOR is OR followed by NOT
  3. A small circle on a gate symbol means the output is inverted. Learn each symbol's shape and its truth table, and check yourself: NAND and NOR outputs are the AND and OR outputs flipped

Visual notes

Symbols for the AND, OR, NOT, NAND and NOR gates
Five logic gate symbols with their output columns. AND has a flat back and rounded front, output 0, 0, 0, 1. OR has a curved back and pointed front, output 0, 1, 1, 1. NOT is a triangle with a small circle on its point, output 1 then 0. NAND is the AND shape with a small circle on the output, output 1, 1, 1, 0. NOR is the OR shape with a small circle on the output, output 1, 0, 0, 0.

Inputs A and B enter on the left and output Q leaves on the right. The small circle means the output is inverted. The output columns are for A B = 0 0, 0 1, 1 0, 1 1.

Section 1Inputs, outputs, 1 and 0

A logic gate is a small electronic circuit that makes a decision. Its output depends on its inputs by a fixed rule. Every signal has two states: high or low. We write high as 1 and low as 0. Think of a switch: closed is 1 and open is 0. Think of a lamp: on is 1 and off is 0. A gate with two inputs calls them A and B, and the output is Q. A NOT gate has just one input, A. The rule of each gate is shown in its truth table.

Section 2Truth tables

A truth table lists every possible combination of inputs and the output that each combination gives. Two inputs, each 0 or 1, give 2 × 2 = 4 combinations. Always write them in the same order: A B = 0 0, 0 1, 1 0, 1 1. A one-input gate has only 2 rows: 0 and 1. Here's the trick: write all the rows first, then fill in the output for each one, using the gate's rule. Do not skip a row.

Section 3AND and OR gates

AND gate: the output is 1 only when both inputs are 1. The switch picture is two switches in series: the lamp lights only when both are closed. AND (rows A, B, then Q): A=0 B=0 gives Q=0, A=0 B=1 gives Q=0, A=1 B=0 gives Q=0, A=1 B=1 gives Q=1 OR gate: the output is 1 when any input is 1, and 0 only when all the inputs are 0. The switch picture is two switches in parallel: the lamp lights if either one, or both, are closed. OR (rows A, B, then Q): A=0 B=0 gives Q=0, A=0 B=1 gives Q=1, A=1 B=0 gives Q=1, A=1 B=1 gives Q=1 Easy to mix up: in everyday speech, 'or' often means one or the other. An OR gate also gives 1 when both inputs are 1.

Section 4The NOT gate

A NOT gate, also called an inverter, has one input. Its output is the opposite of the input: a 1 in gives a 0 out, and a 0 in gives a 1 out. NOT (rows A, then Q): A=0 gives Q=1, A=1 gives Q=0 The symbol is a triangle with a small circle at its point. The circle is the part that means 'invert'.

Section 5NAND and NOR gates

NAND is an AND gate followed by a NOT gate. Its output is 0 only when both inputs are 1. NAND (rows A, B, then Q): A=0 B=0 gives Q=1, A=0 B=1 gives Q=1, A=1 B=0 gives Q=1, A=1 B=1 gives Q=0 NOR is an OR gate followed by a NOT gate. Its output is 1 only when both inputs are 0. NOR (rows A, B, then Q): A=0 B=0 gives Q=1, A=0 B=1 gives Q=0, A=1 B=0 gives Q=0, A=1 B=1 gives Q=0 Here's the trick: write down the AND (or OR) outputs, then flip every one. That gives NAND (or NOR). In the symbols, the small circle on the output is the NOT part.

Section 6The gate symbols

The figure shows the five symbols, with the output column for A B = 0 0, 0 1, 1 0, 1 1 under each. AND: a flat back and a rounded front. OR: a curved back and a pointed front. NOT: a triangle with a small circle on its point. NAND: the AND shape with a small circle on the output. NOR: the OR shape with a small circle on the output. The small circle always means the output is inverted. The inputs enter on the left and the output leaves on the right. Confirm with a physics teacher the symbol style your class uses, because some books draw gates as plain boxes.

Section 7Checking a table with patterns

You can test a table you have written, using the number of 1s in the output column (rows in the order 0 0, 0 1, 1 0, 1 1). AND has a single 1, in the last row. OR has three 1s, with a 0 only in the first row. NAND has three 1s, with a 0 only in the last row. NOR has a single 1, in the first row. So NAND and NOR are the opposites of AND and OR. If your NAND column looks like the AND column, you forgot the NOT.

Examples

Complete the truth table of a NOR gate with inputs A and B, and say in words when its output is 1.

A NOR gate is an OR gate followed by a NOT gate. The OR outputs for A B = 0 0, 0 1, 1 0, 1 1 are 0, 1, 1, 1. The NOT gate flips each one, giving 1, 0, 0, 0. NOR (rows A, B, then Q): A=0 B=0 gives Q=1, A=0 B=1 gives Q=0, A=1 B=0 gives Q=0, A=1 B=1 gives Q=0 The output is 1 only when both inputs are 0.

A shop in Kingston has a sensor on the front door (A) and one on the back door (B). Each gives 1 when its door is open. (a) A buzzer should sound (Q = 1) only when both doors are open at the same time. Name the gate and give its truth table. (b) The owner changes the rule so that the buzzer sounds when at least one door is open. Name the gate and give its truth table. (c) A third gate has output 1, 1, 1, 0 for A B = 0 0, 0 1, 1 0, 1 1. Name it and say how it is related to the gate in (a). (d) For how many of the four rows is the output 1 for each of the three gates?

(a) Both doors open at once is an AND gate. AND (rows A, B, then Q): A=0 B=0 gives Q=0, A=0 B=1 gives Q=0, A=1 B=0 gives Q=0, A=1 B=1 gives Q=1 (b) At least one door open is an OR gate. OR (rows A, B, then Q): A=0 B=0 gives Q=0, A=0 B=1 gives Q=1, A=1 B=0 gives Q=1, A=1 B=1 gives Q=1 (c) The outputs 1, 1, 1, 0 are the AND outputs from (a) with every one flipped, so the gate is a NAND gate (AND followed by NOT). (d) The AND gate gives 1 in 1 row, the OR gate gives 1 in 3 rows, and the NAND gate gives 1 in 3 rows.

Now let's water it

Session runs notes to flashcards to quiz back-to-back.

Where this comes from