So far every random variable has been discrete: a coin, a letter, a bit. Real signals are not. A voltage, a temperature, the position of a robot arm: these take values on a continuous line. Can we still talk about how many bits such a quantity contains?

A first attempt fails immediately. Let be a number chosen uniformly between and . To write down exactly we need all of its binary digits, , and there are infinitely many. The entropy of a continuous variable, in the old sense, is infinite.

But this is the wrong question. Nobody needs a voltage to infinitely many digits. The useful question is: how many bits do we need to describe to a given accuracy? For the uniform number above the answer is easy. To pin it down to binary digits takes bits.

Now take a number that is uniform between and . Its first three binary digits after the point are always , so they need not be sent. Describing it to digits takes only bits. The distribution is narrower, and it is cheaper to describe by exactly bits.

A number uniform on 0 to 1 needs n bits for n binary digits. A number uniform on 0 to one eighth always starts with three zeros, so it needs n minus 3 bits.

That offset is the quantity this note is about. The differential entropy is defined so that

For the uniform number on , . For the one on , . The accuracy term is the same for every distribution. The differential entropy is the part that depends on the distribution: how spread out is.

Three things make differential entropy worth learning:

  • It measures spread in a precise way: is the “effective width” of the distribution.
  • It behaves almost like ordinary entropy, with a few traps: it can be negative, and it changes when we change units.
  • Mutual information built from it has no traps at all. for continuous variables is a true number of bits, and it is what gives the capacity of real channels with continuous noise.

This note follows Chapter 8 of Cover & Thomas, Elements of Information Theory (second edition), referred to below as “the book”.

How to read this note

Each result is stated, then explained in plain words: what it says and why it is believable. The proofs and derivations are in collapsed boxes titled Proof. They are optional. You can skip all of them and still follow the note.

What we use from earlier notes

Every term below is used later. Each has a one-line reminder here.

  • Entropy : the average uncertainty of a discrete variable, in bits. See entropy and mutual information.
  • Relative entropy : how different is from . It is never negative, and is zero only when .
  • Mutual information : the number of bits that one variable tells us about the other.
  • Typical sequences (the AEP). A long sequence of independent draws is almost certainly one of about typical sequences. See the asymptotic equipartition property.
  • Channel capacity : the largest rate at which a channel can carry information reliably. See channel capacity.
  • Density. A continuous random variable has a probability density with . The probability that lands in a small interval of width around is about . A density is not a probability, and it can be larger than .
  • Support. The set of where , that is, the values can actually take.
  • Mean and variance. and . The variance measures how far typically is from its mean.
  • Gaussian (normal) distribution : the bell curve with density .
  • Bits and nats. means base 2 and gives bits. is the natural logarithm and gives nats. One nat is bits. Integrals are easier in nats, so some calculations use them.

1. Definition and First Examples

1.1 From sums to integrals

For a discrete variable, . For a continuous variable we replace the probabilities by the density and the sum by an integral.

Definition. The differential entropy of a continuous random variable with density is where is the support of .

Equivalently, : the average of of the density at the point where lands. We write a small to keep it apart from the discrete entropy . The value depends only on the density, so it is also written .

The formula looks the same as before, but one thing has changed. A probability is at most , so and discrete entropy is never negative. A density can exceed , so can be negative, and so can .

1.2 Uniform distribution

Let be uniform on an interval of width , so on that interval. Then

Three uniform densities of width 2, 1 and one half, with differential entropies +1, 0 and -1 bits.

What it means. For a uniform variable, the differential entropy is simply the logarithm of the width of the interval. Doubling the width adds one bit. A width of gives , and a width below gives a negative value.

A negative entropy looks alarming, but nothing is wrong. Turn the formula around: is the width of the interval, which is always positive. Think of as the size of the region where lives. A negative only says that this region is smaller than one unit.

1.3 Gaussian distribution

Result. If , then

What it means.

  • The entropy depends on the variance and not on the mean . Sliding the bell curve left or right does not change how uncertain we are.
  • The entropy grows with . Doubling the standard deviation adds one bit, exactly as doubling the width of a uniform did.
  • The effective width is . A Gaussian is as uncertain as a uniform variable spread over about four standard deviations.

