Hey Developer’s, I’m back with a new topic which is Law of Total Probability in the series of statistics foundations.

Quick Refresher

Multiplicative Law

The probability of intersection of two events A and B is

P(A∩B) = P(B)P(A|B) = P(A)P(B|A),if values swapped

If these events are independent, then P(A∩B) = P(A)P(B)

Additive Law

Probability of a union of events, P(A U B) = P(A) + P(B) – P(A∩B)

If A and B are mutually exclusive,P(A∩B) = 0 and

P(A U B) = P(A) + P(B)

So, let’s get started …

Law Of Total Probability

Let’s start with an example, if you have bought three pens, prices are P1 = Rs. 10,P2 = Rs. 20, P3 = Rs. 15, from the stationary and you, want to calculate the total money spent on the pens then what you will do,

Total = P1+P2+P3 = 10+20+15 = Rs. 45.

This is the idea behind the law of total probability where each cost of the pen is replaced by the probability of an event A. We basically do the partitions in the sample space S, to calculate the single probabilities and add then at the end.

We can state a more general version of this formula which applies to a general partition of the sample space S.

Law of Total Probability:
If B1,B2,B3,⋯ is a partition of the sample space S, then for any event A we have,

Law Of Total Probability Example

I have three bags that each contain 100 marbles:

  • Bag 1 has 75 red and 25 blue marbles;
  • Bag 2 has 60 red and 40 blue marbles;
  • Bag 3 has 45 red and 55 blue marbles.

I choose one of the bags at random and then pick a marble from the chosen bag, also at random. What is the probability that the chosen marble is red?

Solution

Let R be the event that the chosen marble is red. Let Bi be the event that I choose Bag i. We already know that

P(R|B1) = 0.75, P(R|B2) = 0.60, P(R|B3) = 0.45

We choose our partition as B1, B2, B3. Note that this is a valid partition because, firstly, the Bi’s are disjoint (only one of them can happen), and secondly, because their union is the entire sample space as one the bags will be chosen for sure, i.e., P(B1∪B2∪B3)=1. Using the law of total probability, we can write,

P(R) = P(R|B1)P(B1) + P(R|B2)P(B2) + P(R|B3)P(B3)

P(R) = 0.75*1/3+0.60*1/3+0.45*1/3

P(R) = 0.60

Next Post will be on Bayes’s Theorem

Till then, Stay Connected

Connect with me on :

Linkedin: https://www.linkedin.com/in/patidarparas13/

Twitter: https://twitter.com/patidarparas13

MLAIT On Twitter: https://twitter.com/mlait1908

MLAIT On Linkedin: https://www.linkedin.com/company/mlait1908

MLAIT On Telegram: https://t.me/mlait

MLAIT On WhatsApp: https://chat.whatsapp.com/IDTD8ONgeZw2InepJEKrM7