Conditional entropy



In information theory, the conditional entropy quantifies the amount of information needed to describe the outcome of a random variable $$Y$$ given that the value of another random variable $$X$$ is known. Here, information is measured in shannons, nats, or hartleys. The entropy of $$Y$$ conditioned on $$X$$ is written as $$\Eta(Y|X)$$.

Definition
The conditional entropy of $$Y$$ given $$X$$ is defined as

where $$\mathcal X$$ and $$\mathcal Y$$ denote the support sets of $$X$$ and $$Y$$.

Note: Here, the convention is that the expression $$0 \log 0$$ should be treated as being equal to zero. This is because $$\lim_{\theta\to0^+} \theta\, \log \theta = 0$$.

Intuitively, notice that by definition of expected value and of conditional probability, $$\displaystyle H(Y|X) $$ can be written as $$ H(Y|X) = \mathbb{E}[f(X,Y)]$$, where $$ f $$ is defined as $$\displaystyle f(x,y) := -\log\left(\frac{p(x, y)}{p(x)}\right) = -\log(p(y|x))$$. One can think of $$\displaystyle f$$ as associating each pair $$\displaystyle (x, y)$$ with a quantity measuring the information content of $$\displaystyle (Y=y)$$ given $$\displaystyle (X=x)$$. This quantity is directly related to the amount of information needed to describe the event $$\displaystyle (Y=y)$$ given $$(X=x)$$. Hence by computing the expected value of $$\displaystyle f $$ over all pairs of values $$(x, y) \in \mathcal{X} \times \mathcal{Y}$$, the conditional entropy $$\displaystyle H(Y|X)$$ measures how much information, on average, the variable $$ X $$ encodes about $$ Y $$.

Motivation
Let $$\Eta(Y|X=x)$$ be the entropy of the discrete random variable $$Y$$ conditioned on the discrete random variable $$X$$ taking a certain value $$x$$. Denote the support sets of $$X$$ and $$Y$$ by $$\mathcal X$$ and $$\mathcal Y$$. Let $$Y$$ have probability mass function $$p_Y{(y)}$$. The unconditional entropy of $$Y$$ is calculated as $$\Eta(Y) := \mathbb{E}[\operatorname{I}(Y)]$$, i.e.


 * $$\Eta(Y) = \sum_{y\in\mathcal Y} {\mathrm{Pr}(Y=y)\,\mathrm{I}(y)}

= -\sum_{y\in\mathcal Y} {p_Y(y) \log_2{p_Y(y)}},$$

where $$\operatorname{I}(y_i)$$ is the information content of the outcome of $$Y$$ taking the value $$y_i$$. The entropy of $$Y$$ conditioned on $$X$$ taking the value $$x$$ is defined analogously by conditional expectation:


 * $$\Eta(Y|X=x)

= -\sum_{y\in\mathcal Y} {\Pr(Y = y|X=x) \log_2{\Pr(Y = y|X=x)}}.$$ Note that $$\Eta(Y|X)$$ is the result of averaging $$\Eta(Y|X=x)$$ over all possible values $$x$$ that $$X$$ may take. Also, if the above sum is taken over a sample $$y_1, \dots, y_n$$, the expected value $$E_X[ \Eta(y_1, \dots, y_n \mid X = x)]$$ is known in some domains as .

Given discrete random variables $$X$$ with image $$\mathcal X$$ and $$Y$$ with image $$\mathcal Y$$, the conditional entropy of $$Y$$ given $$X$$ is defined as the weighted sum of $$\Eta(Y|X=x)$$ for each possible value of $$x$$, using $$p(x)$$ as the weights:

\begin{align} \Eta(Y|X)\ &\equiv \sum_{x\in\mathcal X}\,p(x)\,\Eta(Y|X=x)\\ & =-\sum_{x\in\mathcal X} p(x)\sum_{y\in\mathcal Y}\,p(y|x)\,\log_2\, p(y|x)\\ & =-\sum_{x\in\mathcal X, y\in\mathcal Y}\,p(x)p(y|x)\,\log_2\,p(y|x)\\ & =-\sum_{x\in\mathcal X, y\in\mathcal Y}p(x,y)\log_2 \frac {p(x,y)} {p(x)}. \end{align} $$

Conditional entropy equals zero
$$\Eta(Y|X)=0$$ if and only if the value of $$Y$$ is completely determined by the value of $$X$$.

Conditional entropy of independent random variables
Conversely, $$\Eta(Y|X) = \Eta(Y)$$ if and only if $$Y$$ and $$X$$ are independent random variables.

