Probability from Zero

Amit Kumar Gupta
9 min readJun 26, 2022

Unknowingly we all know this

We all know that the chance of the raining in a cloudy day is higher. And the chance of having party every weekend may be low when your parents are at home. Probability is just another name for chance.

In real life, we mostly explain probability using terms like 100%, very high, high, average, low, very low, none etc. But mathematical study can help us to give an exact number. So that we can even compare 2 different probabilities which are said as very high. Eg Suppose there are 2 medical stores in opposite direction. The probability of getting some rare particular medicine in both stores can be very low. But calculating it mathematically may save your time to visit the store having very very low probability. … I know, I know, we don’t use that level of math in real life. But having knowledge is always good.

We can define probability as how likely an event is to occur. In other words, we can define probability as the ratio of number of favorable outcomes and the total outcomes. Eg what is the chance of picking your favorite candy 🍭 from the box full of different type of candies and chocolates?

P(🍭) can be read as Probability of picking one 🍭

Probability function

Don’t you think if total candies are less then the probability of getting your favorite candy is very high ( 🤷‍♂️ Basic math)

  • Total candies can be called as Sample space and can be written as n(S).
  • Picking your favorite candies is called an Event and number of favorite candies is called favorable outcomes. It is written as n(E).

As you can notice, n(E) ≤ n(S) always. n(S) can also be called as universal space if there is no bigger set than n(S).

Notation P(🍭) can also be read as probability of picking a lollipop from/given a box of chocolate. It is a short form of P(🍭 |📦) because 📦 denotes universal space.

Now suppose we have 2 boxes of chocolate 💝 and 📦. If we have to find the probability of picking 🍭 from both boxes then we can write it as P(🍭). But if we have to find the probability of picking 🍭 from 💝 then we’ll have to write it as P(🍭 | 💝). And the formula to calculate is so easy. just divide number of items in favorable space #🍭 by number of items in sample space #💝.

Lets understand with one more example.

This is my birthday 🎂 and you’re invited. There is a competition to pick balloons and find the goodies. You have only one chance. What is the probability that you prick a balloon with goodie ?

Suppose there are total 20 balloons I used to decorate the room. And you’re pricking any 1. So

  • n(E) = {🎈} = 1
  • n(S) = {🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈} = 20
  • “Pricking a balloon” is called Event.

P(📌) = 1/20

Somehow you got to know that the balloons hanging over the cake has more chance to have goodies. So this time you plan to prick 📌 a balloon hanging over the cake.

Suppose there are total 8 balloons hanging over the cake. And 2 out of them are full of candies. What is the probability of pricking one balloon with candies?

  • n(E) = {🎈, 🎈} = 2
  • n(S) = {🎈,🎈,🎈,🎈,🎈,🎈,🎈,🎈} = 8

P(📌|🎂) = 2/8

This time the sample space is reduced. Hence, the probability is increased. ( 🤷‍♂️ Basic math). This sample space is the subset of Universal space. Hence, it is necessary to mention it in the notation.

This is how we can visualize it using a Venn diagram.

When a sample space is not the universal space but some subset of universal space then probability calculated over this sample space is called conditional probability.

Notation: P(A|B)

Called as Probability of A after B, or Probability of A given B, or Probability of A when B is already happened. We can also call A as evidence from the B hypothesis.

Some of my invited friends were from my colony (40), and some were from my school(30). Yes!! it is a big party. Coincidentally, some of my colony friends are my school friends too (10). And rest of the people were my relatives or 🤷‍♂️ unknown people invited by my parents (40).

I want to select someone to sing a poem for me. I know everyone is afraid but I still select. What is the probability I select someone from my school?

P(🏫 | 👫👨‍👨‍👧‍👧 ) or simply P(🏫) = 30/100

Now I want to select one of my friends to dance. I know everyone is refraining again but still I select 🤣. This time I’m selecting from my friends only. So the sample space is given or conditional. Hence, I must write it in the notation to avoid any confusion.

P(👤 | 👫 ) = 1/60

If I check the probability of selecting a school friend then it would be

P(🏫 | 👫 ) = 30/60

Well!! all the performances are still not done. And you can’t hide. So let me do my next selection. This time I will be selecting someone from whole crowd to umm 🤔 …. jump 20 times. My all the friends are excited but all the adults are afraid this time 🤣. What is the probability I select a friend which is from my colony and school both.

P(🏫 ⋂ 🏢) = 10/100

It was quite easy to answer if you visualize this problem as a Venn diagram.

But let’s understand this in mathematical way. You can see in above picture and it is already given in starting that I have 10 common friends from my colony and school. Probability of finding someone from common place is called compound probability.

Some problems are complex and you may not have time to draw the Venn diagram. So there is a formula that can save our time.

