# Why don't terms cancel in this application of Bayes' Rule?

I have been looking at several different sites trying to wrap my head around the content of Sebastian Thrun's Intro AI course on Udacity. At the moment I'm trying to understand the lesson on "explaining away" in the case of two confounding causes. I found this SE Mathematics article but the top answer just left me with more questions.

Let S = It is sunny R = I got a raise H = I am happy

The first step in the article linked above is to go from

P(R|H,S)

to

P(R,H,S) / P(H,S)

I understand how to make that step. What I don't understand is why the denominator doesn't cancel out the P(S) and the P(H) in the numerator. I thought that P(R,H,S) was the same as P(R)P(H)P(S), so dividing that by P(H)P(S) would leave you with P(R).

I've always struggled with math, so I'm sure I'm just missing something dumb.

• Think about what these cryptic expressions mean. The event $R$ (“I got a raise”) includes cases when it’s sunny or you aren’t happy, but we want to exclude those for the conditional probability, so $P(R)$ can’t in general be the right value.
– amd
Jun 26, 2018 at 19:59
• If $S,H,R$ were independent you might be correct as $\dfrac{ P(R)P(H)P(S)}{P(H)P(S)} = P(R)$ as you say, but they need not be independent, especially as the weather and your pay may influence your happiness Jun 26, 2018 at 22:23

NOTE:

$P(A|B) = \dfrac{P(A,B)}{P(B)}\ne P(A)P(B)$

$P(R|H,S) = \dfrac{P(R,H,S)}{P(H,S)}$

This is known as conditional probability

EDIT 1:

on the question that $P(A,B) =P(A)P(B)$.

The above is only true iff $P(A)$ and $P(B)$ are independent events.

It would be best to read up on this

EDIT 2:

No, you can also use the fact that $P(A\cap B) =P(A)+P(B)-P(A\cup B)$
• @DanielArant: No, $P(A,B)$ is in general not equal to $P(A)P(B)$. See en.wikipedia.org/wiki/Independence_(probability_theory). Jun 26, 2018 at 18:41
• @DanielArant not always $P(A,B)= P(A)P(B)$ iff $P(A) \& P(B)$ are independent events Jun 26, 2018 at 18:43
• @DanielArant no you can also use the fact that $P(A\cup B)= P(A)+P(B)-P(A\cap B)$ Jun 26, 2018 at 19:14