Measure of relative information in probability theory
Venn diagram showing additive and subtractive relationships various information measures associated with correlated variables
X
{\displaystyle X}
and
Y
{\displaystyle Y}
. The area contained by both circles is the joint entropy
H
(
X
,
Y
)
{\displaystyle \mathrm {H} (X,Y)}
. The circle on the left (red and violet) is the individual entropy
H
(
X
)
{\displaystyle \mathrm {H} (X)}
, with the red being the conditional entropy
H
(
X
|
Y
)
{\displaystyle \mathrm {H} (X|Y)}
. The circle on the right (blue and violet) is
H
(
Y
)
{\displaystyle \mathrm {H} (Y)}
, with the blue being
H
(
Y
|
X
)
{\displaystyle \mathrm {H} (Y|X)}
. The violet is the mutual information
I
(
X
;
Y
)
{\displaystyle \operatorname {I} (X;Y)}
.
In information theory , the conditional entropy quantifies the amount of information needed to describe the outcome of a random variable
Y
{\displaystyle Y}
given that the value of another random variable
X
{\displaystyle X}
is known. Here, information is measured in shannons , nats , or hartleys . The entropy of
Y
{\displaystyle Y}
conditioned on
X
{\displaystyle X}
is written as
H
(
Y
|
X
)
{\displaystyle \mathrm {H} (Y|X)}
.
The conditional entropy of
Y
{\displaystyle Y}
given
X
{\displaystyle X}
is defined as
H
(
Y
|
X
)
=
−
∑
x
∈
X
,
y
∈
Y
p
(
x
,
y
)
log
p
(
x
,
y
)
p
(
x
)
{\displaystyle \mathrm {H} (Y|X)\ =-\sum _{x\in {\mathcal {X}},y\in {\mathcal {Y}}}p(x,y)\log {\frac {p(x,y)}{p(x)}}}
(Eq.1 )
where
X
{\displaystyle {\mathcal {X}}}
and
Y
{\displaystyle {\mathcal {Y}}}
denote the support sets of
X
{\displaystyle X}
and
Y
{\displaystyle Y}
.
Note: Here, the convention is that the expression
0
log
0
{\displaystyle 0\log 0}
should be treated as being equal to zero. This is because
lim
θ
→
0
+
θ
log
θ
=
0
{\displaystyle \lim _{\theta \to 0^{+}}\theta \,\log \theta =0}
.[1]
Intuitively, notice that by definition of expected value and of conditional probability ,
H
(
Y
|
X
)
{\displaystyle \displaystyle H(Y|X)}
can be written as
H
(
Y
|
X
)
=
E
[
f
(
X
,
Y
)
]
{\displaystyle H(Y|X)=\mathbb {E} [f(X,Y)]}
, where
f
{\displaystyle f}
is defined as
f
(
x
,
y
)
:=
−
log
(
p
(
x
,
y
)
p
(
x
)
)
=
−
log
(
p
(
y
|
x
)
)
{\displaystyle \displaystyle f(x,y):=-\log \left({\frac {p(x,y)}{p(x)}}\right)=-\log(p(y|x))}
. One can think of
f
{\displaystyle \displaystyle f}
as associating each pair
(
x
,
y
)
{\displaystyle \displaystyle (x,y)}
with a quantity measuring the information content of
(
Y
=
y
)
{\displaystyle \displaystyle (Y=y)}
given
(
X
=
x
)
{\displaystyle \displaystyle (X=x)}
. This quantity is directly related to the amount of information needed to describe the event
(
Y
=
y
)
{\displaystyle \displaystyle (Y=y)}
given
(
X
=
x
)
{\displaystyle (X=x)}
. Hence by computing the expected value of
f
{\displaystyle \displaystyle f}
over all pairs of values
(
x
,
y
)
∈
X
×
Y
{\displaystyle (x,y)\in {\mathcal {X}}\times {\mathcal {Y}}}
, the conditional entropy
H
(
Y
|
X
)
{\displaystyle \displaystyle H(Y|X)}
measures how much information, on average, the variable
X
{\displaystyle X}
encodes about
Y
{\displaystyle Y}
.
Let
H
(
Y
|
X
=
x
)
{\displaystyle \mathrm {H} (Y|X=x)}
be the entropy of the discrete random variable
Y
{\displaystyle Y}
conditioned on the discrete random variable
X
{\displaystyle X}
taking a certain value
x
{\displaystyle x}
. Denote the support sets of
X
{\displaystyle X}
and
Y
{\displaystyle Y}
by
X
{\displaystyle {\mathcal {X}}}
and
Y
{\displaystyle {\mathcal {Y}}}
. Let
Y
{\displaystyle Y}
have probability mass function
p
Y
(
y
)
{\displaystyle p_{Y}{(y)}}
. The unconditional entropy of
Y
{\displaystyle Y}
is calculated as
H
(
Y
)
:=
E
[
I
(
Y
)
]
{\displaystyle \mathrm {H} (Y):=\mathbb {E} [\operatorname {I} (Y)]}
, i.e.
H
(
Y
)
=
∑
y
∈
Y
P
r
(
Y
=
y
)
I
(
y
)
=
−
∑
y
∈
Y
p
Y
(
y
)
log
2
p
Y
(
y
)
,
{\displaystyle \mathrm {H} (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
I
(
y
i
)
{\displaystyle \operatorname {I} (y_{i})}
is the information content of the outcome of
Y
{\displaystyle Y}
taking the value
y
i
{\displaystyle y_{i}}
. The entropy of
Y
{\displaystyle Y}
conditioned on
X
{\displaystyle X}
taking the value
x
{\displaystyle x}
is defined analogously by conditional expectation :
H
(
Y
|
X
=
x
)
=
−
∑
y
∈
Y
Pr
(
Y
=
y
|
X
=
x
)
log
2
Pr
(
Y
=
y
|
X
=
x
)
.
{\displaystyle \mathrm {H} (Y|X=x)=-\sum _{y\in {\mathcal {Y}}}{\Pr(Y=y|X=x)\log _{2}{\Pr(Y=y|X=x)}}.}
Note that
H
(
Y
|
X
)
{\displaystyle \mathrm {H} (Y|X)}
is the result of averaging
H
(
Y
|
X
=
x
)
{\displaystyle \mathrm {H} (Y|X=x)}
over all possible values
x
{\displaystyle x}
that
X
{\displaystyle X}
may take. Also, if the above sum is taken over a sample
y
1
,
…
,
y
n
{\displaystyle y_{1},\dots ,y_{n}}
, the expected value
E
X
[
H
(
y
1
,
…
,
y
n
∣
X
=
x
)
]
{\displaystyle E_{X}[\mathrm {H} (y_{1},\dots ,y_{n}\mid X=x)]}
is known in some domains as equivocation .[2]
Given discrete random variables
X
{\displaystyle X}
with image
X
{\displaystyle {\mathcal {X}}}
and
Y
{\displaystyle Y}
with image
Y
{\displaystyle {\mathcal {Y}}}
, the conditional entropy of
Y
{\displaystyle Y}
given
X
{\displaystyle X}
is defined as the weighted sum of
H
(
Y
|
X
=
x
)
{\displaystyle \mathrm {H} (Y|X=x)}
for each possible value of
x
{\displaystyle x}
, using
p
(
x
)
{\displaystyle p(x)}
as the weights:[3] : 15
H
(
Y
|
X
)
≡
∑
x
∈
X
p
(
x
)
H
(
Y
|
X
=
x
)
=
−
∑
x
∈
X
p
(
x
)
∑
y
∈
Y
p
(
y
|
x
)
log
2
p
(
y
|
x
)
=
−
∑
x
∈
X
,
y
∈
Y
p
(
x
)
p
(
y
|
x
)
log
2
p
(
y
|
x
)
=
−
∑
x
∈
X
,
y
∈
Y
p
(
x
,
y
)
log
2
p
(
x
,
y
)
p
(
x
)
.
{\displaystyle {\begin{aligned}\mathrm {H} (Y|X)\ &\equiv \sum _{x\in {\mathcal {X}}}\,p(x)\,\mathrm {H} (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{aligned}}}
Conditional entropy equals zero [ edit ]
H
(
Y
|
X
)
=
0
{\displaystyle \mathrm {H} (Y|X)=0}
if and only if the value of
Y
{\displaystyle Y}
is completely determined by the value of
X
{\displaystyle X}
.
Conditional entropy of independent random variables [ edit ]
Conversely,
H
(
Y
|
X
)
=
H
(
Y
)
{\displaystyle \mathrm {H} (Y|X)=\mathrm {H} (Y)}
if and only if
Y
{\displaystyle Y}
and
X
{\displaystyle X}
are independent random variables .
Assume that the combined system determined by two random variables
X
{\displaystyle X}
and
Y
{\displaystyle Y}
has joint entropy
H
(
X
,
Y
)
{\displaystyle \mathrm {H} (X,Y)}
, that is, we need
H
(
X
,
Y
)
{\displaystyle \mathrm {H} (X,Y)}
bits of information on average to describe its exact state. Now if we first learn the value of
X
{\displaystyle X}
, we have gained
H
(
X
)
{\displaystyle \mathrm {H} (X)}
bits of information. Once
X
{\displaystyle X}
is known, we only need
H
(
X
,
Y
)
−
H
(
X
)
{\displaystyle \mathrm {H} (X,Y)-\mathrm {H} (X)}
bits to describe the state of the whole system. This quantity is exactly
H
(
Y
|
X
)
{\displaystyle \mathrm {H} (Y|X)}
, which gives the chain rule of conditional entropy:
H
(
Y
|
X
)
=
H
(
X
,
Y
)
−
H
(
X
)
.
{\displaystyle \mathrm {H} (Y|X)\,=\,\mathrm {H} (X,Y)-\mathrm {H} (X).}
[3] : 17
The chain rule follows from the above definition of conditional entropy:
H
(
Y
|
X
)
=
∑
x
∈
X
,
y
∈
Y
p
(
x
,
y
)
log
(
p
(
x
)
p
(
x
,
y
)
)
=
∑
x
∈
X
,
y
∈
Y
p
(
x
,
y
)
(
log
(
p
(
x
)
)
−
log
(
p
(
x
,
y
)
)
)
=
−
∑
x
∈
X
,
y
∈
Y
p
(
x
,
y
)
log
(
p
(
x
,
y
)
)
+
∑
x
∈
X
,
y
∈
Y
p
(
x
,
y
)
log
(
p
(
x
)
)
=
H
(
X
,
Y
)
+
∑
x
∈
X
p
(
x
)
log
(
p
(
x
)
)
=
H
(
X
,
Y
)
−
H
(
X
)
.
{\displaystyle {\begin{aligned}\mathrm {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))-\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]&=\mathrm {H} (X,Y)+\sum _{x\in {\mathcal {X}}}p(x)\log(p(x))\\[4pt]&=\mathrm {H} (X,Y)-\mathrm {H} (X).\end{aligned}}}
In general, a chain rule for multiple random variables holds:
H
(
X
1
,
X
2
,
…
,
X
n
)
=
∑
i
=
1
n
H
(
X
i
|
X
1
,
…
,
X
i
−
1
)
{\displaystyle \mathrm {H} (X_{1},X_{2},\ldots ,X_{n})=\sum _{i=1}^{n}\mathrm {H} (X_{i}|X_{1},\ldots ,X_{i-1})}
[3] : 22
It has a similar form to chain rule in probability theory, except that addition instead of multiplication is used.
Bayes' rule for conditional entropy states
H
(
Y
|
X
)
=
H
(
X
|
Y
)
−
H
(
X
)
+
H
(
Y
)
.
{\displaystyle \mathrm {H} (Y|X)\,=\,\mathrm {H} (X|Y)-\mathrm {H} (X)+\mathrm {H} (Y).}
Proof.
H
(
Y
|
X
)
=
H
(
X
,
Y
)
−
H
(
X
)
{\displaystyle \mathrm {H} (Y|X)=\mathrm {H} (X,Y)-\mathrm {H} (X)}
and
H
(
X
|
Y
)
=
H
(
Y
,
X
)
−
H
(
Y
)
{\displaystyle \mathrm {H} (X|Y)=\mathrm {H} (Y,X)-\mathrm {H} (Y)}
. Symmetry entails
H
(
X
,
Y
)
=
H
(
Y
,
X
)
{\displaystyle \mathrm {H} (X,Y)=\mathrm {H} (Y,X)}
. Subtracting the two equations implies Bayes' rule.
If
Y
{\displaystyle Y}
is conditionally independent of
Z
{\displaystyle Z}
given
X
{\displaystyle X}
we have:
H
(
Y
|
X
,
Z
)
=
H
(
Y
|
X
)
.
{\displaystyle \mathrm {H} (Y|X,Z)\,=\,\mathrm {H} (Y|X).}
For any
X
{\displaystyle X}
and
Y
{\displaystyle Y}
:
H
(
Y
|
X
)
≤
H
(
Y
)
H
(
X
,
Y
)
=
H
(
X
|
Y
)
+
H
(
Y
|
X
)
+
I
(
X
;
Y
)
,
H
(
X
,
Y
)
=
H
(
X
)
+
H
(
Y
)
−
I
(
X
;
Y
)
,
I
(
X
;
Y
)
≤
H
(
X
)
,
{\displaystyle {\begin{aligned}\mathrm {H} (Y|X)&\leq \mathrm {H} (Y)\,\\\mathrm {H} (X,Y)&=\mathrm {H} (X|Y)+\mathrm {H} (Y|X)+\operatorname {I} (X;Y),\qquad \\\mathrm {H} (X,Y)&=\mathrm {H} (X)+\mathrm {H} (Y)-\operatorname {I} (X;Y),\,\\\operatorname {I} (X;Y)&\leq \mathrm {H} (X),\,\end{aligned}}}
where
I
(
X
;
Y
)
{\displaystyle \operatorname {I} (X;Y)}
is the mutual information between
X
{\displaystyle X}
and
Y
{\displaystyle Y}
.
For independent
X
{\displaystyle X}
and
Y
{\displaystyle Y}
:
H
(
Y
|
X
)
=
H
(
Y
)
{\displaystyle \mathrm {H} (Y|X)=\mathrm {H} (Y)}
and
H
(
X
|
Y
)
=
H
(
X
)
{\displaystyle \mathrm {H} (X|Y)=\mathrm {H} (X)\,}
Although the specific-conditional entropy
H
(
X
|
Y
=
y
)
{\displaystyle \mathrm {H} (X|Y=y)}
can be either less or greater than
H
(
X
)
{\displaystyle \mathrm {H} (X)}
for a given random variate
y
{\displaystyle y}
of
Y
{\displaystyle Y}
,
H
(
X
|
Y
)
{\displaystyle \mathrm {H} (X|Y)}
can never exceed
H
(
X
)
{\displaystyle \mathrm {H} (X)}
.
Conditional differential entropy [ edit ]
The above definition is for discrete random variables. The continuous version of discrete conditional entropy is called conditional differential (or continuous) entropy . Let
X
{\displaystyle X}
and
Y
{\displaystyle Y}
be a continuous random variables with a joint probability density function
f
(
x
,
y
)
{\displaystyle f(x,y)}
. The differential conditional entropy
h
(
X
|
Y
)
{\displaystyle h(X|Y)}
is defined as[3] : 249
h
(
X
|
Y
)
=
−
∫
X
,
Y
f
(
x
,
y
)
log
f
(
x
|
y
)
d
x
d
y
{\displaystyle h(X|Y)=-\int _{{\mathcal {X}},{\mathcal {Y}}}f(x,y)\log f(x|y)\,dxdy}
(Eq.2 )
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
)
{\displaystyle h(Y|X)\,=\,h(X,Y)-h(X)}
[3] : 253
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:
I
(
X
,
Y
)
=
h
(
X
)
−
h
(
X
|
Y
)
=
h
(
Y
)
−
h
(
Y
|
X
)
{\displaystyle \operatorname {I} (X,Y)=h(X)-h(X|Y)=h(Y)-h(Y|X)}
h
(
X
|
Y
)
≤
h
(
X
)
{\displaystyle h(X|Y)\leq h(X)}
with equality if and only if
X
{\displaystyle X}
and
Y
{\displaystyle Y}
are independent.[3] : 253
Relation to estimator error [ edit ]
The conditional differential entropy yields a lower bound on the expected squared error of an estimator . For any random variable
X
{\displaystyle X}
, observation
Y
{\displaystyle Y}
and estimator
X
^
{\displaystyle {\widehat {X}}}
the following holds:[3] : 255
E
[
(
X
−
X
^
(
Y
)
)
2
]
≥
1
2
π
e
e
2
h
(
X
|
Y
)
{\displaystyle \mathbb {E} \left[{\bigl (}X-{\widehat {X}}{(Y)}{\bigr )}^{2}\right]\geq {\frac {1}{2\pi e}}e^{2h(X|Y)}}
This is related to the uncertainty principle from quantum mechanics .
Generalization to quantum theory [ edit ]
In quantum information theory , the conditional entropy is generalized to the conditional quantum entropy . The latter can take negative values, unlike its classical counterpart.