A Gaussian density with a uniform density of the same differential entropy drawn over it. The uniform has width 4.13 standard deviations.

1.4 A small table

DistributionDensityDifferential entropy
Uniform on an interval of width
Gaussian, variance
Exponential, rate ,
Laplace, rate

In every row the entropy is the logarithm of a length: the width , the standard deviation , or the scale . The last two rows are derived in the problem below.

Left: the exponential density, which lives on the positive numbers. Right: the Laplace density, a two-sided version. Its entropy is one bit larger.

HW5 Problem 1: Differential entropy (book Problem 8.1)

Evaluate the differential entropy for the following:

(a) The exponential density, , .

(b) The Laplace density, .

(c) The sum of and , where and are independent Gaussian random variables with means and variances , .


2. What Differential Entropy Measures: Quantization

The introduction claimed that is the number of bits needed to describe to -digit accuracy. Here is where that comes from.

To turn a continuous variable into a discrete one, chop the line into bins of width and record only which bin falls into. This is quantization. Call the result . It is an ordinary discrete random variable, so it has an ordinary entropy .

A bell-shaped density divided into bins of width delta. The probability of a bin is about the density times delta.

Theorem (quantization). If the density of is well behaved (Riemann integrable), then as the bins shrink,

In other words, for small bins. With bins of width , which is -binary-digit accuracy, this reads .

What it means. The cost of describing a continuous variable splits into two parts.

  • is the price of the accuracy we ask for. Halving the bin width costs exactly one more bit. This part is the same for every distribution, and it goes to infinity as . That is the “infinitely many digits” from the introduction.
  • is the part that belongs to the distribution. It is what remains when the accuracy term is subtracted.

So differential entropy is not the information content of . That is infinite. It is a relative measure: it tells us how much more or less it costs to describe than to describe a uniform variable on an interval of width , at any fixed accuracy.

Examples.

VariableBits for -digit accuracyWhy
Uniform on The first binary digits are fair coin flips.
Uniform on The first three digits are always .
Gaussian with The value ranges over tens of units, so digits before the point are needed too.

A discrete variable has differential entropy

If takes only a few isolated values, then once the bins are small enough, shrinking them further costs nothing. stays fixed while , so . This agrees with the “size” picture: , and a set of isolated points has zero width.


3. The AEP for Continuous Variables

For discrete variables the AEP said that a long i.i.d. sequence is almost certainly one of about typical sequences. For continuous variables we cannot count sequences, because there are infinitely many. We measure volume instead. The volume of a set in dimensions is : length when , area when , and so on.

Theorem (AEP for continuous variables). Let be i.i.d. with density . Then Define the typical set as the sequences with . For large :

  1. .
  2. .
  3. .

Moreover, no set with probability close to has a much smaller volume.

What it means. A long sequence of draws is a point in -dimensional space. The theorem says that this point almost certainly lands in a region of volume about , and that no smaller region captures most of the probability.

Inside the space of all sequences, a small region called the typical set holds almost all the probability. Its volume is about 2 to the n h, the same as a cube with side 2 to the h.

A cube in dimensions with volume has side length . This gives the cleanest reading of differential entropy:

is the side length, per coordinate, of the smallest box that contains most of the probability.

Low entropy means the variable is confined to a small effective volume. High entropy means it is widely dispersed. The discrete and continuous pictures match:

DiscreteContinuous
Where long sequences liveabout typical sequencesa region of volume about
Per symbol = effective number of values = effective width

4. Several Variables and the Multivariate Gaussian

4.1 Joint and conditional differential entropy

The definitions carry over from the discrete case with integrals in place of sums.

  • Joint: , for variables with joint density .
  • Conditional: , where is the density of once is known.

They are related as before: . In words, the uncertainty left in after learning is the joint uncertainty minus the uncertainty of .

4.2 Entropy of a multivariate Gaussian

Several Gaussian variables are described together by a covariance matrix . Its entry says how and vary together. The diagonal entries are the variances. The determinant is a single number computed from the matrix. Geometrically, is proportional to the volume of the cloud of points that the variables form.

Theorem (entropy of a multivariate normal). If are jointly Gaussian with covariance matrix , then

What it means. This is the one-dimensional formula with the variance replaced by the determinant. The entropy is again the logarithm of a volume: the volume of the ellipsoid in which the Gaussian vector lives.

