# Calculating probability using Bayes rule.

I've been searching through posts on this web about how to apply Bayes' rule on the question on my assignment. I've came across many useful tips and advices. However, not all of my questions are answered.

So I was trying to figure out how to calculate probability using Bayes rule on multiple conditions like P(a,b | c). I came across this posts https://math.stackexchange.com/q/408833 which explained how to solve this very nicely.

The question on my assignment :

So let ho = Hangover, f = flu, s = sore throat, n = nauseous and hd = headache.

Given that P(ho | hd) = 0.5

P(ho | n) = 0.5

P(ho | s) = 0.1

P(f | hd ) = 0.4

P(f | n) = 0.2

P(f | s) = 0.6

P(ho) = 0.3

P(f) = 0.05

and if there is nothing wrong with John (ie. no hang over or flu) the prior probability is 0.65. Flu and hangover cannot happen at the same time.

I applied the rule I found on my question, so I got :

P(ho, f|s) = P(ho | f,s)P(f|s)

my question didn't give the value for P(f,s) so I tried to use the fact that P(f,s) is

P(f AND s) = P(f | s) P(s)

This is where I encountered a second problem. The question didn't state the value of P(s) either. How do I calculate for a single P(a) if it is not given?

Another question I wanted to ask is that, I have also stumbled upon this posts Is $P( A \cup B\, |\, C)$ the same as $P(A | C) + P(B | C)$ ( $A$ and $B$ are mutually exclusive) they say that P( a U b | c ) is equal to P(a |c) + P(b|c).

In my assignment, it said that hangover and flu cannot happent at the same time. So does that mean P(ho,f|s) is equal to P(ho U f | s)? if so, Can I say that P(ho,f|s) = P(ho | s ) + P(f |s) ?

Sorry for writing and asking so many things here but I really need to get these question answered. Thank you in advance!

• Someone who's (probably) doing the same assignment has already asked this: math.stackexchange.com/questions/2501822/… – TheSimpliFire Nov 5 '17 at 15:35
• oh wow, I didn't realize that. Thanks for pointing that out! @TheSimpliFire – CGrace Nov 5 '17 at 16:11

Generally, the way these problems work is by: $$P(X|Y) = \frac{P(Y|X)P(X)}{P(Y)} = \frac{P(Y|X)P(X)}{\sum_k P(Y|X_k) P(X_k)}$$ using the law of total probability.

Also, keep the additive rule for probability in mind: $$P(X\cup Y) = P(X) + P(Y) - P(X\cap Y)$$ Notice that if $$X$$ and $$Y$$ are mutually exclusive, the chance of $$X\cap Y$$ is zero. (If $$X$$ and $$Y$$ are independent, then $$P(X\cap Y)=P(X)P(Y)$$. Otherwise, $$P(X\cap Y)=P(X)P(Y|X)$$). Further, using $$P(X|Y)=P(X\cap Y)/P(Y)$$, one can prove that \begin{align*} P(X\cup Y\mid Z) &= \frac{P((X\cup Y)\cap Z)}{P(Z)}\\ &= \frac{P((X\cap Z)\cup (Y\cap Z))}{P(Z)}\\ &= \frac{P(X\cap Z)+P(Y\cap Z) - P((X\cap Z)\cap(Y\cap Z))}{P(Z)}\\ &= \frac{P(X\cap Z)+P(Y\cap Z) - P(X\cap Y\cap Z)}{P(Z)}\\ &= \frac{P(X\cap Z)+P(Y\cap Z) - P((X\cap Y)\cap Z)}{P(Z)}\\ &= P(X|Z) + P(Y|Z) - P(X\cap Y|Z) \end{align*}

According to you, $$H_o$$ = Hangover, $$F$$ = flu, $$S$$ = sore throat, $$N$$ = nauseous and $$H_d$$ = headache, and it appears you know $$P(H_o|H_d)$$, $$P(H_o|N)$$, $$P(H_o|S)$$, $$P(F|H_d)$$, $$P(H_o)$$, $$P(F|N)$$, $$P(F|S)$$, $$P(F)$$, and $$P(\lnot H_o \cap \lnot F)$$. Also, hangover and flu cannot happen at the same time (though it's not clear why), i.e. $$P(H_o\cap F)=0$$.

How do I calculate for a single P(a) if it is not given?

For $$P(S)$$, using the law of total probability, you should be able to do something like $$P(S) = P(S|H_o)P(H_o) + P(S|\lnot H_o)P(\lnot H_o)$$ where you have the two marginals (since $$P(\lnot H_o)=1-P(H_o)$$), but you'd need to give more information to do the rest I think.

So does that mean P(ho,f|s) is equal to P(ho U f | s)?

I am not clear what the notation $$P(H_o,F|S)$$ means. So, sorry, I cannot answer that.

If so, can I say that P(ho, f|s) = P(ho | s ) + P(f |s) ?

Yes, since $$H_o$$ and $$F$$ are mutually exclusive, you can say: $$P(H_o \cup F|S) = P(H_o |S) + P(F|S)$$