|q⟩ Bad Qubits

advanced · Physics · Quantum Information & von Neumann Entropy

Joint and Conditional Entropy

Real information sources rarely produce a single symbol; they produce correlated pairs (or longer strings). To handle two random variables XX and YY jointly, Shannon entropy extends naturally to joint and conditional entropies, tied together by an elegant chain rule.

Joint entropy

Given a joint distribution p(x,y)p(x,y), the joint entropy treats the pair (X,Y)(X,Y) as a single composite variable:

H(X,Y)=x,yp(x,y)log2p(x,y).H(X,Y) = -\sum_{x,y} p(x,y)\,\log_2 p(x,y).

It measures the total uncertainty about both outcomes together. If XX and YY are independent, p(x,y)=p(x)p(y)p(x,y) = p(x)p(y) and the logarithm splits, giving H(X,Y)=H(X)+H(Y)H(X,Y) = H(X) + H(Y).

Conditional entropy

The conditional entropy H(YX)H(Y\,|\,X) measures the average remaining uncertainty about YY once XX is known. For a fixed value xx, the uncertainty in YY is H(YX=x)H(Y\,|\,X=x), computed from the conditional distribution p(yx)p(y\,|\,x). Averaging over xx with weights p(x)p(x),

H(YX)=xp(x)H(YX=x)=x,yp(x,y)log2p(yx).H(Y\,|\,X) = \sum_x p(x)\,H(Y\,|\,X=x) = -\sum_{x,y} p(x,y)\,\log_2 p(y\,|\,x).

Conditioning never increases uncertainty: 0H(YX)H(Y)0 \le H(Y\,|\,X) \le H(Y). Learning XX can only reduce (or leave unchanged) what we do not know about YY.

The chain rule

Using p(x,y)=p(x)p(yx)p(x,y) = p(x)\,p(y\,|\,x) and log2p(x,y)=log2p(x)+log2p(yx)\log_2 p(x,y) = \log_2 p(x) + \log_2 p(y\,|\,x), the joint entropy decomposes:

H(X,Y)=H(X)+H(YX).\boxed{\,H(X,Y) = H(X) + H(Y\,|\,X).\,}

In words: the uncertainty about the pair equals the uncertainty about XX plus the leftover uncertainty about YY given XX. Rearranged, H(YX)=H(X,Y)H(X)H(Y\,|\,X) = H(X,Y) - H(X) — the most convenient route in practice, since both terms on the right come straight from the joint table.

A worked example

Take the joint distribution

p(x,y)y=0y=1x=01214x=1014\begin{array}{c|cc} p(x,y) & y=0 & y=1 \\ \hline x=0 & \tfrac12 & \tfrac14 \\ x=1 & 0 & \tfrac14 \end{array}

The joint entropy is

H(X,Y)=12log21214log21414log214=12+12+12=1.5 bits.H(X,Y) = -\tfrac12\log_2\tfrac12 - \tfrac14\log_2\tfrac14 - \tfrac14\log_2\tfrac14 = \tfrac12 + \tfrac12 + \tfrac12 = 1.5\text{ bits}.

The marginal of XX is p(X=0)=34p(X{=}0) = \tfrac34, p(X=1)=14p(X{=}1) = \tfrac14, so H(X)=h(14)0.8113H(X) = h(\tfrac14) \approx 0.8113 bits. The chain rule then gives

H(YX)=H(X,Y)H(X)=1.50.81130.6887 bits.H(Y\,|\,X) = H(X,Y) - H(X) = 1.5 - 0.8113 \approx 0.6887\text{ bits}.

Try it

For the joint distribution above, compute the conditional entropy H(YX)H(Y\,|\,X) in bits via the chain rule H(YX)=H(X,Y)H(X)H(Y\,|\,X) = H(X,Y) - H(X). Return the value.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.