Unit content
Lossless source coding and the entropy bound
A lossless source code represents source symbols with bits in a way that allows the original symbol sequence to be reconstructed exactly.
If symbols have unequal probabilities, fixed-length codewords can waste bits. More probable symbols can be assigned shorter descriptions and rare symbols longer ones.
For independently generated source symbols with a fixed probability distribution, no uniquely decodable lossless code can have long-run average rate below the Shannon entropy $H(X)$.
Binary variable-length codes can be constructed with average length $\bar L$ satisfying
$$H(X)\le \bar L < H(X)+1$$
bits per symbol when symbols are encoded individually, while coding blocks of symbols can make the average rate approach $H(X)$ more closely.
Source coding removes predictable redundancy from the message representation. This is conceptually opposite to channel coding, which deliberately adds structured redundancy so transmission errors can be detected or corrected.