What's wrong in this approach for Field Trip problem?

I got the following formula for finding the probability: (s-k-1 C n-k-1) * (m-1 C k) / (s-1 C n-1)
I calculated the above result using Bayes theorem:

P(Alice|k) = s-k-1 C n-k-1 / s-k C n-k

P(k) = (m-1 C k * s-k C n-k) / s C n

P(Alice) = s-1 C n-1 / s C n

P(k|Alice) = P(Alice|k) * P(k)/ P(Alice)

Can someone please point out the mistake?

1 Like

If I understood you well, you calculated probability “for K”, but you have to perform the same for K+1, K+2, …, M while we are interested in

…there are atleast K of her friends with her on the trip…

3 Likes

my bad! but can I extend this idea by iterating over the values k,k+1,…m or there exists some simpler method than this?

I didn’t find simpler approach, but maybe there is some, we will see when editorials are available.

Yes this is the approach that is expected (Most probably )and @rbaid yes u can extend this approach for k,k+1… iterate the same formula over k,k+1… :slight_smile:

total = ncr(s-1,n-1)	
for x in range (k,m):
if s-m >= n-1-x and m-1 >=x:
	if n-1-x>=0:
		result = result + (ncr(m-1,x)*ncr(s-m,n-1-x))
			#print(result)
	else:
		break	
print(result/total)
3 Likes

@rakeshbubli143 Can you please explain how the events are independent? (k, k+1, … m)

@rbaid >> in any case exactly one event will take place: either her k friends will go with her OR k+1 friends or k+2 friends … OR m friends, as the condition is at least k friends.

@rbaid
Expected : calculating the probability for which alice will be happy what u r calculating : probability that K of her friends will go for picnic

but she will be happy even if K+1 friends go for picnic and k+2… till M so just apply the same formula to calculate the probability and add them all

Ur formula is correct for k and it will be same for k+1 too :slight_smile: