# Bayes' Theory Fundementals

I saw an equation as like that:

$$P(W) = P(W\mid R,S)+P(W\mid !R,S) + P(W\mid !R,S) + P(W\mid R,!S) + P(W\mid !R,!S)$$

Which of these two statements are true?

$$P(W) = P(W\mid R,S)P(R,S)+P(W\mid !R,S)\,P(!R,S) + P(W\mid !R,S)\,P(!R,S) + P(W\mid R,!S)\,P(R,!S) + P(W\,!R,!S)\,P(!R,!S)$$ or $$P(R,S) = P(R\mid S)\,P(S) = P(S\mid R)\,P(R).$$

Is there any document for it?

-
There are $5$ terms in the expressions on the right side of $P(W)$? –  Dilip Sarwate May 24 '13 at 18:40