## Thursday, August 7, 2014

### Unizor - Probability - Conditional - Bayes Theorem

Let's start with the Bayes Theorem itself and its proof, and then discuss its applications. The theorem is very simple, but its applications are very far reaching.

Bayes Theorem
There are two events that are the results of a random experiment - A and B.
P(A) is the probability of event A to occur.
P(B) is the probability of event B to occur.
P(A|B) is the conditional probability of event A to occur if event B has already occurred.
P(B|A) is the conditional probability of event B to occur if event A has already occurred.
Then the following equality is true
P(A|B) = P(B|A) · P(A) / P(B)

Proof
By definition of conditional probability,
P(A|B) = P(A∩B) / P(B) and
P(B|A) = P(A∩B) / P(A).
Let's resolve the second equation for P(A∩B):
P(A∩B) = P(B|A) · P(A)
Now substitute this expression for P(A∩B) into a formula for P(A|B) above.
P(A|B) = P(B|A) · P(A) / P(B)
End of proof.

Consider a case when an entire sample space of elementary events is divided among two subsets with no common elements:
X and Y. Then any event W can be represented as a union of two non-intersecting parts W = (W·X)+(W·Y) and the measure of an event W is equal to a sum of measures of its two non-intersecting parts:
P(W) = P(W·X)+P(W·Y)
Using the formula of conditional probability P(A|B)=P(A·B)/P(B), we can rewrite the equation for P(W) above as
P(W) =
= P(X)·P(W|X) + P(Y)·P(W|Y)
This is called a formula of total probability. It is important here that events X and Y are complementary, that is
X·Y=∅ and X+Y=Ω.

Now we can use the Bayes formula to determine a conditional probability P(X|W) and P(Y|W):
P(X|W) = P(X·W)/P(W) = P(X)·P(W|X)/P(W) and
P(Y|W) = P(Y·W)/P(W) = P(Y)·P(W|Y)/P(W)

The formulas above show how, knowing probabilities of occurrence of certain conditions X and Y and the conditional probabilities of certain event W under these conditions, we can calculate its total probability P(W) and then determine which condition X and Y actually occurred with what conditional probability P(X|W) and P(Y|W) under a conditi the on that event W did occur.