Hello math experts on the internet!
Im stuck with an exercise about Bayes Theorem.
Given are 3 random variables: $M$, $B$, and $K$, all have binary outcomes, i.e.: $$ B=\{true,false\}=\{B,\overline{B}\} \\ M=\{true,false\}=\{M,\overline{M}\} \\ K=\{true,false\}=\{K,\overline{K}\} $$ I use the $X,\overline{X}$ notation to represent the boolean states true and false for simplicity. It is known that $B$ and $M$ are independent, meaning that: $$ p(B,M)=p(B) \cdot p(M) $$ Also, the a priori probabilities of $B$ and $M$ are known (and thus the ones of $\overline{B}$ and $\overline{M}$ since we are dealing with binary outcomes). $$ \begin{align*} p(B) &= 0.6 \\ p(\overline{B}) &= 1-p(B)=1-0.6 \\ p(M) &= 0.2 \\ p(\overline{M}) &= 1-p(M)=1-0.2 \\ \end{align*} $$ Furthermore, the conditional probabilities of $K$, given $B,M$ are known: $$ p(K|B,M)=0.1 \\ p(K|B,\overline{M})=0.6 \\ p(K|\overline{B},M)=0.2 \\ p(K|\overline{B},\overline{M})=0.3 \\ $$ Since $K$ is a binary variable too, we also know all conditional probabilities of $p(\overline{K}|B,M)$: $$ p(\overline{K}|B,M)=1-0.1 \\ p(\overline{K}|B,\overline{M})=1-0.6 \\ p(\overline{K}|\overline{B},M)=1-0.2 \\ p(\overline{K}|\overline{B},\overline{M})=1-0.3 \\ $$ The task is to calculate $p(B|K)$. And I don't know how to go from those conditional probabilities of 3 variables to the case of only having 2.
Applying Bayes Theorem yields: $$ p(B|K) = \frac{p(K|B) \cdot p(B)}{p(K)} $$
Here, both $p(K|B)$ and $p(K)$ are unknown. $p(K)$ is typically calculated by summing the joint probability $p(K,B)$ over all outcomes of $B$. In this case, according to the solution, I have to sum up over all outcomes of $M$ aswell. The same has to be done for $p(K|B)$. Mathematically, $$ p(K) = \sum_{b\in B} \sum_{m\in M} p(K,b,m) = \sum_{b\in B} \sum_{m\in M} p(K|b,m) \cdot p(b,m)=\sum_{b\in B} \sum_{m\in M} p(K|b,m) \cdot p(b) \cdot p(m) $$ and $$ p(K|B) = \sum_{m\in M} p(K|B,m) \cdot p(m) \cdot p(B) $$ Here, the lower-case letters $m$ and $b$ represent the outcomes of $M$ and $B$, respectively. I do not see where this comes from. How can I derive this? Thanks in advance for any help!