An urn contains 6 red balls. The experiment consists of taking a random ball fro
ID: 3126476 • Letter: A
Question
An urn contains 6 red balls. The experiment consists of taking a random ball from the urn and replacing it with a blue ball. We repeat this till all the balls in the urn are blue. Create a table containing the columns: round number and the probability that the experiment ends exactly at that round. Proceed till the sum of all the probabilities is higher than 0.90. Same as in (a) but this time use Markov chain. First determine the states. Then create Markov diagram and transition matrix. Finally use the transition matrix to create the table up to the point where the sum of the probabilities is higher than 0.99Explanation / Answer
Let the round number be indicated by x and the number of blue balls after that round be indicated by n. Let f(x,n) denote the probability that there are n blue balls after x rounds. As the number of rounds needed for this is huge, we will write a matlab code to solve the problem. We will solve for f(x,n) iteratively. The formula for f(x,n) can be understood from the code. One needs to be careful when n = 6, we want f(x,6) also to denote that the game ended at the xth round. Hence, the term f(x-1,6) is removed while computing f(x,6). It is observed that the probability that the game ends by the 23rd round is just greater than 0.9 and 0.99 just after the 36th round.
Here is the matlab code for the problem:
sizex = 23
f = zeros(sizex,6);
f(1,1) = 1;
f(1,2) = 0;
for x=2:sizex
for n=1:6
if (n ~= 1 && n~=6)
f(x,n) = f(x-1,n-1)*(7-n)/6 + f(x-1,n)*(n/6);
elseif (n == 6 )
f(x,n) = f(x-1,n-1)*(7-n)/6;
else
f(x,n) = f(x-1,n)*(n/6);
end
end;
end;
disp(f)
sum(f(:,6))
//////////////////////////////// end of matlab/octave code//////////////////////////////////
Making the markov chain is simple. You will have 6 states where ith state indicates the number of blue balls present. The transition can be only to the (i+1)th state or to self. The transition probability for the i->(i+1) is
(6-i)/6. From the transition matrix can be easily made. In part(a) of question we have used iterative technique to solve the problem. If you observe the formula f(x,n) only needs information from previous round. In that manner, Markov property has already been incorporated into it.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.