Entropy and conditional probability

185 Views Asked by At

I'm trying to figure out the correct method to work through an entropy problem. I'm given the following probability distribution table below, and asked to find different a few different values, for example $H(X)$, $H(X|Y)$, etc.

$$\begin{array}{|c|l|l|}\hline X|Y & \mathsf{0} & \mathsf{1} \\ \hline \mathsf{0} & \frac{1}{3} & \frac{1}{3}\\ \mathsf{1} & 0 & \frac{1}{3} \\ \hline \end{array}$$ just to be clear, the probability of $X=1$, and $Y=0$ ($prob(1,0)$) is zero ($X$ is the left side, $Y$ is the top)

To find $H(X)$, I believe I find the marginal of $X$, which should just be adding up the different probabilities for each $Y$ value. which should be

$prob(X|Y=0) = \frac{1}{3} + \frac{1}{3} = \frac{2}{3}$

and

$prob(X|Y=1) = 0 + \frac{1}{3} = \frac{1}{3}$.

From there I think I find $H(X)$ with

$H(X) = \sum_{i=0}^1 prob(X=i)\cdot log_2(\frac{1}{prob(X=i)}) = \frac{2}{3}\cdot log_2(\frac{3}{2})+\frac{1}{3}\cdot log_2(3)$, is that correct?

I'm a little more confused on the $H(X|Y)$. I know the definition of this should be $H(X|Y)=-\sum_{y}\sum_{x} prob(x,y)\cdot log_2(prob(y|x))$ but in another example I found it looks like this should also equal $H(X|Y)=\sum_{i} prob(Y=i)H(X|Y=i)$ which looks like it's a lot easier to me. using this method, is the following correct?

$prob(Y=0) = \frac{1}{3} + 0 = \frac{1}{3}$, and $prob(Y=1) = \frac{1}{3} + \frac{1}{3} = \frac{2}{3}$,

$H(X|Y=0) = H(1) + H(0) $ where $H(1)$ comes from if $Y=0$, then $X=0$ 100% of the time. if that's true, then the entropy of 1 is 0 ($1\cdot log_2(1) = 0$)

$H(X|Y=1) = H(.5) + H(.5) $ where $H(.5)$ comes from if $Y=1$, then $X=0$ and $X=1$ are equalily likely, and happen 50% of the time. if that's true, then the entropy of .5 is .5 ($.5\cdot log_2(1/.5) = .5$) and so $H(X|Y=1) = 1$

Is that the correct way of thinking about these? is there a most systematic approach to this? Thanks for any help with understanding this!