The next program calculates the probability function for the number of times, X, that the ordered pair
Question:
The next program calculates the probability function for the number of times, X, that the ordered pair TH appears when tossing four coins successively (here, H has been coded as “1” and T has been coded as “0”):
In[1]:= n1=1;n2=1;n3=1;n4=1;
Print["List of all outcomes of the experiment"]
res=Flatten[Table[{i1,i2,i3,i4},
{i1,0,n1},{i2,0,n2},{i3,0,n3},{i4,0,n4}],3]
total=Length[res];
Print["Total number of outcomes = ", total]
Do[a[i]=0, {i,0,3}]
Do[y=res[[i]];
suc=Sum[(1-y[[j]])*y[[j+1]],{j,1,3}];a[suc]=a[suc]+1,
{i,1,total}]
Print["Probability function"];
Do[Print[{i,a[i]/total}], {i,0,3}]
List of all outcomes of the experiment Out[3]= {{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{0,1,0,0},\\
{0,1,0,1},{0,1,1,0},{0,1,1,1},{1,0,0,0},{1,0,0,1},\\
{1,0,1,0},{1,0,1,1},{1,1,0,0},{1,1,0,1},{1,1,1,0},\\
{1,1,1,1}}
Total number of outcomes = 16 Probability function {0,5/16}
{1,5/8}
{2,1/16}
{3,0}
Working in a similar way, find the probability functions of the random variables given below:
(i) We toss a coin six times. The random variable X counts the occurrences of the ordered pair HT.
(ii) We toss a coin six times. The random variable X counts the occurrences of two successive tails. Note that for outcomes of the form HHTTTH, TTHTTH, TTHHTT the random variable takes the value 2, for the outcome TTTTHH X takes the value 3, while for the outcome TTTTTT X takes the value 5.
(iii) When we toss a coin six times, X counts the number of times that three successive heads appear (the enumeration of successive heads is similar to that in Part (ii)).
(iv) Suppose we have two red dice and two black ones. We throw the four dice 30 times. The random variable X counts the number of times in which the sum of the two red dice is equal to the sum of the two black dice.
(v) An urn contains 20 balls numbered 1, 2,…, 20, while a second urn contains 30 balls numbered 1, 2,…,
Step by Step Answer:
Introduction To Probability Volume 2
ISBN: 9781118123331
1st Edition
Authors: Narayanaswamy Balakrishnan, Markos V. Koutras, Konstadinos G. Politis