# find entropy given that conditional proability

                        city B


city A\begin{align} \ P (city B|city A)&& B=sunny && B=Rain \\A=sunny &&\frac{4}{5} && \frac{1}{5} \\ A=Rain &&\frac{1}{2}&&\frac{1}{2} \\ \end{align}

i need to calculate the entropy for $$H(City A)$$ , $$H(city B|City A=sunny)$$, $$H(city A|City b)$$ and $$H(city a,city b)$$

but im not sure i how can i find $$p(A,B)$$ from the table such as $$p(A=sunny,B=sunny)$$, $$p(A=sunny,B=rain)$$ ,$$p(A=rain,B=sunny)$$, $$p(A=rain,B=rain)$$

i know that $$P(city A=sunny)=p(B=rain).p(A=sunny|B=rain)+p(B=sunny).p(A=sunny|B=sunny)$$

is this related to bayes rule in joint conditional probability? im used to tabel that is given joint probability such as $$p(A,B)$$ but in this table it is given the conditional probability what rule should i use

and also $$P(B=sunny|A=sunny)=0.8=\frac{p(city A=sunny|city B=sunny).p(city B=sunny)}{P(city A=sunny)}$$

i try to draw the tree diagram but im not sure how can i relate two probability of two city?

EDIT: there is similar problem in book that said $$a=P(city A=sunny)=P(city B=sunny=b$$ but im not sure is this right or not

$$\color{brown}{\frac4{5}\cdot a+\frac1{2}\cdot (1-a)=b }$$

from a=b

$$\color{brown}{\frac4{5}\cdot a+\frac1{2}\cdot (1-a)=a}$$

solving $$a=\frac{5}{7}$$

$$P(a=S,b=S)=\frac{5}{7} * 0.8=\frac{4}{7}$$

$$P(a=S,b=R)=\frac{1}{7}$$

$$P(a=R,b=S)=\frac{1}{7}$$

$$P(a=R,b=R)=\frac{1}{7}$$

We know that $$P(X=x|Y=y)\cdot P(Y=y)=P(X=x\cap Y=y)$$. Then let me first define some denotations.

$$A$$=City a is sunny ($$a$$), $$\overline A$$=City a is sunny $$((1-a))$$, $$B$$=City a is sunny ($$b$$), $$\overline B$$=City a is sunny $$((1-b))$$.

$$\small{\textrm{The small letters in the brackets will replace the corresponding probabilities}}$$

1.1 The proability that City A and City B are sunny is

$$P(B|A)\cdot P(A)=P(A\cap B)\Rightarrow \frac4{5}\cdot a=P(A\cap B)$$

1.2 The proability that City A is rainy and City B is sunny is

$$P(B|\overline A)\cdot P(\overline A)=P(\overline A\cap B)\Rightarrow \frac1{2}\cdot (1-a)=P(\overline A\cap B)$$

We can sum up both equations and get $$\color{brown}{\frac4{5}\cdot a+\frac1{2}\cdot (1-a)=b \quad (1)}$$

2.1 The proability that City A and City B are sunny is

$$P(B|A)\cdot P(A)=P(A\cap B)\Rightarrow \frac4{5}\cdot a =P(A\cap B)$$

2.2 The proability that City A is sunny and City B is rainy is

$$P(\overline B|A)\cdot P( A)=P( A\cap \overline B)\Rightarrow \frac1{5}\cdot (1-b)=P( A\cap \overline B)$$

Summing up both equations again and get

$$\color{brown}{\frac4{5}\cdot a+\frac1{5}\cdot (1-b)=a \quad (2)}$$

You just have to solve this little equation system and then use the very first equation to calculate the joint distribution. I got

$$\large{\begin{array}{|c|c|c|} \hline P(B \cap A) & B & \overline B \\ \hline A &\frac{4}{13} & \frac{1}{13} \\ \hline \overline A &\frac{4}{13}&\frac{4}{13} \\ \hline \end{array}}$$

• thankyou so much, i edit my post, there is similar probelm in my book, that said $a=P(city A=sunny)=P(city B=sunny=b)$, but im not sure why is that.. i tried to solve the equation that lead to different result from your answer, i dont know which one is right(?) – fiksx Jul 11 '19 at 15:46
• Have you posted the similar problem? – callculus Jul 11 '19 at 15:49
• posted the problem here? – fiksx Jul 11 '19 at 15:51
• If you ask me, then it is good for me to know what the problem is. – callculus Jul 11 '19 at 15:53
• Is still not clear what your problem is. Please state clear what the (new) problem is. A new question would be the best place. – callculus Jul 11 '19 at 16:14