Skip to content
Tactiverge

School/◇ Explorer/Week 16

AND, OR, NOT: the three little deciders

A factory press only slams down if the worker has BOTH hands on the buttons. How does a machine check 'both'?

About 25 min · 3 goals · Checked by automated tests; not yet reviewed by an educator

1.Why should I care?

Every decision inside a computer, from 'is the door shut?' to 'should the airbag fire?', is built from tiny logic gates. Three of them, AND, OR and NOT, are enough to build any decision at all.

  • ◇ Describe what the AND, OR and NOT gates do with inputs of 0 and 1.
  • ◇ Match each gate to an everyday machine rule.
  • ◇ Predict a gate's output for any inputs.

2.Predict

A doorbell has a front button and a back button. Either one should ring it. Which rule is that?

Guess first. Being wrong here is how the surprise works.

3.Discover

Pick AND. Before flipping anything, predict the output for all four input combinations. Then check them. Do the same for OR and NOT. Which gate gives 1 most often?

Logic gate lab

A logic gate looks at its inputs (each 0 or 1) and follows one fixed rule to decide its output. Pick a gate, flip the inputs and fill in the truth table in your head before you look.

Gate

A = 0B = 0AND0
Truth table for AND
ABout
000
010
100
111

In a machine: A two-button machine press: it runs only when the left AND the right button are held.

AND: 1 only when every input is 1. A = 0, B = 0 → output 0.

Can't use the interactive? Read a description instead

The logic gate diagram lets you choose AND, OR, NOT, NAND, NOR or XOR, flip inputs A and B between 0 and 1, and see the output lamp. A truth table lists every input combination with its output and highlights the current row. AND gives 1 only for 1,1; OR gives 0 only for 0,0; NOT flips its one input.

4.Watch

→ Watch for the truth tables of AND, OR and NOT, then pause before each one and predict it.

Introduces AND, OR, NOT and XOR, the building blocks behind every digital decision a computer makes.

10 min 7 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

5.Understand

Inputs and outputs are bits

A logic gate takes one or two inputs, each 0 (off, false, no) or 1 (on, true, yes), and produces one output by following a fixed rule. In real circuits, 0 and 1 are low and high voltages; inside a lab simulation they are just numbers.

The three basic gates

  • AND: output 1 only when both inputs are 1. Both hands on the buttons.
  • OR: output 1 when at least one input is 1. Either doorbell button.
  • NOT: one input, and it flips it. 1 becomes 0, 0 becomes 1. Night light: ON when NOT bright.

Plus three useful extras

  • NAND = NOT AND: 0 only when both inputs are 1.
  • NOR = NOT OR: 1 only when both inputs are 0.
  • XOR (exclusive or): 1 when the inputs are different. Stairway light switches work like this.

Amazingly, NAND on its own can be wired up to make every other gate.

Explain it another way

AND is a strict parent: 'You can go out if your homework is done AND your room is tidy.' OR is a relaxed parent: 'You can go out if your homework is done OR your room is tidy.' NOT is a contrarian who always says the opposite.

Worked example 1

A safe opens only if the right code is entered AND the key is turned. The code is right (1) but the key isn't turned (0). Does it open?

AND needs both to be 1. 1 AND 0 = 0, so the safe stays shut.

Common mix-ups

  • OR means one or the other, but not both.
    ✓ In logic, OR includes both: 1 OR 1 = 1. 'One or the other but not both' is XOR.

6.Practice

Practice, not a test. Wrong answers get a hint and another try.

Practice 1 · a fresh version every time

A NAND gate gets A = 0 and B = 1. What is its output (0 or 1)?

Practice 2

A microwave heats only if the door is shut and you pressed start. Which gate?

Practice 3

A NOT gate's input is 1. What is its output?

Practice 4

Of the four input combinations (00, 01, 10, 11), how many make an OR gate output 1?

Practice 5 · a fresh version every time

A NOR gate gets A = 0 and B = 0. What is its output (0 or 1)?

7.Apply it

Find three rules in machines around you and write each as a gate, e.g. 'car alarm sounds if a door opens OR the glass breaks'. Then invent one rule that needs NOT.

8.Reflect

Concepts: Logic gates and Boolean algebra