# Bayes’ Theorem

Bayes’ Rule is an application of the LOTP with the Conditional Probability rule. Bayes’ theorem describes the probability of an event based on prior knowledge of conditions that might be related to the event.

Let $B_{1},…,B_{n}$ be a partition of $S$ and $A$ be any event, then $P(B_{i}∣A)=P(A)P(A∣B_{i})⋅P(B_{i}) =∑_{R=1}P(A∣B_{R})⋅P(B_{R})P(A∣B_{i})⋅P(B_{i}) $

$P(B_{i})$ $→$ Prior Probability $P(B_{i}∣A)$ $→$ Posterior Probability

How is bayes rule derived? Apply the basic rule of Conditional Probability, and leverage the fact that AND is commutative. $P(B_{i}∩A)=P(A∣B_{i})P(B_{i})=P(B_{i}∣A)P(A)$ Therefore, you can simplify $P(B_{i}∣A)=P(A)P(A∩B_{i}) =p(A)P(B_{i}∩A) =…$

`You have one fair coin and a biased coin that lands on heads with a probability of 3 4 . A coin is chosen at random and tossed three times. If we observe three heads in a row, what is the probability that the fair coin was chosen?`

Solution: $B_{1}=$ The fair coin was chosen $B_{2}=$ The biased coin was chosen $A=$ 3 heads observed in 3 tosses

We want to find $P(B_{1}∣A)$, so we can use Bayes’ Theorem, and calculate $P(A)=P(A∣B_{1})P(B_{1})+P(A∣B_{2})P(B_{2})$

### Bayes rule with Conditioning

From CS287. $P(x∣y,z)=P(y∣z)P(y∣x,z)P(x∣z) $