Correlation shrinks that volume. For two variables with variance each and correlation ,

When the cloud is a round disc and . As the cloud flattens onto a line, , and the joint entropy goes to . Two variables that move together are, jointly, much less uncertain than two independent ones.

Three clouds of points for correlation 0, 0.6 and 0.95. The cloud flattens toward a line and the joint entropy drops from 4.09 to 3.77 to 2.42 bits.


5. Relative Entropy and Mutual Information

5.1 Definitions

Definition. The relative entropy between two densities and is The mutual information between and with joint density is

As in the discrete case,

5.2 Why these two are better behaved than

Section 2 showed that is entropy with an accuracy term removed. Mutual information is a difference of two entropies, and when we quantize, the accuracy term appears in both and cancels:

What it means. Mutual information for continuous variables is the limit of the mutual information between their quantized versions. It is a true number of bits, with no hidden offset. All the oddities of disappear:

Differential entropy Relative entropy and mutual information
Signcan be negativenever negative
Change of units (meters to centimeters)changesunchanged
Meaningrelative: bits compared with a unit-width uniformabsolute: actual bits

This is the reason the continuous theory works at all. Channel capacity is a mutual information, so it keeps its meaning for channels with continuous inputs, outputs and noise.

The general definition

The book takes this one step further and defines mutual information for any pair of random variables as the largest value obtained over all ways of quantizing them, . This single definition covers discrete variables, continuous variables, and mixtures of both, such as a discrete input with a continuous output (Problem 3 below).

5.3 Example: correlated Gaussians

Result. If and are jointly Gaussian with correlation coefficient , then

The correlation coefficient is a number between and that measures how closely the two variables follow a straight-line relationship.

The curve I = -1/2 log(1 - rho squared) against the correlation rho. It is 0 at rho = 0 and goes to infinity as rho approaches 1.

What it means.

  • The answer depends only on . The variances have dropped out, as expected: rescaling or changes units, and mutual information does not care about units.
  • At the variables are independent and share bits.
  • As the mutual information grows without bound. If determines exactly, then knowing reveals all the infinitely many digits of . This cannot happen for discrete variables, where is finite.

HW5 Problem 4: Gaussian mutual information (book Problem 8.9)

Suppose that are jointly Gaussian and that forms a Markov chain. Let and have correlation coefficient and let and have correlation coefficient . Find .


6. Properties

Most properties of entropy survive the move to continuous variables. A few do not. This section sorts them.

6.1 What stays the same

Theorem. For densities,

  1. , with equality only when (almost everywhere).
  2. , with equality only when and are independent.
  3. , with equality only when and are independent.
  4. Chain rule: .
  5. Independence bound: , with equality only when the are independent.

What it means. These are the same statements as for discrete variables, and they mean the same things.

  • (1) Two different densities are always a positive “distance” apart.
  • (2) and (3) Knowing can never make us more uncertain about on average. Conditioning reduces entropy.
  • (4) The uncertainty of a group can be added up one variable at a time, each given the ones before it.
  • (5) Dependence between variables can only reduce their joint uncertainty.

6.2 What is different: shifting and scaling

Theorem.

  • Translation: for any constant .
  • Scaling: for any constant .
  • Vectors: for any invertible matrix .

What it means.

  • Translation. Moving a distribution along the line does not change its spread, so the entropy is unchanged. This is why the entropy of a Gaussian does not depend on its mean.
  • Scaling. Stretching a distribution by a factor makes it times wider, which adds bits. The uniform examples of Section 1.2 showed exactly this: twice the width, one more bit.

Left: a bell curve moved sideways has the same entropy. Right: a bell curve stretched to twice the width has one more bit of entropy.

The scaling rule is the main trap. Discrete entropy does not change when we relabel the values: . Differential entropy does change: . It follows that depends on the units of measurement. A length measured in centimeters has bits more differential entropy than the same length measured in meters. No information was gained by switching units. The number changed because is measured relative to “one unit of width”, and the unit changed.

Mutual information is safe: , because the appears in both and and cancels.


7. The Gaussian Has the Largest Entropy

This is the most used result of the chapter.

Theorem (maximum entropy). Let be any random variable with variance . Then with equality only when is Gaussian. More generally, if a random vector has covariance matrix , then , with equality only when .

