The expectation of discrete random variable is given by Σ(Pi*Xi)
Where Xi = Value of random variable
Pi = Probability of random variable
Let us suppose that if we choose ith element as the minimum element, then we have to choose remaining x-1 element out of remaining elements which are greater than i.
Number of ways to do this is: C(n-i, x-1)
The total number of ways to select x elements out of n is C(n,x).
Thus the probability of event is C(n-i, x-1) / C(n,x).
If it is not possible to select x-1 elements out of remaining elements, then the probability is 0.
Check out the implementation:
Happy Coding :)
Where Xi = Value of random variable
Pi = Probability of random variable
Let us suppose that if we choose ith element as the minimum element, then we have to choose remaining x-1 element out of remaining elements which are greater than i.
Number of ways to do this is: C(n-i, x-1)
The total number of ways to select x elements out of n is C(n,x).
Thus the probability of event is C(n-i, x-1) / C(n,x).
If it is not possible to select x-1 elements out of remaining elements, then the probability is 0.
Check out the implementation:
Happy Coding :)
Comments
Post a Comment