Computers use binary representation because it maps perfectly to electrical switches. An electrical switch can be either ON or OFF, corresponding to binary digits 1 and 0. This two-state system is simple, reliable, and easy to implement with electronic circuits.
Why not use decimal or other number systems? In decimal, we would need to distinguish between 10 different voltage levels, which is much harder and less reliable than binary's simple two-state system. Binary's clear distinction between ON and OFF makes it the optimal choice for electronic circuits.
Binary represents numbers using powers of 2. Each position in a binary number corresponds to a power of 2. For example, 13 in decimal equals 1101 in binary. This means 1 times 8, plus 1 times 4, plus 0 times 2, plus 1 times 1, which equals 8 plus 4 plus 0 plus 1, giving us 13.
Binary enables logical operations that are the foundation of computing. Logic gates like AND, OR, and NOT perform these operations on binary inputs. The AND gate outputs 1 only when both inputs are 1. The OR gate outputs 1 when at least one input is 1. These simple operations can be combined to perform complex calculations.