Strip a computer right down and every clever thing it does rests on one tiny decision, made billions of times over: is this on or off, 1 or 0, true or false? The circuits that make those decisions are logic gates, and the rules they follow are Boolean logic — just three basic operations: AND, OR and NOT.
AND — both must be true
An AND gate outputs 1 only when both inputs are 1. Analogy: a microwave runs only if the door is shut AND the start button is pressed — both, or nothing. In Boolean writing this is A & B.
OR — at least one must be true
An OR gate outputs 1 if either input (or both) is 1. Analogy: a hallway lamp on two switches — flick the top switch OR the bottom one and the light comes on. Written A | B.
NOT — flip it
A NOT gate has just one input and reverses it: 1 becomes 0, 0 becomes 1. It's the "opposite" switch — think of a game where pressing a button turns the light off, and releasing it turns the light back on. Written ¬A (or NOT A). Because it has a single input, its truth table has only two rows instead of four.
Truth tables — every possibility
A truth table lists every combination of inputs and the output for each. Here are all three gates in one:
| A | B | A AND B | A OR B | NOT A |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 |
Tip: to fill any truth table, list the inputs counting up in binary (00, 01, 10, 11) so you never miss a row — then apply the gate's rule to each line. AND = all, OR = any, NOT = flip.