Every digital device you own — phone, laptop, calculator — is, underneath everything else, an enormous number of the same handful of simple logic gates wired together. Nothing more exotic than AND, OR, NOT and a few close relatives, just combined at a scale that's genuinely hard to picture.
The basic set
NOT: inverts a single input
NAND = NOT(AND) NOR = NOT(OR)
XOR: Y=1 only if inputs DIFFER
Each gate is fully defined by its truth table — there's no hidden behavior, no exceptions, just a fixed rule mapping every input combination to one output. A 2-input gate always has exactly four possible input combinations (00, 01, 10, 11), since each input independently can be 0 or 1.
Why NAND and NOR get called "universal"
Wire enough NAND gates together, using nothing else, and you can reconstruct AND, OR, and NOT — every one of them. Same story for NOR. That's genuinely surprising the first time you see it, since AND and OR seem like equally fundamental building blocks. They aren't, in one specific sense: neither AND nor OR can reproduce a NOT gate on their own, no matter how you wire them, because neither one has any inversion built in. NAND and NOR each happen to bundle inversion together with their basic logic, which is precisely what makes either one alone functionally complete. It's why real chips are often built almost entirely from a single gate type — manufacturing gets simpler when you only need to fabricate one kind of building block.
Why XOR's truth table looks different from the rest
AND, OR, NAND and NOR all have a lopsided truth table — one row standing out from the other three (or vice versa). XOR splits evenly, two rows one way and two the other, because it's answering a genuinely different question: not "are enough inputs true," but "do these two inputs disagree." Half of all input pairs involve disagreement (01, 10), half involve agreement (00, 11), so the even split isn't a coincidence — it falls straight out of what XOR is actually checking. That comparison-based logic is exactly why XOR shows up in binary adder circuits: computing a sum bit genuinely requires checking whether two input bits differ, something plain AND or OR can't do on their own.
A staircase light is a working XOR gate
Wiring a light to be switchable from two different locations — top and bottom of a staircase, say — needs exactly XOR logic: the light is on when the two switches are in different positions, off when they match. Try building this with AND logic and you'd need both switches flipped simultaneously to change anything, useless for controlling the light from just one end. Try OR logic and the light gets stuck on permanently the first time either switch flips, with no way back off from that same switch. XOR's specific "differ" behavior is what lets either switch independently toggle the light — a genuinely common household circuit that most people never realize is a textbook logic gate.
Why AND makes a good security check
Requiring both a correct key and a correct passcode before something unlocks uses AND logic specifically because AND demands every condition be satisfied simultaneously — failing even one layer blocks the whole system. Switch to OR logic and you'd get the opposite of security: satisfying just the weakest single condition would be enough to unlock. This scales cleanly to three or more conditions too; a 3-input AND just requires defeating all three layers at once, making the system correspondingly harder to compromise.
From Boole's 1854 book to your phone's processor
George Boole laid out the mathematical framework of true/false logic in 1854, decades before anyone connected it to electrical circuits. Claude Shannon's 1937 master's thesis made that connection explicit, showing Boolean algebra could directly describe switching circuits — a genuinely pivotal link between 19th-century abstract logic and practical engineering. Early computers built these gates from vacuum tubes; modern chips etch billions of them into silicon. The gates themselves haven't fundamentally changed since Shannon's thesis. What's changed is how many of them you can pack into a space small enough to fit in a pocket.
