Lite / Discovering How the World Works / 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'?
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.
Predict
A doorbell has a front button and a back button. Either one should ring it. Which rule is that?
- Ring if front AND back are pressed
- Ring if front OR back is pressed
- Ring if NOT front is pressed
Guess first, then reveal
OR. The bell rings if at least one button is pressed (and it still rings if both are). An AND bell would only ring when two visitors pressed both buttons at once.
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?
What the interactive shows (text version)
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.
Watch (optional)
Watch for: 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.
“Boolean Logic & Logic Gates: Crash Course Computer Science #3” by CrashCourse (opens YouTube; streaming video uses a lot of data)
The video is optional. Everything you need is in this lesson's text.
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
Intuitive
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.
Technical
Boolean algebra writes AND as A·B, OR as A + B and NOT as Ā (or ¬A). Gates are built from transistors acting as switches: two in series behave like AND, two in parallel like OR.
Applied
A car's interior light uses OR (any door open → light on). A microwave uses AND (door shut AND start pressed → heat). A smoke alarm's test button and its sensor are combined with OR.
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.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
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.
Reflect
Which gate do you think a safety system uses most often, and why?
Write your answer on paper or in your own notes. Lite never stores what you write.