# Conditional entropy

Individual (H(X),H(Y)), joint (H(X,Y)), and conditional entropies for a pair of correlated subsystems X,Y with 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)}$.

## Definition

If ${\displaystyle H(Y|X=x)}$ is the entropy of the variable ${\displaystyle Y}$ conditioned on the 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 domain ${\displaystyle {\mathcal {X}}}$ and ${\displaystyle Y}$ with domain ${\displaystyle {\mathcal {Y}}}$, the conditional entropy of ${\displaystyle Y}$ given ${\displaystyle X}$ is defined as:[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.

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

## Chain rule

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 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 H(Y|X)=\sum _{x\in {\mathcal {X}},y\in {\mathcal {Y}}}p(x,y)\log {\frac {p(x)}{p(x,y)}}}$
${\displaystyle =-\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)}$
${\displaystyle =H(X,Y)+\sum _{x\in {\mathcal {X}}}p(x)\log \,p(x)}$
${\displaystyle =H(X,Y)-H(X).}$

## Bayes' rule

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 implies ${\displaystyle H(X,Y)=H(Y,X)}$. Subtracting the two equations implies Bayes' rule. QED.

## 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. Bayes' rule does not hold for conditional quantum entropy, since ${\displaystyle H(X,Y)\neq H(Y,X)}$.{{ safesubst:#invoke:Unsubst||date=__DATE__ |\$B= {{#invoke:Category handler|main}}{{#invoke:Category handler|main}}[citation needed] }}

## Other properties

${\displaystyle H(Y|X)\leq H(Y)\,}$
${\displaystyle H(X,Y)=H(X|Y)+H(Y|X)+I(X;Y),\qquad }$
${\displaystyle H(X,Y)=H(X)+H(Y)-I(X;Y),\,}$
${\displaystyle I(X;Y)\leq H(X),\,}$

where ${\displaystyle I(X;Y)}$ is the mutual information between ${\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|Y)}$, ${\displaystyle H(X|Y=y)}$ can never exceed ${\displaystyle H(X)}$.

## References

1. {{#invoke:citation/CS1|citation |CitationClass=book }}