Let's consider two probabilistic events, A and B. We can correlate the marginal probabilities P(A) and P(B) with the conditional probabilities P(A|B) and P(B|A), using the product rule:
Considering that the intersection is commutative, the first members are equal, so we can derive Bayes' theorem:
In the general discrete case, the formula can be re-expressed considering all possible outcomes for the random variable A:
As the denominator ...