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

Home > Probability
Colored Marble Muse (Posted on 2022-05-07) Difficulty: 3 of 5
Saul, Simon and Stuart each have a bag containing 5 different colored marbles. Each bag contains the same five colors.
o Saul reaches into Simon's bag and Stuart's bag and randomly withdraws a marble from each and places them in his bag.
o Simon then reaches into Saul's and Stuart's bag and randomly withdraws a marble from each and places them in his bag.
o Finally, Stuart reaches into Saul's and Simon's bag and randomly chooses a marble from each and places them in his bag.
Determine the probability that each of the three boys has five different colors of marbles in their bag.

No Solution Yet Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer-aided solution | Comment 2 of 4 |
There are 5 ways Saul could make each of his two choices (choices 1 and 2).

There are 7 ways Simon could make his choice of one of Saul's marbles, and 4 ways of choosing among Stuart's remaining 4 marbles. These are choices 3 and 4.

And each of Stuart's choices is from each of the others' six remaining marbles.

The program lays out the sequences of choices in a list, before all the ways start being made. The list is 25200 rows of six choices each, chosen from the appropriate number of choices at each stage.

Each set is refreshed at the start with colors 1, 2, 3, 4 and 5 in each of the person's bags, and then the choices carried out. 

This method avoids 6-deep nested loops during the playout, with only a 2-deep nesting to set up the sequences.

clearvars
choices=[5 5 7 4 6 6];
list=[]; 
for i=1:choices(1)
   list=[list; i]; 
end
for chPos=2:6
   list(:,chPos)=1;
   hold=list;
   for i=2:choices(chPos)
       hold(:,chPos)=i;
       list=[list; hold];
   end
end
tot=0; succ=0;
for row=1:length(list)
    saul=[1 2 3 4 5];
    simon=[1 2 3 4 5];
    stuart=[1 2 3 4 5];
    takes=list(row,:);
    saul(end+1)=simon(takes(1)); simon(takes(1))=[];
    saul(end+1)=stuart(takes(2)); stuart(takes(2))=[];
    
    simon(end+1)=saul(takes(3)); saul(takes(3))=[];
    simon(end+1)=stuart(takes(4)); stuart(takes(4))=[];
    
    stuart(end+1)=saul(takes(5)); saul(takes(5))=[];
    stuart(end+1)=simon(takes(6)); simon(takes(6))=[];
    
    tot=tot+1;
    if isequal(sort(saul),[1 2 3 4 5]) ...
       && isequal(sort(simon),[1 2 3 4 5]) ...
        && isequal(sort(stuart),[1 2 3 4 5])   
      succ=succ+1;
    end
end
 
fprintf('%7d %7d %15.13f %15.13f \n',succ, tot, succ/tot, tot/succ)
disp(sym(succ)/sym(tot))

finds

   1040   25200 0.0412698412698 24.2307692307692 
13/315

That is, 1040 successes out of the total of 25200 equally possible ways it could take place, for a probability of approximately 0.0412698412698 or 1 / 24.2307692307692.  The exact probability is 13/315, the reduced form of 1040/25200

I simulation with random choices is a good check. 

Simulation with random choices agrees:

 tot=0; succ=0;
 for i=1:200000
    saul=[1 2 3 4 5];
    simon=[1 2 3 4 5];
    stuart=[1 2 3 4 5];
    takes=randi(length(simon));
    saul(end+1)=simon(takes); simon(takes)=[];
    takes=randi(length(stuart));
    saul(end+1)=stuart(takes); stuart(takes)=[];
    
    takes=randi(length(saul));
    simon(end+1)=saul(takes); saul(takes)=[];
    takes=randi(length(stuart));
    simon(end+1)=stuart(takes); stuart(takes)=[];
    
    takes=randi(length(saul));
    stuart(end+1)=saul(takes); saul(takes)=[];
    takes=randi(length(simon));
    stuart(end+1)=simon(takes); simon(takes)=[];
    
    tot=tot+1;
    if isequal(sort(saul),[1 2 3 4 5]) ...
       && isequal(sort(simon),[1 2 3 4 5]) ...
        && isequal(sort(stuart),[1 2 3 4 5])   
      succ=succ+1;
    end
 end
 fprintf('%7d %7d %15.13f %15.13f \n',succ, tot, succ/tot, tot/succ)
disp(sym(succ)/sym(tot))

   8244  200000 0.0412200000000 24.2600679281902 
2061/50000

  Posted by Charlie on 2022-05-07 13:24:06
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 (14)
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