DEV Community

Cover image for Probability - Independence and Counting
Yadav Prasad G B
Yadav Prasad G B

Posted on

Probability - Independence and Counting

before getting into independence and counting let's see a very interesting topic.


Infinite Independent Events

consider a coin where the probability of getting a head is 1/2^n where n is the ith toss and each time a person does a coin flip the probability of getting heads will be 1/2, 1/4, 1/8.. and so on. what if we were told to find the probability of getting a first heads in a even flip number, we would have probably know the axioms but they don't comply with infinite events so what's the solution? you may ask so if given a problem where there is an infinite series of independent event and told to find the overall probability there comes the geometric series the formula is given in the picture below :

using this newly obtained formula we can derive the probability by finding the P({2, 4, 6,...}) = P(2) + P(4) + P(6) + ...
which is equals to 1/4 + 1/8 + 1/16.. = 1/2^2 + 1/2^4 + 1/2^6 + ...
which equals to 1/3 after applying the formula.

geometric series can be very useful for infinite independent event where they grow and can be ordered sequentially.


Independence

Definition: P(A | B) = P(A) occurrence of B doesn't provide any information about A's occurrence.

We Know that P (A n B) = P(B) * P(A|B)

with Independence : P(A n B) = P(B) * P(A)

with independence rule and multiplicative rule we can write as :

P(A n B | C) = P(A|C) * P(B|C)
Enter fullscreen mode Exit fullscreen mode

where can we see these Independence ?? let's take an example of coin toss where p(getting a heads) = p. if you were told that the first 10 flips are heads does it change your belief about the probability of getting a heads in 11th toss? it's the same probability p for all the events so even though a person flips the toss 10 times that didn't change his initial beliefs about the coin flip in the 11th toss.


How does conditioning may affect independence

Two unfair coins A and B where P(getting an heads | A) = 0.9 and P(getting an heads | B) = 0.1, where the person can choose either coin with equal probability .

Once we know it is coin A, are tosses independent ? : Yes

If we do not know which coin it is are tosses independent then what is the P(11th toss is Heads) = 1/2 * 0.9 + 1/2 * 0.1 = 1/2 now with conditional probability P(1th toss is Heads | first 10 toss is heads) what is the probability of getting an heads in 11th toss answer : ≈ 0.9 we can be certain that the coin A is being flipped from the get go but not 100% sure since coin B can also have a miracle chances of dropping this outcomes but it's just that it is very close to zero precisely (0.1)^10 so applying conditioning affects the relationship between two events it can make two independent events dependent or vice versa...


Basic Counting Principle

Permutations

Permutations : Number of ways of ordering n elements.

so understanding permutations, given that there are n elements in a set how many different arrangements can we made ?? : n! ways

now given a problem that a die is thrown 6 times what is the probability that 6 unique arrangement is made in 6 throws ie. {1,3,2,4,6,5} is one of the unique numbered arrangement

we can solve this by finding total arrangement resulting from throwing a die size times which is sample space (Ω) = 6 * 6 * 6 * 6 * 6 * 6 = 6^6 and from the sample space how many unique arrangements ca be made ??? from the above information we can say that n! ways arrangements can be made which is 6! so the resultant probability is,

|E|       6!
----   = ----    
|Ω|       6^6
Enter fullscreen mode Exit fullscreen mode

Combinations

we know that we if taken n elements we can arrange it in n! ways so what about selecting k in n element set?

which can be rewritten as n!/(n-k)! ways.

assume that number of k - elements subsets if a given n-element set is denoted by C(n,k) or ⁿCₖ

now the number of k different arrangement out of chosen k elements subset from n-elements set is : k!

from the above equation :

k! × C(n,k) = n!/(n-k)!

C(n,k) = n!/[k!(n-k)!]
Enter fullscreen mode Exit fullscreen mode

so there are two ways to come up with this formula n!/(n-k)!


Partitioning

if n elements is partitioned into m1, m2, m3 and m4 the total number of subsets made is

        n!
  ---------------
   m1! m2! m3! m4!
Enter fullscreen mode Exit fullscreen mode

For example if a deck of 52 cards are partitioned into 4 groups of each 13 cards then the number of ways the cards can be distributed is

52!/(13! * 13! * 13! * 13!)
Enter fullscreen mode Exit fullscreen mode

how does it work ??? let's understand intuitively

out of 52 cards if 13 can be selected (52 choose 13), after selecting the first 13 cards we have 39 cards remaining. We select another 13 cards (39 choose 13), after selecting the second group we have 26 cards remaining. We select another 13 cards (26 choose 13), the final 13 cards automatically form the last group (13 choose 13) = 1

So the total number of ways is:

(52 choose 13) × (39 choose 13) × (26 choose 13) × (13 choose 13)

= [52!/(13!×39!)] × [39!/(13!×26!)] × [26!/(13!×13!)] × [13!/(13!×0!)]
Enter fullscreen mode Exit fullscreen mode

Now let's see the cancellation:

  • The 39! in the numerator of the second term cancels with the 39! in the denominator of the first term
  • The 26! in the numerator of the third term cancels with the 26! in the denominator of the second term
  • The 13! in the numerator of the fourth term cancels with the 13! in the denominator of the third term

After all the cancellations we get:

= 52! / (13! × 13! × 13! × 13!)
Enter fullscreen mode Exit fullscreen mode

that's all for now folks, I will catch you up later.....

Top comments (0)