Rate-Distortion Theory: R(D) and Shannon's Lossy Source Coding Theorem
Anchor (Master): Cover & Thomas 2006 Elements of Information Theory 2e (Wiley) §10.1-10.6; Berger 1971 Rate Distortion Theory: A Mathematical Basis for Data Compression §2-4; Csiszár & Körner 2011 §3.1-3.3
Intuition Beginner
Lossless compression preserves every bit of the original. But sometimes you can tolerate small errors. A photo stored as JPEG loses some detail. A song in MP3 drops some frequencies. The file gets much smaller, and the result is good enough.
Rate-distortion theory answers a precise question: what is the minimum number of bits per symbol needed to reproduce a source to within a given quality level? The "quality level" is measured by a distortion function that penalises errors between the original and the reproduction.
Think of it this way. You have a sequence of coin flips. You want to describe them using fewer bits than the entropy allows, which means some errors are inevitable. The rate-distortion function R(D) tells you the minimum compression rate (bits per symbol) you can achieve if you allow at most D errors per symbol on average. When D = 0, you get back the entropy H(X): perfect reproduction requires the full entropy rate. As D increases, R(D) decreases: allowing more errors lets you compress more.
For a fair coin with Hamming distortion (each wrong guess costs 1, correct costs 0), the rate-distortion function is where . At D = 0 (no errors), R = 1 bit, which is the entropy. At D = 0.5 (half the bits wrong, no better than guessing), R = 0 bits: you do not need to send anything because the decoder can guess randomly.
Shannon proved that R(D) is the fundamental limit. No code can achieve rate below R(D) with distortion at most D, and codes exist that achieve rate arbitrarily close to R(D) with distortion at most D.
Visual Beginner
| Source | Distortion measure | R(D) formula | Key values |
|---|---|---|---|
| Bernoulli(1/2) | Hamming | R(0)=1, R(1/4)=0.189, R(1/2)=0 | |
| Gaussian | Squared error | R(0)=, R()=0 | |
| Uniform [0,1] | Squared error | R(0)=, R(1/12)=0 |
Figure: the rate-distortion curve for a Bernoulli(1/2) source. The horizontal axis is distortion D from 0 to 0.5. The vertical axis is rate R from 0 to 1. The curve starts at (0, 1) and curves convexly down to (0.5, 0). The area above the curve is achievable; the area below is impossible.
Worked example Beginner
A fair coin produces a sequence of bits. We want to compress the sequence, allowing at most 10% of the bits to be wrong. What is the minimum rate?
Step 1. The source is Bernoulli(1/2) with Hamming distortion. The rate-distortion function is .
Step 2. At D = 0.1: bits.
Step 3. bits per symbol.
What this means: instead of needing 1 bit per symbol for perfect reproduction, you only need about 0.53 bits per symbol if you can tolerate 10% errors. For a file of 1000 bits, you can compress it to about 531 bits and the decoder will reproduce at least 900 of them correctly.
Check your understanding Beginner
Formal definition Intermediate+
Let be a random variable taking values in a finite alphabet with distribution . Let be a reproduction alphabet and a distortion measure.
Definition (Rate-distortion function). The rate-distortion function is:
where the minimisation is over all conditional distributions (called test channels) such that the expected distortion .
Definition (Rate-distortion region). The rate-distortion region is the set of achievable rate-distortion pairs.
Properties of :
Convexity: is convex in . If and are achievable, then so is at distortion .
Monotonicity: is non-increasing in .
Boundary values: for lossless coding (when iff ). where is the distortion achieved by guessing without any information.
The convex duality structure
The rate-distortion function has a Lagrangian dual formulation that connects to convex optimisation 44.02.01:
The parameter is a Lagrange multiplier controlling the distortion constraint. By strong duality (guaranteed by convexity), the primal and dual formulations are equal. The optimal test channel has the Gibbs form:
where is the optimal output distribution. This structure is the foundation of the Blahut-Arimoto algorithm 46.04.04.
Key theorem with proof Intermediate+
Theorem (Shannon's lossy source coding theorem). Let be i.i.d. draws from with distortion measure . A rate is achievable with distortion if and only if .
More precisely:
(Achievability) For any , there exists a sequence of codes with and such that for all sufficiently large .
(Converse) For any sequence of codes with , the rate satisfies .
Proof of converse. Let be any code with rate and . By the data-processing inequality:
Since the source is i.i.d.:
where the first inequality uses the fact that conditioning reduces entropy, the second uses the definition of for each symbol, and the third uses convexity of . Dividing by gives .
Bridge. The rate-distortion function builds toward the Gaussian channel capacity in 46.03.05 because the Gaussian R(D) formula is the source-coding dual of the channel capacity ; this is exactly the information-theoretic duality between source and channel coding; the foundational reason R(D) is convex is the convexity of mutual information in the conditional distribution, which generalises to the convex optimisation framework of 44.02.01; the central insight is that lossy compression is governed by the same mutual-information minimisation that governs hypothesis testing in 46.04.01, and putting these together reveals the rate-distortion function as the lossy counterpart of the entropy H(X) in lossless coding.
Exercises Intermediate+
Lean formalization Intermediate+
Mathlib has no formalisation of the rate-distortion function, distortion measures, or the mutual information minimisation problem. The optimisation is over conditional distributions subject to an inequality constraint, which requires Lagrangian duality over measure spaces. The achievability proof for Shannon's theorem requires a random coding argument with joint typicality, which Mathlib's probability library does not support in the required generality. The convexity of and the Gibbs-form optimal test channel are unformalised. The Gaussian case requires the maximum-entropy property of Gaussians and the entropy power inequality, which are not available. This unit ships without a lean_module.
Advanced results Master
The Shannon lower bound
For any source with distortion measure , the Shannon lower bound provides an easily computable lower bound on :
For difference distortion measures on continuous sources, the Shannon lower bound simplifies to:
where is the Gibbs density. For squared-error distortion, the Gibbs density is Gaussian, and the bound is tight: , which equals when is .
Vector rate-distortion and the water-filling principle
For a vector source with independent Gaussian components of variances and total squared-error distortion , the rate-distortion function exhibits a water-filling structure:
where is the "water level" chosen so that . Components with variance below receive no rate (they are quantised to zero); components above receive rate proportional to the log of their variance ratio. This is the source-coding dual of the water-filling in parallel Gaussian channels 46.03.05.
The rate-distortion function and large deviations
The rate-distortion function connects to large deviations through the following observation. The probability that a randomly chosen code at rate achieves distortion less than is exponentially small in , with the exponent given by when . This is the source-coding analogue of the random coding exponent in channel coding. The error exponent for lossy source coding is:
which is positive for all and goes to zero as . This parallels the reliability function of channel coding 46.03.04.
Synthesis. The rate-distortion function is the lossy compression analogue of the entropy ; it builds toward the Gaussian channel capacity where the same formula appears in the dual role; the central insight is that the convex duality structure connects to Lagrangian optimisation 44.02.01, and this generalises to the Blahut-Arimoto computation in 46.04.04; the foundational reason the converse holds is the data-processing inequality applied to the encoder-decoder chain, putting these together we see that rate-distortion, hypothesis testing, and channel capacity are three facets of the same mutual-information landscape.
Full proof set Master
Proposition (Bernoulli R(D) achieves ). For a Bernoulli(1/2) source with Hamming distortion, and for all .
Proof. . For : . For : same by symmetry. So .
For , the test channel (output independent of input) with uniform achieves and . Hence .
Proposition (Gaussian R(D) at ). For a Gaussian source with squared-error distortion, .
Proof. The constant estimator achieves , so . The mutual information since is deterministic. Therefore .
For any , the same estimator works, giving . The rate-distortion function has a "knee" at where it reaches zero.
Proposition (Achievability of Shannon's theorem, sketch). For any , there exists a code at rate with distortion at most .
Proof sketch. Generate a random codebook by drawing each codeword independently from the output distribution induced by the optimal test channel . For a given source sequence , the encoder finds the codeword with minimum distortion: .
The distortion of this scheme is bounded by showing that with high probability, at least one codeword is jointly typical with (in the joint distribution ), and such a jointly typical pair has distortion close to by the law of large numbers. The probability that no codeword is jointly typical is exponentially small when , because the joint typicality requirement needs approximately bits to satisfy.
Connections Master
46.02.02— Shannon's lossless source coding theorem is the special case of the lossy theorem; the rate-distortion function generalises the entropy.44.02.01— Lagrangian duality and convex optimisation provide the computational framework for R(D); the Gibbs-form test channel is the KKT optimality condition.46.03.05— The Gaussian channel capacity is the dual of the Gaussian R(D) ; water-filling appears in both.46.04.04— The Blahut-Arimoto algorithm computes R(D) iteratively using the I-projection and Pythagorean identity.46.04.01— Hypothesis testing and rate-distortion share the mutual information minimisation structure; Stein's lemma and the R(D) converse both rely on the data-processing inequality.
Historical & philosophical context Master
Shannon introduced rate-distortion theory in his 1959 paper "Coding Theorems for a Discrete Source with a Fidelity Criterion," published in the volume Information and Decision Processes (ed. Machol, McGraw-Hill, pp. 93-126). This paper extended the 1948 source coding theorem from lossless to lossy coding, introducing the distortion measure and the rate-distortion function. Shannon proved both the achievability (via random coding) and the converse (via the data-processing inequality), establishing the complete characterisation.
Toby Berger's 1971 monograph Rate Distortion Theory: A Mathematical Basis for Data Compression (Prentice-Hall) systematised the theory, computing R(D) for many source-distortion pairs and developing the connection to convex optimisation. Berger showed that the reverse water-filling principle for Gaussian sources extends to correlated sources via the Karhunen-Loeve transform.
The computational problem of finding R(D) was solved by Blahut (1972) and Arimoto (1972), who independently developed the iterative algorithm that bears their names. The Blahut-Arimoto algorithm alternates between computing the optimal test channel (given the output distribution) and the optimal output distribution (given the test channel), converging to R(D) from above. This algorithm is studied in 46.04.04.
Rate-distortion theory has deep connections to statistical mechanics. The Gibbs-form optimal test channel is analogous to the Boltzmann distribution, with the Lagrange multiplier playing the role of inverse temperature and the distortion playing the role of energy. This analogy was developed by Rose (1994) in his paper "Rate-Distortion Theory and the Vector Quantisation of Non-Compact Sources" (IEEE Trans. IT).
Bibliography Master
@incollection{shannon1959,
author = {Shannon, C. E.},
title = {Coding Theorems for a Discrete Source with a Fidelity Criterion},
booktitle = {Information and Decision Processes},
editor = {Machol, R. E.},
publisher = {McGraw-Hill},
pages = {93--126},
year = {1959},
}
@book{berger1971,
author = {Berger, T.},
title = {Rate Distortion Theory: A Mathematical Basis for Data Compression},
publisher = {Prentice-Hall},
year = {1971},
}
@book{cover-thomas2006,
author = {Cover, T. M. and Thomas, J. A.},
title = {Elements of Information Theory},
edition = {2nd},
publisher = {Wiley},
year = {2006},
}
@book{csiszar-korner2011,
author = {Csisz{\'a}r, I. and K{\"o}rner, J.},
title = {Information Theory: Coding Theorems for Discrete Memoryless Systems},
edition = {2nd},
publisher = {Cambridge University Press},
year = {2011},
}
@article{blahut1972,
author = {Blahut, R. E.},
title = {Computation of Channel Capacity and Rate-Distortion Functions},
journal = {IEEE Transactions on Information Theory},
volume = {18},
number = {4},
pages = {460--473},
year = {1972},
}
@article{arimoto1972,
author = {Arimoto, S.},
title = {An Algorithm for Computing the Capacity of Arbitrary Discrete Memoryless Channels},
journal = {IEEE Transactions on Information Theory},
volume = {18},
number = {1},
pages = {14--20},
year = {1972},
}