Bayes’ theorem

Further, if is a countable partition of the sample space, then

$ P(A_i \mid B)=\frac{P(B \mid A_i) \cdot P(A_i)}{\sum_{j} P(B \mid A_j) \cdot P(A_j)} .

For Random Variables, the Bayes’ law is

$ P\_{X\given Y}(x\given y) = \frac{P\_{Y\given X}(y\given x) \cdot P\_{X}(x)}{P\_{Y}(y)} \= \frac{P\_{Y\given X}(y\given x) \cdot P\_{X}(x)}{\int , P\_{Y\given X}(y\given x') , \d P\_{X}(x')} ,

where can be PMF, PDF, or general probability law.