Remember that one way to understand bayes theorem is ratio. Let' see how
Lets say we want to calculate p(a∣b), now here we are asking that given b is done, what's the probabililty that a has been done?
Example: Let's say we have two coins, one is fair and other one is baised with two head. Now we take one coin randomly and flip it. Now, we see that we got head, what is the probability that chosen coin is fair one? So here b=getting headand a=coin being fair
Here the solution is simply the ratio of: # of ways in which two can get the head with fair coin to the total # number of ways in which you can get an head. To write is mathemcatically:
p(fair∣head)=P(head)P(head with fair coin)​=P(head with fair coin)+P(head with biased coin)P(head with fair coin)​ Now to write the above in bayes theorem terms.
Note that P(head with fair)=P(head∣fair)∗P(fair) and P(head with bias)=P(head∣bias)∗P(bias).
Hence the Bayes Theorem can be written as:
p(fair∣head)=P(head∣fair)∗P(fair)+P(head∣bias)∗P(bias)P(head∣fair)∗P(fair)​ which is of the form of Orignial Bayes Theorem:
p(a∣b)=p(b)p(b∣a)p(a)​=∑i​p(b∣ai​)p(ai​)p(b∣a)p(a)​ Resources