How does a computer compute with nothing but 0s and 1s?
A computer stores everything (numbers, letters, photos, music) as bits. A bit is anything with exactly two states: a switch that is off or on, a wire at low or high voltage, a tiny region of a disk magnetised one way or the other. We call the two states 0 and 1.
One bit can only say yes or no. Put bits side by side and they can say much more: every extra bit doubles the number of combinations. Eight bits, a byte, have 2^8 = 256 combinations: enough to give a number to every letter, digit and punctuation mark of the English alphabet.
How many different values can 10 bits hold? Each bit doubles the count: 2 × 2 × … × 2, ten times, is 2^10 = 1,024. That is why a kilobyte is often taken as 1,024 bytes.
Storing bits is half of the story. To compute, a computer changes bits according to simple rules called logic gates. A NOT gate flips a bit. An AND gate outputs 1 only if both its inputs are 1. An OR gate outputs 1 if at least one input is 1. A XOR gate outputs 1 if exactly one input is 1.
That is enough to do arithmetic. Adding two one-bit numbers needs just two gates: XOR gives the sum digit and AND gives the carry. Chain such adders and you can add numbers of any size, then multiply, then run any program.
Everything your computer does (video, games, artificial intelligence) comes down to billions of these tiny steps every second. Keep this picture in mind: later in the course, a quantum computer will also use bits and gates, but bits that can be in between 0 and 1, and gates that work by interference.
In binary each position is worth twice the one on its right: 1, 2, 4, 8, 16… So 1011 means 1 × 8 + 0 × 4 + 1 × 2 + 1 × 1 = 11.
With n bits there are 2^n combinations, from 0 to 2^n − 1.
Half adder: sum = A XOR B, carry = A AND B. For 1 + 1: sum 0, carry 1, which is 10 in binary, that is 2.
A classical computer is a huge number of bits, each 0 or 1, changed step by step by simple logic gates.