P(A ⋂ B) =P(A)⋅P(B|A)

or

P(A ⋂ B) =P(B)⋅P(A|B)

It means,

  1. First calculate the probability of either event, say P(🏫).
  2. Then calculate the probability of happening another event when first event has already happened i.e. P(🏢 | 🏫)

P(🏫 ⋂ 🏢) = P(🏫)⋅ P(🏢 | 🏫) = 40/100 x 10/40 = 10/100

Big Think

If we consider A ⋂ B as a single event, say X, then using the probability formula P(X) = #X/n(S); where n(S) is the universal space, we can state that

A ⋂ B = n(S)P(A)⋅P(B|A)

We can read it as (total number of people invited to the party) times (the probability of someone to be my school friend) times (the probability of someone belongs to my colony provided that he is from my school).

I know you you must have already understood that but I’m trying to build a new thought process.

Did you notice? Every time, size of sample space is reducing. Instead of the number if you have to calculate the probability then you can imagine it like this.

Did you notice? Number of common friends from school and colony are constant and same i.e. 10. But the probability of picking them out of all invited people is lesser than the probability of picking them from only friends. It’ll be more higher if I pick them from the group of colony friends or school friends. This is the difference between compound and conditional probability.

conditional probability ≥ compound probability

This is another illustration for better understanding.

Nested Events Probability

Big Think

With the compound probability formula we can say that

But what we read yet is just to take left side i.e. A in numerator and right side i.e. B in denominator. But there was a condition defined AB. It means, take the potion of A in B and divide it by Total elements in B (including common elements of A). A ⋂ B represents common elements between A & B. In other words A ⋂ B means portion of A in B.

If we elaborate this formula, we can also write

There are 5 friends who live in the same building I live. So this time I want to invite them with closed eyes. I’ll point the finger to someone and let’s check the probability that the person is from my building. Also check what is the probability that the person is not from my building.

  • A is the event that the person is from the same building
  • #A = 5 (favorable outcomes)
  • n(S) = 100

P(A) = 5/100

To check the probability if the person is not from the same building

P(¬A) = 1 — P(A)

  • So it would be P(¬A) = 95/100

Quite high!! So definitely I’ll choose a funny act to perform.

You know what! if you know the probability of an event, you can calculate the number of outcomes as well.

As we know, if A is the subset of B

It can also be written as #A = P(A|B)⋅#B. It means,

  • we know the probability of selecting a school friend from the group of society friends. P(🏫 | 🏢) = 10/40
  • We know the count of friends from society: #B = 40
  • So we can calculate number of school friends among society friends. #A = 10.

Though #A=30 in respect of universal space, we selected #A from a conditional sample space. Hence, #A=10. In other words, 10 is portion of A in B.

Big Think

Check the diagram of the party hall above and tell me what is P( 🏫 | ¬🏢). Here, we’re checking the probability of school friend given that they are in people who are not from my colony.

  • n(🏢) = 40
  • n(¬🏢) = n(S) — n(🏢) = 60

P( 🏫 | ¬🏢) = 20/60

From the compound probability formula, we can also say

P(A)⋅P(B|A) = P(B)⋅P(A|B)

Just remember it. Who knows when you’ll need it.

Big Think

Let’s see the probability formula from a different aspect this time.

Suppose there is a set of 9 numbers.

The probability of finding a number from it’s subset would be

But we can break n(S) into n(E) and n(¬E). So this can be written as following;

Now if we apply the same formula on conditional probability;

Consider A = 🏫, B = 🏢

  • We already know that P(A)​⋅P(B|A) = 10/100 are the common friends
  • P(¬A)=70/100
  • P(B|¬A)=30/70

⇒ P(A|B) = 10/40

Let’s understand it step by step.

  1. P(A|B) means B is our sample space. And we have to select the portion of A in B.
  2. P(A ⋂ B) means the portion of A in B. This is our favorable outcomes. This can also be written as P(A)​⋅P(B|A) as per compound probability formula. In other words, first find P(A) to select outcomes from A area (school) then find P(B|A) to select outcomes of B from A area (colony friends from school ). (check nested events conditional probability explanation above)
  3. Now we have to select colony friends which are not school friends. For this first we will select friends which are not in school i.e. P(¬A) then we’ll select colony friends from P(¬A) i.e. P(¬A)​⋅P(B|¬A)
  4. Now add both probabilities to get P(B)

Now I hope you’re ready to watch the explanation of Bayes theorem by 3Blue1Brown

Disclaimer

All the images, examples and explanation are created by me only. If you feel there is something wrong missing, please comment. If you want to use these images on somewhere, please provide the reference link of this article.

If you really like this post, share it with your friends and clap.

--

--