Chain rule
Assume that the combined system determined by two random variables $$X$$ and $$Y$$ has joint entropy $$\Eta(X,Y)$$, that is, we need $$\Eta(X,Y)$$ bits of information on average to describe its exact state. Now if we first learn the value of $$X$$, we have gained $$\Eta(X)$$ bits of information. Once $$X$$ is known, we only need $$\Eta(X,Y)-\Eta(X)$$ bits to describe the state of the whole system. This quantity is exactly $$\Eta(Y|X)$$, which gives the chain rule of conditional entropy:


 * $$\Eta(Y|X)\, = \, \Eta(X,Y)- \Eta(X).$$

The chain rule follows from the above definition of conditional entropy:


 * $$\begin{align}

\Eta(Y|X) &= \sum_{x\in\mathcal X, y\in\mathcal Y}p(x,y)\log \left(\frac{p(x)}{p(x,y)} \right) \\[4pt] &= \sum_{x\in\mathcal X, y\in\mathcal Y}p(x,y)(\log (p(x)) - \log (p(x,y))) \\[4pt] &= -\sum_{x\in\mathcal X, y\in\mathcal Y}p(x,y)\log (p(x,y)) + \sum_{x\in\mathcal X, y\in\mathcal Y}{p(x,y)\log(p(x))} \\[4pt] & = \Eta(X,Y) + \sum_{x \in \mathcal X} p(x)\log (p(x) ) \\[4pt] & = \Eta(X,Y) - \Eta(X). \end{align}$$

In general, a chain rule for multiple random variables holds:


 * $$ \Eta(X_1,X_2,\ldots,X_n) =

\sum_{i=1}^n \Eta(X_i | X_1, \ldots, X_{i-1}) $$

It has a similar form to chain rule in probability theory, except that addition instead of multiplication is used.

Bayes' rule
Bayes' rule for conditional entropy states
 * $$\Eta(Y|X) \,=\, \Eta(X|Y) - \Eta(X) + \Eta(Y).$$

Proof. $$\Eta(Y|X) = \Eta(X,Y) - \Eta(X)$$ and $$\Eta(X|Y) = \Eta(Y,X) - \Eta(Y)$$. Symmetry entails $$\Eta(X,Y) = \Eta(Y,X)$$. Subtracting the two equations implies Bayes' rule.

If $$Y$$ is conditionally independent of $$Z$$ given $$X$$ we have:


 * $$\Eta(Y|X,Z) \,=\, \Eta(Y|X).$$

Other properties
For any $$X$$ and $$Y$$:
 * $$\begin{align}

\Eta(Y|X) &\le \Eta(Y) \, \\ \Eta(X,Y) &= \Eta(X|Y) + \Eta(Y|X) + \operatorname{I}(X;Y),\qquad \\ \Eta(X,Y) &= \Eta(X) + \Eta(Y) - \operatorname{I}(X;Y),\, \\ \operatorname{I}(X;Y) &\le \Eta(X),\, \end{align}$$

where $$\operatorname{I}(X;Y)$$ is the mutual information between $$X$$ and $$Y$$.

For independent $$X$$ and $$Y$$:


 * $$\Eta(Y|X) = \Eta(Y) $$ and $$\Eta(X|Y) = \Eta(X) \, $$

Although the specific-conditional entropy $$\Eta(X|Y=y)$$ can be either less or greater than $$\Eta(X)$$ for a given random variate $$y$$ of $$Y$$, $$\Eta(X|Y)$$ can never exceed $$\Eta(X)$$.

Definition
The above definition is for discrete random variables. The continuous version of discrete conditional entropy is called conditional differential (or continuous) entropy. Let $$X$$ and $$Y$$ be a continuous random variables with a joint probability density function $$f(x,y)$$. The differential conditional entropy $$h(X|Y)$$ is defined as

Properties
In contrast to the conditional entropy for discrete random variables, the conditional differential entropy may be negative.

As in the discrete case there is a chain rule for differential entropy:
 * $$h(Y|X)\,=\,h(X,Y)-h(X)$$

Notice however that this rule may not be true if the involved differential entropies do not exist or are infinite.

Joint differential entropy is also used in the definition of the mutual information between continuous random variables:
 * $$\operatorname{I}(X,Y)=h(X)-h(X|Y)=h(Y)-h(Y|X)$$

$$h(X|Y) \le h(X)$$ with equality if and only if $$X$$ and $$Y$$ are independent.

Relation to estimator error
The conditional differential entropy yields a lower bound on the expected squared error of an estimator. For any random variable $$X$$, observation $$Y$$ and estimator $$\widehat{X}$$ the following holds:
 * $$\mathbb{E}\left[\bigl(X - \widehat{X}{(Y)}\bigr)^2\right]

\ge \frac{1}{2\pi e}e^{2h(X|Y)}$$

This is related to the uncertainty principle from quantum mechanics.

Generalization to quantum theory
In quantum information theory, the conditional entropy is generalized to the conditional quantum entropy. The latter can take negative values, unlike its classical counterpart.