# Conditional entropy

Venn diagram for various information measures associated with correlated variables X and Y. The area contained by both circles is the joint entropy H(X,Y). The circle on the left (red and violet) is the individual entropy H(X), with the red being the conditional entropy H(X|Y). The circle on the right (blue and violet) is H(Y), with the blue being H(Y|X). The violet is the mutual information I(X;Y).

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

## DefinitionEdit

If ${\displaystyle H(Y|X=x)}$  is the entropy of the discrete random variable ${\displaystyle Y}$  conditioned on the discrete random variable ${\displaystyle X}$  taking a certain value ${\displaystyle x}$ , then ${\displaystyle H(Y|X)}$  is the result of averaging ${\displaystyle H(Y|X=x)}$  over all possible values ${\displaystyle x}$  that ${\displaystyle X}$  may take.

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

{\displaystyle {\begin{aligned}H(Y|X)\ &\equiv \sum _{x\in {\mathcal {X}}}\,p(x)\,H(Y|X=x)\\&=-\sum _{x\in {\mathcal {X}}}p(x)\sum _{y\in {\mathcal {Y}}}\,p(y|x)\,\log \,p(y|x)\\&=-\sum _{x\in {\mathcal {X}}}\sum _{y\in {\mathcal {Y}}}\,p(x,y)\,\log \,p(y|x)\\&=-\sum _{x\in {\mathcal {X}},y\in {\mathcal {Y}}}p(x,y)\log \,p(y|x)\\&=-\sum _{x\in {\mathcal {X}},y\in {\mathcal {Y}}}p(x,y)\log {\frac {p(x,y)}{p(x)}}.\\&=\sum _{x\in {\mathcal {X}},y\in {\mathcal {Y}}}p(x,y)\log {\frac {p(x)}{p(x,y)}}.\\\end{aligned}}}

Note: It is understood that the expressions 0 log 0 and 0 log (c/0) for fixed c>0 should be treated as being equal to zero.

## PropertiesEdit

### Conditional entropy equals zeroEdit

${\displaystyle H(Y|X)=0}$  if and only if the value of ${\displaystyle Y}$  is completely determined by the value of ${\displaystyle X}$ .

### Conditional entropy of independent random variablesEdit

Conversely, ${\displaystyle H(Y|X)=H(Y)}$  if and only if ${\displaystyle Y}$  and ${\displaystyle X}$  are independent random variables.

### Chain ruleEdit

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

${\displaystyle H(Y|X)\,=\,H(X,Y)-H(X).}$

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

{\displaystyle {\begin{aligned}H(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,y))+\sum _{x\in {\mathcal {X}},y\in {\mathcal {Y}}}p(x,y)\log(p(x))\\[4pt]&=H(X,Y)+\sum _{x\in {\mathcal {X}}}p(x)\log(p(x))\\[4pt]&=H(X,Y)-H(X).\end{aligned}}}

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

${\displaystyle H(X_{1},X_{2},\ldots ,X_{n})=\sum _{i=1}^{n}H(X_{i}|X_{1},\ldots ,X_{i-1})}$

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

### Bayes' ruleEdit

Bayes' rule for conditional entropy states

${\displaystyle H(Y|X)\,=\,H(X|Y)-H(X)+H(Y)\,.}$

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

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

${\displaystyle H(Y|X,Z)\,=\,H(Y|X).}$

### Other propertiesEdit

For any ${\displaystyle X}$  and ${\displaystyle Y}$ :

{\displaystyle {\begin{aligned}H(Y|X)&\leq H(Y)\,\\H(X,Y)&=H(X|Y)+H(Y|X)+I(X;Y),\qquad \\H(X,Y)&=H(X)+H(Y)-I(X;Y),\,\\I(X;Y)&\leq H(X),\,\end{aligned}}}

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

For independent ${\displaystyle X}$  and ${\displaystyle Y}$ :

${\displaystyle H(Y|X)=H(Y){\text{ and }}H(X|Y)=H(X)\,}$

Although the specific-conditional entropy, ${\displaystyle H(X|Y=y)}$ , can be either less or greater than ${\displaystyle H(X)}$ , ${\displaystyle H(X|Y)}$  can never exceed ${\displaystyle H(X)}$ .

## Conditional differential entropyEdit

### DefinitionEdit

The above definition is for discrete random variables and no more valid in the case of continuous random variables. The continuous version of discrete conditional entropy is called conditional differential (or continuous) entropy. Let ${\displaystyle X}$  and ${\displaystyle Y}$  be a continuous random variables with a joint probability density function ${\displaystyle f(x,y)}$ . The differential conditional entropy ${\displaystyle h(X|Y)}$  is defined as

${\displaystyle h(X|Y)=-\int _{{\mathcal {X}},{\mathcal {Y}}}f(x,y)\log f(x|y)\,dxdy}$ .

### PropertiesEdit

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:

${\displaystyle 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 mutal information between continuous random variables:

${\displaystyle I(X,Y)=h(X)-h(X|Y)=h(Y)-h(Y|X)}$

### Relation to estimator errorEdit

The conditional differential entropy yields a lower bound on the expected squared error of an estimator. For any random variable ${\displaystyle X}$ , observation ${\displaystyle Y}$  and estimator ${\displaystyle {\widehat {X}}}$  the following holds:[1]

${\displaystyle \operatorname {E} [(X-{\widehat {X}}(Y))^{2}]\geq {\frac {1}{2\pi e}}e^{2h(X|Y)}}$

## Generalization to quantum theoryEdit

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