Skip to content
Infinitesimal Dynamics home
Notebook: 0 XP

Information Theory / Beyond entropy

Arithmetic Coding and Lempel–Ziv

Two ideas that beat Huffman: encode a whole message as one number, or learn the source’s patterns as you go.

3 min read · 1 sections · 1 checks

Contents 2 sections
  1. §1Two strategies
  2. ?Check yourself

By the end you can

  • Explain how arithmetic coding narrows an interval
  • Trace LZ77-style back-references
  • Say why no method compresses every file

Helps to know: Compression and Huffman Codes

§1Two strategies

Arithmetic coding represents a message as a sub-interval of [0,1)[0, 1), shrinking it by each symbol’s probability. The final width is the product of the probabilities, so the code length is within two bits of the entropy of the whole message, with no per-symbol rounding.

Lempel–Ziv methods need no probabilities: they replace repeated strings with pointers to earlier occurrences. ZIP, PNG and gzip are built on LZ77 followed by Huffman coding.

Check yourself

  1. Q1
    Can a lossless compressor shrink every possible file?