A uniform, a Laplace and a Gaussian density with the same variance. Their differential entropies are 1.79, 1.94 and 2.05 bits.

What it means. Fix the variance, which fixes the average “power” or spread of a variable. Among all the densities with that variance, the bell curve is the most random one. Any other shape with the same variance, whether flat-topped, peaked or lopsided, has more structure and is cheaper to describe.

Two consequences explain why Gaussians are everywhere in communication theory.

  • Gaussian noise is the worst noise. For a given noise power, Gaussian noise has the most entropy, so it destroys the most information. A system designed for Gaussian noise is designed for the worst case.
  • Gaussian signals carry the most. For a given signal power, a Gaussian output has the largest entropy. This is why the best input to a channel with Gaussian noise is itself Gaussian. The capacity formula of the Gaussian channel (Chapter 9 of the book) comes straight from this theorem.

What is being maximized depends on the constraint. With a different constraint, a different distribution wins.

ConstraintMaximum-entropy distributionIts entropy
Fixed variance Gaussian
Values confined to an interval of width Uniform

HW5 Problem 2: Concavity of determinants (book Problem 8.2)

Let and be two symmetric nonnegative definite matrices. Prove the following result: where denotes the determinant of .

Hint: Let , where , and = Bernoulli(). Then use .

HW5 Problem 3: Channel with uniformly distributed noise (book Problem 8.8)

Consider an additive channel whose input alphabet is , and whose output is , where is uniformly distributed over the interval . Thus the input of the channel is a discrete random variable, while the output is continuous. Calculate the capacity of this channel.

Inputs -2, 0 and 2 produce outputs in the intervals -3 to -1, -1 to 1 and 1 to 3, which do not overlap. Inputs -1 and 1 are not used.

The answer has the same explanation as the noisy typewriter in the channel capacity note. Each input is smeared over an interval of width . Inputs that are apart produce outputs that never overlap, so the receiver can always tell them apart. Three such inputs fit, which gives bits with no errors at all. The inputs would overlap with their neighbours, and the best strategy is to leave them unused.


8. Entropy Limits How Well We Can Estimate

Fano’s inequality said that if a discrete variable has a lot of entropy left after observing something, then it cannot be guessed reliably. The continuous version replaces “probability of a wrong guess” with mean squared error: the average of the squared distance between and our estimate , written .

Theorem (estimation error and differential entropy). For any random variable and any estimate , with in nats, with equality only if is Gaussian and is its mean. If the estimate may use side information , the same holds with in place of :

What it means. The more differential entropy a variable has, the larger the error of any estimate of it must be. Entropy sets a floor under the squared error that no cleverness can get below.

The right-hand side, , has a simple interpretation. It is the variance of the Gaussian that has the same entropy as . For a Gaussian it equals exactly, and the bound says the obvious: guessing the mean leaves an error of . For any other distribution it is smaller than the variance.

With side information, the bound says that helps us estimate only as much as it lowers the remaining entropy . Each bit of mutual information between and can lower the floor on the squared error by at most a factor of four.


Summary

ConceptStatement
Differential entropy. Measures spread: is the effective width.
Uniform, width . Negative when .
Gaussian, variance
Multivariate Gaussian
Quantization: accuracy cost plus
AEPLong sequences fill a volume of about
Mutual information. A true number of bits, unaffected by units.
Correlated Gaussians
Same as discrete, conditioning reduces entropy, chain rule, independence bound
Different from discrete can be negative;
Maximum entropyFor fixed variance, the Gaussian has the largest
Estimation

The main ideas in one paragraph: a continuous variable needs infinitely many bits to describe exactly, so we separate the cost of accuracy from the cost of the distribution. The second part is the differential entropy, the logarithm of the effective width. It can be negative and it depends on units, so it is not an amount of information by itself. Differences of differential entropies are well behaved: mutual information is a true number of bits. For a fixed variance the Gaussian is the most spread out distribution, which is why it is both the hardest noise to fight and the best signal to send.

The book closes the chapter with three parallel statements that tie the notes together:

  • is the effective alphabet size of a discrete random variable.
  • is the effective width of the support of a continuous random variable.
  • is the effective alphabet size of a channel of capacity .