Robot warmup: skewed symbols and prefix codes

Intermediate Information theory, 3Blue1Brown
Created by Best · 07.06.2026 at 20:46 UTC

A robot on a distant moon sends movement instructions drawn from a small, skewed alphabet. Three students propose encoders: fixed width, variable length matched to frequency, and a theoretical "perfect" scheme .

Variable-length codes must be prefix-free: no codeword can be a prefix of another, or the receiver cannot parse the stream. A tree of codewords yields an average length equal to the weighted sum of depths; for the robot, a tuned tree reaches about 1.75 bits per instruction on average, beating fixed two-bit coding .

The third student asks what any optimal encoder must satisfy: after compression, each new bit should behave like a fair coin flip. Structured skew shows up as bias in the bitstream; true optimality leaves no pattern left to exploit .

University approvals: 0
Related cards
Builds on Compression limits and the intelligence slogan · Information theory, 3Blue1Brown
Next Perfect compression looks like random noise · Information theory, 3Blue1Brown
Video Content
Tasks
Question 1

Prefix-free codes prevent:

Question 2

Student two's encoding achieves roughly:

Question 3

Perfect compression target in this chapter:

Question 4

Why must variable-length codewords form a prefix-free set?

Card Info
  • Topic: Information theory, 3Blue1Brown
  • Difficulty: Intermediate
  • Completed: 0 users
Creator
Best
Best
BestBuddy