All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
Spider and Fly #2 (Posted on 2024-10-31) Difficulty: 2 of 5
A spider eats N flies a day. Until the fly fills his quota, a fly has 45% chance of survival if he attempts to pass a web.

Assume the M flies (M>N) have already made the attempt to pass. What is the probability that the (M+1)st fly will survive the attempt?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution proposed solution Comment 1 of 1
The probability of the complement, that is, that the spider will be eaten, is the sum from i = 0 to N-1 of the probability that exactly i flies have already been eaten, leaving the spider still hungry, multiplied by .55:

.55 * Sigma{i=0 to N-1} (.55^i * .45^(M-i) * C(M,i))

so the probability requested is

1 - .55 * Sigma{i=0 to N-1} (.55^i * .45^(M-i) * C(M,i))

Implementing this:

clc
fprintf('  ')
for m=1:15
  fprintf('  %2d  ',m)
end
disp(' ')
for n=1:20
  fprintf('%2d',n)
  for m=1:15
    fprintf(' %5.3f',prob(m,n))
  end
  disp(' ')
end

function p=prob(M,N)
  p=0;
  if M<N
    p=.45;
  else
    for i=0:N-1
      p=p+(.55^i * .45^(M-i) * nchoosek(M,i));
    end   
    p=1-p*.55;
  end
end

It includes the 0.45 probability the fly escapes if M<N

             Probability the fly escapes
  \       M
 N | 1     2     3     4     5     6     7     8     9    10    11    12    13    14    15   
   |
 1 0.752 0.889 0.950 0.977 0.990 0.995 0.998 0.999 1.000 1.000 1.000 1.000 1.000 1.000 1.000 
 2 0.450 0.616 0.766 0.867 0.928 0.962 0.980 0.990 0.995 0.998 0.999 0.999 1.000 1.000 1.000 
 3 0.450 0.450 0.542 0.665 0.776 0.860 0.916 0.951 0.973 0.985 0.992 0.996 0.998 0.999 0.999 
 4 0.450 0.450 0.450 0.500 0.591 0.693 0.785 0.857 0.909 0.944 0.966 0.980 0.989 0.994 0.997 
 5 0.450 0.450 0.450 0.450 0.478 0.540 0.624 0.712 0.792 0.856 0.904 0.939 0.962 0.977 0.986 
 6 0.450 0.450 0.450 0.450 0.450 0.465 0.506 0.571 0.649 0.727 0.798 0.857 0.902 0.935 0.958 
 7 0.450 0.450 0.450 0.450 0.450 0.450 0.458 0.485 0.532 0.596 0.668 0.740 0.804 0.858 0.900 
 8 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.455 0.471 0.505 0.555 0.617 0.685 0.750 0.809 
 9 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.453 0.463 0.486 0.524 0.575 0.636 0.699 
10 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.451 0.458 0.473 0.501 0.542 0.593 
11 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.451 0.455 0.465 0.485 0.516 
12 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.453 0.459 0.473 
13 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.452 0.456 
14 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.451 
15 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 
16 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 
17 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 
18 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 
19 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 
20 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 0.450 
>> 

  Posted by Charlie on 2024-10-31 10:02:16
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information