Every computer, phone, and satellite comes down to one material behaving strangely: silicon, which conducts a little better as it warms up and can be tuned with a pinch of impurity to carry current mostly one way. From that single trick come diodes, transistors, and every logic gate a computer needs.
Every silicon atom shares its 4 outer electrons with 4 neighbors, forming a crystal of covalent bonds. At absolute zero all bonds are intact and no electrons are free — silicon is an insulator. As temperature rises, thermal energy breaks some bonds, freeing an electron and leaving behind a vacancy called a hole, which behaves like a mobile positive charge.
Add a pinch of the right impurity, and the crystal can be tilted to have far more free electrons than holes, or the reverse.
Replace a silicon atom with a pentavalent atom (phosphorus, antimony) and 4 of its 5 electrons bond normally, leaving one loosely-bound extra electron free — a donor, making n-type silicon (n > p). Replace it instead with a trivalent atom (boron, aluminum) and it borrows an electron from a neighbor to complete its bonds, creating an extra hole — an acceptor, making p-type silicon (p > n). In both cases, np = ni² (law of mass action).
Join a p-type region directly to an n-type region and something remarkable happens right at the boundary.
Where p-type meets n-type, electrons and holes diffuse across and recombine, leaving behind a thin depletion region of fixed ions with a built-in electric field. Connect the battery's positive terminal to the p-side (forward bias) and this field is overcome, letting current flow freely. Reverse the battery (reverse bias) and the field is reinforced, blocking current almost completely — the diode acts like a one-way valve, or a switch that's closed in forward bias and open in reverse.
Stack three doped regions instead of two — p-n-p or n-p-n — and the junction becomes a transistor.
A bipolar transistor stacks emitter-base-collector regions (npn or pnp). A small signal current into the thin base is amplified into a much larger collector current, IC = βeIB, since βe (current gain) is large — this is transistor action, the basis of every amplifier. Push the base current to its extremes instead, and the transistor snaps between fully conducting (closed switch, VCE small) and fully cut off (open switch, VCE ≈ VCC) — the basis of every digital logic gate.
Wired as switches, transistors combine into the logic gates that do every computation inside a computer.
Digital electronics encodes information as just two states, 0 and 1, immune to the noise that plagues analog signals. Logic gates built from transistors perform Boolean operations on these bits: a NOT gate inverts its input, an AND gate outputs 1 only if every input is 1, and an OR gate outputs 1 if any input is 1. Every computer operation, no matter how complex, is built from combinations of these three gates.