Table of Contents
- 1. entropy for dummies
- 2. intuition for conditional entropy and its definition and properties
- 3. entropy of continuous probability distribution
- 4. for students of ergodic theory (optional reading)
- 5. using properties of entropy in proofs
- 6. exercises
This post has two goals:
- use a hypothetical town with curious residents to give some intuitive understanding of the notion of entropy (of finite partitions or of discrete random variables).
- give some examples of using well known intuitive properties of entropy to prove some less trivial facts about entropy rather than directly using the definition.
Also, while this post is not about ergodic theory and ergodic theory (and measure theory) is not a requirement for most of this post, I include a section for helping students of ergodic theory see how probability theory intuitions can help guide them.
This is not about entropy in thermodynamics (in physics), but about entropy in information theory (in mathematics). (but the two are related).
Notion of the metric entropy of a dynamical system and differential entropy of a continuous probability distribution is also briefly discussed. The notion of entropy rate of a process too.
1. entropy for dummies
1.1. definition of entropy of r.v. and joint entropy
You probably heard that the entropy of a discrete random variable with distinct outcomes is defined as
where is the probability of the event . The RHS is sometimes denoted as . You might be wondering, how can we make sense of that entropy formula intuitively? You might have heard that it quantifies the amount of uncertainty for outcome of and might be wondering why quantify in this specific way among other possible ways.
Also, given two discrete random variables and , the joint entropy of and together is defined similarly as
where is the probability of the event and provided that is the range of values that can take, i.e., is simply the Cartesian product of the range of and the range of . In other words, the joint entropy of and is just the entropy of the (joint) random variable . The joint entropy of more than two random variables is defined similarly.
Some graphs that might help:
1.2. the town
Let me give you a (possibly flawed in some way) story that will demonstrate the intuition behind entropy. It will also demonstrate the main properties of entropy, that is, the main properties will become intuitively plausible results, after you read this story, rather than just being results that follows from calculation.
Imagine a town where very curious residents live. Each month, the mayor of this town throws ten fair coins to generate a random binary sequence of length 10. So we have 10 binary random variables: . Value of is if the ‘th coin landed on heads, and otherwise. We also have other interesting random variables like or or , etc.
Each month, the mayor generates a random sequence of length 10 and then reveals the outcome to Bob who is an employee of the town’s local government. Alice, another employee, sells various tickets for accessing total or partial information about the sequence. Here is how these tickets are supposed to be used: if you are a resident of this town and you want to know the value of this month (because you are curios), you can buy from Alice a ticket that has the following statement written on it: “If you give this ticket to Bob, Bob is required to tell you the value of .” That is, you visit Bob’s office and give him the ticket and you get the information in return. Now what is a good price for this ticket? How much would you pay to know the value of ?
Suppose the price of a ticket for is one dollar, i.e., you can pay one dollar (to Alice or others) to get a ticket that has the following statement on it: “If you give this ticket to Bob, Bob is required to tell you the value of ”. It’s pretty obvious that the price of a ticket for should be one dollar as well. It is also obvious that the price of a ticket for knowing should be five dollars.
Not interesting so far, but how about this random variable. We define the random variable to have value 5 if , and 6 if , and 7 if . So has probability of being 5, and probability of being 6, and of being 7. What is the right price of a ticket for ? The right price is dollars. That is because there’s this alternative way of knowing : you can first buy a ticket for and then you give the ticket to Bob to be informed of the value of , and if you learn that is 1, you then buy a ticket for and visit Bob again. This alternative way of knowing costs dollars on average. You might say “you convinced me that the prize for a ticket for should be . Now convince me that it should be .” I have to say that right now I don’t have any satisfying argument to convince you that, except to say that the alternative way of knowing seems efficient and it feels like the way cannot be further improved to reduce average cost.
What about the cost of a ticket for . If you buy a ticket for , which we will assume to cost dollars, and another ticket for (also costing dollars), then you get to learn the value of after visiting Bob. Therefore the price of a ticket for should be (otherwise, you could create a business where each month you buy one ticket for and one ticket for from others and spend the two tickets at Bob to learn the value of and then sell that information to others with the price of a ticket for , and profit. To be more complete, maybe we should assume that the residents of the town are law abiding citizens and there is a law that bans selling any information (about the binary sequence) twice. Maybe residents are required to erase from their memory any information they sell to or hand over to others. Maybe there are other patch ups needed but let’s stop for now. I told you this is a flawed story.)
1.3. intuition for entropy and its properties
One way of justifying the formula in the definition of entropy is to think of it as the only formula that guarantees many plausible properties of entropy that you expect.
For a (discrete) random variable , think of as proportional to the ideal price for a ticket for . The conversion factor is per dollar. We normalize things so that the entropy of a fair coin is (i.e. one dollar). I won’t go into a proof of this, but it is known that there is only one formula for that guarantees the following properties:
(triangle inequality for entropy) for any two discrete random variables
(continuity) each is a continuous function
Remember the ticket which cost dollars? The argument for its price gives an intuitive meaning to the decomposition property. Remember the ticket that cost dollars? That gives some intuitive sense for the triangle inequality for entropy. The entropy formula also guarantees the following additional properties:
(entropy of equidistribution)
(upper bound) If can have outcomes, then with equality if and only if is equidistributed.
(w.r.t. independence) if and only if and are independent.
(monotonicity) if value of determines value of , i.e., if is a function of . (Note that this is same as saying for all discrete random variables and )
Having listed all these properties, some understanding emerges: is best thought of as the additive amount of uncertainty in .
1.4. intuition for the notion of surprisal
A more direct way to have some intuitive sense of the entropy formula for is to think of it as the average amount of information you gain upon hearing the value of . For that, we need to quantify the amount of information you gain for hearing, for example, that the value of turned out to be 1, i.e., that the event occurred.
If is an event, the surprisal of is defined as where is the probability of the event . This quantifies the amount of information (and the amount of surprise) for knowing that occurred. This quantity has a nice additive property, but to see that, we need to define conditional surprisal first. If are events, the conditional surprise of given is defined as where is the conditional probability of given . This quantifies the amount of information someone already knowing happened gains upon hearing that too happened.
The additive property is this: at first, you knew nothing about the value of the binary sequence (hence, you had zero amount of information as to what the value of the random binary sequence was), and then you heard that some event occurred. For example, the event could be something like . By hearing that news, you gained bits of information about the sequence. And then you heard another news (another event). Upon hearing this news, you gained bits of information. In total you must have gained bits of information. Does the following equality actually hold?
Yes, it does. That in turn justifies the formula for surprisal.
Back to the definition of . It is easy to work out that the entropy formula defines to be the average amount of information you gain upon hearing the value of . This should be an easy exercise (left to the readers).
2. intuition for conditional entropy and its definition and properties
The theory of entropy is not complete without the notion of conditional entropy. For two (discrete) random variables and , the conditional entropy of given is denoted by and is defined to be the average conditional surprisal for hearing the value of when one already knows the value of . This quantifies the amount of uncertainty that someone knowing the value of has about . Writing down the formula for conditional entropy is left to the readers. Conditional entropy satisfies following properties:
(positivity) , with equality if and only if is a function of
(upper bound from unconditioning) , with equality if and only if and are independent (you can also think of this inequality as giving a lower bound for )
Intuition for chain rule is that learning the value of can be done in two steps: learn the value of , and then learn the value of . Compare this rule with the additive property of surprisal.
The chain rule can also be thought of as a way to express conditional entropy in terms of unconditional entropy: . There is another way to do that: where the sum runs over the range of and (which is called specific conditional entropy) is the entropy for conditional probability distribution of given the event . With this in mind, now note that the chain rule can be thought of as an encapsulation of the repeated application of the decomposition property of entropy.
(chain rule 2) (where is defined to be )
(monotonicity) (Try to work out equality conditions for and and you will get two more interesting properties.1)
(monotonicity 2) when is a function of .
3. entropy of continuous probability distribution
Visit Wikipedia article on differential entropy to see its definition. Here is something that may hook your interest in differential entropy: many probability distributions you may know such as uniform distribution, normal distribution, exponential distribution, geometric distribution, can be characterized as distributions that maximize entropy under certain constraints. For the math-savvy, “Probability distributions and maximum entropy” by Keith Conrad is a good start. As for why and how maximum entropy distributions tend to show up in nature (for example, Maxwell–Boltzmann distribution), perhaps statistical mechanics textbooks have some answers, but not my area of expertise.
3.1. some intuition for differential entropy
Its translation invariance embodies the intuition that knowing that some value is between 1.0 and 1.1 is same amount of information as knowing some value is between 10.0 and 10.1.
The way differential entropy responds to scaling of continuous random variables embodies the intuition that knowing that some value is between 0 and 0.1 is one bit more information than knowing that some value is between 0 and 0.2.
4. for students of ergodic theory (optional reading)
4.1. entropy of a partition
If you are learning ergodic theory, you will at point or have learned that when is a (measurable, finite) partition (of a probability space ), its entropy is defined to be where are elements of . If we use to denote the random variable defined as iff , then we have . A trivial equality but it really helps to think of the entropy of a partition as the entropy of its corresponding random variable so that you are encouraged to use probabilistic intuitions when you are, for example, solving some relevant exercises from your ergodic theory textbook.
Side note: Another good way of defining is to define to be the element of containing . This way has the benefit of not having to specify an ordering of elements of . Another benefit is you feel more confident in using the useful abuse of notation that is writing in place of .
Further observations on correspondence between partitions and random variables: If are two partitions, corresponds to the random variable . The partition is finer than if and only if is a function of . Given a map and , the shifted partition corresponds to the shifted random variable . Entropy of the join of two partitions corresponds to joint entropy of random variables: .
These trivial observations combine together and lead to the following non-trivial insight: The pairing of a dynamical system and a partition gives rise to the stationary process . Conversely, any (discrete-valued) stationary process gives rise to an invariant measure on a shift space in the obvious way. One could say that (discrete stationary) stochastic processes are to dynamical systems what matrices are to (finite-dimensional) linear operators and a generating partition is to a basis (in linear algebra). With this insight, on can also say that the notion of metric entropy in ergodic theory and the notion of entropy rate in probability theory are interchangeable notions in that the metric entropy of a (measure theoretic) dynamical system w.r.t a partition corresponds to average entropy for its corresponding stochastic process (entropy rate).
4.2. comparison between metric entropy and differential entropy
For those who are learning about metric entropy or differential entropy, let’s list some differences for purpose of notes.
While differential entropy concerns continuous probability distributions (on the n-dimensional space), metric entropy concerns fractal-like probability distributions from stochastic processes or invariant measures on a dynamical system. Differential entropy can be negative while metric entropy cannot be. Metric entropy can be described as a conditional entropy, but I am not sure if differential entropy can be too.
As for how they react to forming a convex combination of two probability distributions, the map from continuous probability distributions to their differential entropy is a concave map, but the map from stationary processes or invariant measures (on a system) to their metric entropy is an affine map.
5. using properties of entropy in proofs
5.1. if two random variables are close to each other, then how much are their entropies close to each other?
Let’s say are two random variables with range and that we have . Now we want to find a good enough upper bound for , i.e., we want to prove an inequality of the form . We will choose what is later, but for now notice that in order to prove such inequality, we only need show (E10) (and ). As I said earlier, we would like to prove this without directly using the definition of entropy.
To prove E10, we only need to build a random variable with (E20) and . To establish E20, it is enough to build so that knowing and together enables one to know . So we want to provide just enough missing information to guess from . A way to build now emerges. We define as on the event , and on the event where is any fixed value distinct from the range of . Easy to see that value of can be determined from value of and , hence E20 holds. Now it only remains to give a reasonable upper bound on in terms of and . Let be just a binary random variable corresponding to distinguishing whether or not. Then is less than or equal to (if ) which we now decide to be our .
5.2. entropy with respect to convex combination
(only for students of ergodic theory)
Given two invariant probability measures on and its convex combination (where ), we wish to prove the following two facts.
(Fact 1) , i.e., is concave with respect to measures.
(Fact 2) (if you know metric entropy) , i.e., the metric entropy map is an affine map (with respect to measures).
Above two facts follow easily from this Fact 3: the difference (E30) is in .
We want to prove Fact 3 using only basic properties of entropy. How can we employ probabilistic intuition to guide us to find such a proof? The expression hints at conditioning on some event with probability to get to and on the complement event (with probability ) to get to . The probability space where this conditioning happens will have to be bigger than because it does not make sense to equate a subset of with the event. The expression E30 involves three terms with three different measures and one shared partition. To rephrase this expression in a probabilistic context, remember that the final expression will have to consist of terms with different random variables (different partitions) living on some shared sample space (one shared measure).
The shared sample space will be a weighted disjoint union of of and (weights being ). To form the disjoint union, we form a copy (for each ) of , and then form the union where the partition is defined to be the one that corresponds to the random variable (also denoted to abuse notation) defined by where is the partition of corresponding to the binary random variable assigning to and where as a random variable has the same range as .
E30 is then equal to which is equal to which is in which is equal to .
All of the exercises here can be and should be solved by just using properties of entropy listed in this post instead of directly invoking the entropy formula.
Exercise 10. (useful upper bound) Suppose you have a (discrete) random variable that you want to obtain a good upper bound for its entropy. Suppose you manage to find two random variables that together determines , i.e., is a function of . This gives the upper bound: (prove it).
Exercise 15. (useful upper bound 2) Suppose you have a (discrete) random variable that you want to obtain a good upper bound for its entropy. Suppose you manage to find some other random variable such that or is easy to estimate. This gives the upper bound (prove it).
Exercise 20. (useful lower bound) Prove
Exercise 30. Prove for . (Introduce auxiliary random variables to prove it)
Exercise 40. Show .
Exercise 50. (only for students of ergodic theory) Given a measure preserving transformation on a Lebesgue space with positive entropy, and given a positive number less than the positive entropy, show that the system has a factor system with its entropy equal to the given positive number. Should we assume the system has no atoms?
Properties related to the notion of conditional independence.