Ch3. Expected values

advertisement
74
Chapter 3. Expected values
Problem PP61
Consider the random variable X in Problem PP41.
1. Compute the expected value, the variance and the standard deviation of X.
Report values of X in the range A2:A5, the probabilities in B2:B5. The
expected value in cell D2: = π‘†π‘ˆπ‘€π‘ƒπ‘…π‘‚π·π‘ˆπΆπ‘‡(𝐴2: 𝐴5; 𝐡2: 𝐡5). The variance
in cell D3: = π‘†π‘ˆπ‘€π‘ƒπ‘…π‘‚π·π‘ˆπΆπ‘‡(𝐴2: 𝐴5; 𝐴2: 𝐴5; 𝐡2: 𝐡5) − 𝐷2 ∗ 𝐷2. The
standard deviation in cell D4: = 𝑆𝑄𝑅𝑇(𝐷3).
Answer: 𝐸(𝑋) = 2.05 π‘‘π‘Žπ‘¦π‘ , πœŽπ‘‹2 = 0.7475 π‘‘π‘Žπ‘¦π‘  2 , πœŽπ‘‹ = 0.8646 π‘‘π‘Žπ‘¦π‘ ;
2. Generate 500 values of X: sample size 1 to 500 in the range A2:A501, random
numbers in the range B2:B501, the values of X in the range C2:C501.
Example for cell C2: = 𝐼𝐹 (𝐡2 < 0.3; 1; 𝐼𝐹(𝐡2 < 0.7; 2; 𝐼𝐹(𝐡2 < 0.95; 3; 4))).
In column D compute the moving average as the sample size increases.
Example for cell D2: = 𝐴𝑉𝐸𝑅𝐴𝐺𝐸(𝐢$2: 𝐢2). Drag cell D2 to cell D501 (the
average is computed for all samples of size 1, 2, …,500).
In a similar way compute the sample variances in column E. Example for cell
E3: = 𝑉𝐴𝑅. 𝑆(𝐢$2: 𝐢3).
Compute the sample standard deviations in column F. Example for cell F3:
= 𝑆𝑇𝐷𝐸𝑉. 𝑆(𝐢$2: 𝐢3) or = 𝑆𝑄𝑅𝑇(𝐸3);
3. Make a graphical representation of the sample means as a function of the
sample size by using the Scatter with straight lines option. Also draw a
horizontal line for the expected value. To construct a horizontal line, add a
Series to the graph. The series is constructed as follows: the values 1 and 500
in successive cells, say H13:H14, the expected value 2.05 in cells I13 and I14;
4. Construct graphical representations for the variance and the standard deviation
similar to Step 3. Repeat the simulation several times (key F9).
Assignment PA61
Consider Assignment PA41. Compute the expected value, the variance and the
standard deviation of Y.
Simulate 500 rolls of the dice and compute sample means, variances and standard
deviations of Y as a function of the number of rolls.
Make graphical representations as in Steps 3 and 4 above.
75
Problem PP62
Consider the random variable X in Problem PP41.
1. Use Excel to compute the median and the coefficient of skewness of X. Use as
coefficient of skewness π‘š3 ⁄𝜎 3 where π‘š3 = ∑π‘˜π‘–=1(π‘₯𝑖 − πœ‡)3 ∗ 𝑝(π‘₯𝑖 ) for a
discrete random variable X that can take on the values π‘₯1 , π‘₯2 , … , π‘₯π‘˜ , πœ‡ is the
expected value of X and 𝜎 is the standard deviation.
Report the values of X in the range A2:A5, the corresponding probabilities in
the range B2:B5. Compute the expected value of X in cell E2, the standard
deviation in cell E5 and the terms (π‘₯𝑖 − πœ‡)3 in the range C2:C5. Example for
cell C2: = π‘ƒπ‘‚π‘ŠπΈπ‘…(𝐴2 − 𝐸$2; 3) and likewise for cells C3:C5. Compute the
coefficient of skewness in cell E7: =
π‘†π‘ˆπ‘€π‘ƒπ‘…π‘‚π·π‘ˆπΆπ‘‡(𝐢2: 𝐢5; 𝐡2: 𝐡5)⁄π‘ƒπ‘‚π‘ŠπΈπ‘…(𝐸5; 3).
Answer: π‘šπ‘’π‘‘π‘–π‘Žπ‘› = 2, π‘ π‘˜π‘’π‘€π‘›π‘’π‘ π‘  = 0.3679;
2. Generate 500 values of X: sample size 1 to 500 in the range A2:A501, random
numbers in B2:B501, values of X in C2:C501 (see Problem PP61). Compute
the sample medians in column D. Example for cell D2: = 𝑀𝐸𝐷𝐼𝐴𝑁(𝐢$2: 𝐢2)
and drag to cell D501 (the median is computed for all samples of size 1, 2,
…,500).
Compute all coefficients of sample skewness in column E. Example for cell
E4: = π‘†πΎπΈπ‘Š(𝐢$2: 𝐢4) and drag to cell E501;
3. Make a graphical representation of the sample medians as a function of the
sample size (see Problem PP61). Draw a horizontal line for the median of X in
the same graph.
Similarly make a graphical representation for the skewness. Repeat the
simulation several times (key F9).
Assignment PA62
Consider Assignment PA41. Compute the median and the coefficient of skewness of
Y.
Simulate 500 rolls of the dice and compute sample medians and coefficients of
skewness as a function of the number of rolls.
Make graphical representations as in Step 3 above.
76
Problem PP63
Consider the random variable X in Problem PP41. Two measures of the quality of the
deliveries are considered: 𝑄1 = 12 − 2 ∗ 𝑋 and 𝑄2 = 10 − (𝑋 − 1)2 .
1. Derive the pmf of 𝑄1 and 𝑄2 .
Answer:
π‘ž1
𝑝(π‘ž1 )
4
0.05
6
0.25
8
0.40
10
0.30
π‘ž2
𝑝(π‘ž2 )
1
0.05
6
0.25
9
0.40
10
0.30
2. Compute the expected value, the variance and the coefficient of skewness cos
of 𝑄1 and 𝑄2 using the pmf’s derived in Step 1 (see Problems PP61 and
PP62).
Compute the expected value, the variance and the coefficient of skewness of
𝑄1 using the expected value, the variance and the coefficient of skewness of X
and the fact that 𝑄1 is a linear function of X.
Answer:
𝐸(𝑄1 ) = 7.9, πœŽπ‘„21 = 2.99, π‘π‘œπ‘ (𝑄1 ) = −0.3679;
𝐸(𝑄2 ) = 8.15, πœŽπ‘„22 = 5.0275, π‘π‘œπ‘ (𝑄2 ) = −1.6514;
3. Simulate the problem as follows: sample size 1 to 500 in cells A2:A501,
random numbers in cells B2:B501, values of X in cells C2:C501 (see Problem
PP61), values of 𝑄1 in cells D2:D501 using the values of X in column C,
values of 𝑄2 in cells E2:E501, sample means of 𝑄1 in cells F2:F501 as a
function of the sample size (as in Problem PP61), sample variances of 𝑄1 in
cells G3:G501, coefficients of skewness of 𝑄1 in cells H4:H501, sample
means of 𝑄2 in cells I2:I501, sample variances of 𝑄2 in cells J3:J501,
coefficients of skewness of 𝑄2 in cells K4:K501;
4. Make graphical representations of the sample means of 𝑄1 and 𝑄2 as a
function of the sample size by using the Insert\Scatter\Scatter with straight
lines option. Also draw horizontal lines for the expected values of 𝑄1 and 𝑄2 .
Construct similar graphs for the variances and the coefficients of skewness.
Repeat the simulation several times (key F9).
Assignment PA63
Repeat Steps 1 to 4 above for the quality measure 𝑄3 = 10 − 2 ∗ √𝑋 − 1.
77
Problem PP64
Consider the random variable X in Problem PP41. Assume the possible values of X
remain fixed, but you can change the probabilities.
1. Intuitively, which pmf would you consider to have the largest possible
variance?
Answer:
X
p(x)
1
0.5
2
0
3
0
4
0.5
2. Check your answer in Step 1 by using the Solver of Excel as follows: the
values of X in cells A2:A5, the probabilities in B2:B5, the sum of the
probabilities in cell B6: = π‘†π‘ˆπ‘€(𝐡2: 𝐡5).
Compute the expected value of X in cell A7: =
π‘†π‘ˆπ‘€π‘ƒπ‘…π‘‚π·π‘ˆπΆπ‘‡(𝐴2: 𝐴5; 𝐡2: 𝐡5).
Compute the variance of X in cell A8: =
π‘†π‘ˆπ‘€π‘ƒπ‘…π‘‚π·π‘ˆπΆπ‘‡(𝐴2: 𝐴5; 𝐴2: 𝐴5; 𝐡2: 𝐡5) − 𝐴7 ∗ 𝐴7.
Use the Solver to maximize cell A8, allowing cells B2:B5 to change. Add the
restrictions that all probabilities must be nonnegative and that their sum must
equal 1;
3. Use the Solver as in Step 2 but add the restriction that the expected value of X
can be at most 2.
Answer:
x
p(x)
1
2/3
2
0
3
0
4
1/3
Assignment PA64
Consider the experiment of rolling a (false) die. Intuitively, which pmf would you
expect to have maximal variance if the probability of each outcome should be at least
equal to 0.1. Verify your answer by using the Solver of Excel.
Assume you would like to maximize the expected value of the outcome of rolling a
(false) die. How should you select the probabilities when all probabilities must equal
at least .1 and the variance of the outcome must be the same as the variance of the
outcome of a fair die. Use the Solver to solve this problem.
78
Problem PP65
Consider Problem PP42.
1. Compute the expected value, the variance and the standard deviation of the
score X of player A.
Answer:
𝐸(𝑋) = 161⁄36, πœŽπ‘‹2 = 1.9715, πœŽπ‘‹ = 1.4041;
2. Simulate the game over 1000 lines as in Problem PP42.
Use the simulated data to compute an estimate of the expected value, the
variance and the standard deviation of the score of player A.
Compare the results to the exact values in Step 1.
Assignment PA65
Consider Assignment PA42. Compute the expected value, the variance and the
standard deviation of the ratio of the larger of both outcomes to the smaller one.
Compute estimated values of these parameters using a simulation over 2000 lines.
Compare the estimated values to the exact population values.
79
Problem PP66
1.
Consider Problem PP44.
Compute the expected value, the variance and the standard deviation of the
variable X.
Answer:
𝐸(𝑋) = 4.75, πœŽπ‘‹2 = 1.9097, πœŽπ‘‹ = 1.3819 ;
2. Simulate the game over 1000 lines as in Problem PP44.
Compute an estimate of the expected value, the variance and the standard
deviation of X.
Compare the results to the exact values in Step 1.
Assignment PA66
Consider Assignment PA44. Compute the expected value, the variance and the
standard deviation of the random variable X.
Compute estimated values of these parameters using a simulation over 1000 lines.
80
Problem PP67
Consider Problem PP46.
1. It is not obvious to intuitively estimate the exact expected value of X. Make a
guess anyway;
2. Compute the expected value, the variance and the standard deviation of the
variable X.
Answer:
𝐸(𝑋) = 1.75, πœŽπ‘‹2 = 0.7875, πœŽπ‘‹ = 0.8874;
3. Compute the expected value, the variance and the standard deviation of the
variable Y.
Answer:
𝐸(π‘Œ) = 3.5, πœŽπ‘‹2 = 1.05, πœŽπ‘‹ = 1.0247;
4. Simulate the game over 1000 lines as in Problem PP46. Compute an estimate
of the expected value, the variance and the standard deviation of variables X
and Y.
Compare the results to the exact values in Step 2 and 3.
Assignment PA67
Consider Assignment PA46.
Compute the expected value, the variance and the standard deviation of the random
variable X.
Compute estimated values of these parameters using a simulation over 1000 lines.
81
Problem PP68
Consider Problem PP47.
1. Compute the expected value, the variance and the standard deviation of the
amount received.
Answer:
𝐸(𝑋) = 2.999, πœŽπ‘‹2 = 5.241, πœŽπ‘‹ = 2.2893;
2. Simulate the process over 1000 lines as in Problem PP47.
Compute an estimate of the expected value, the variance and the standard
deviation of the amount received.
Compare the results to the exact values in Step 1.
Assignment PA68
Consider Assignment PA47. Compute the expected value, the variance and the
standard deviation of the amount received.
Compute estimated values of these parameters using a simulation over 1000 lines.
Compare the estimated values to the exact population values.
82
Problem PP69
Consider Problem PP48.
1. Compute the expected value, the variance and the standard deviation of the
variable X.
Answer:
𝐸(𝑋) = 4.2253, πœŽπ‘‹2 = 1.5264, πœŽπ‘‹ = 1.2355;
2. Simulate the process over 1000 lines as in Problem PP48. Compute an
estimate of the expected value, the variance and the standard deviation of X.
Compare the results to the exact values in Step 1.
Assignment PA69
Consider Assignment PA48. Compute the expected value, the variance and the
standard deviation of X.
Compute estimated values of these parameters using a simulation over 1000 lines.
Compare the estimated values to the exact population values.
83
Problem PP70
Consider Problem PP49.
1. Compute the expected value, the variance and the standard deviation of the
position X of the drunk after 4 minutes of walking.
Answer: 𝐸(𝑋) = 2, πœŽπ‘‹2 = 3, πœŽπ‘‹ = 1.732;
2. Simulate the process over 1000 lines as in Problem PP49.
Compute an estimate of the expected value, the variance and the standard
deviation of the position of the drunk.
Compare the results to the exact values in Step 1.
Assignment PA70
Consider Assignment PA49.
Compute the expected value, the variance and the standard deviation of the position of
the drunk.
Compute estimated values of these parameters using a simulation over 1000 lines.
84
Problem PP71
Consider Problem PP50.
1. Compute the expected value, the variance and the standard deviation of
demand D.
Answer: 𝐸(𝐷) = 92.5, 𝜎𝐷2 = 178.75, 𝜎𝐷 = 13.3697;
2. Compute the expected value, the variance and the standard deviation of the
profit P.
Answer: 𝐸(𝑃) = 4700, πœŽπ‘ƒ2 = 90000, πœŽπ‘ƒ = 300;
3. Simulate 1000 demands as in Problem PP50. Compute an estimate of the
expected value, the variance and the standard deviation of demand and profit.
Compare the results to the exact values in Step 1 and 2.
Assignment PA71
Consider Assignment PA50. Compute the expected value, the variance and the
standard deviation of the quality measure Q.
Compute estimated values of these parameters using a simulation over 1000 lines.
85
Problem PP72
Consider Problem PP52.
1. Compute the expected value, the variance and the standard deviation of the
second integer X.
Answer:
𝐸(𝑋) = 7.75, πœŽπ‘‹2 = 5.1875, πœŽπ‘‹ = 2.2776;
2. Simulate 1000 values of X as in Problem PP52. Compute an estimate of the
expected value, the variance and the standard deviation of X.
Compare the results to the exact values in Step 1.
Assignment PA72
Consider Assignment PA52. Compute the expected value, the variance and the
standard deviation of the second number X.
Compute estimated values of these parameters using a simulation over 1000 lines.
86
Problem PP73
Consider Problem PP54.
1. Compute the expected value, the variance and the standard deviation of your
gain X.
Answer: 𝐸(𝑋) = 6, πœŽπ‘‹2 = 58, πœŽπ‘‹ = 7.6158;
2.
Simulate the experiment 1000 times as in Problem PP54.
Compute an estimate of the expected value, the variance and the standard
deviation of your gain.
Compare the results to the exact values in Step 1.
Assignment PA73
Consider the problem above but you toss the coin at most ten times. When no “H” is
tossed after 10 tosses, you win € 211 = 2048.
Compute the expected value, the variance and the standard deviation of your gain.
Show that the expected value equals the maximal number of tosses plus 2.
Compute estimated values of these parameters using a simulation over 1000 lines.
Notice the (often) poor estimates for the variance (and even the expected value) of the
gain (intuitive explanation?).
Compare the results to the case of tossing the coin at most four times.
87
Problem PP74
Consider Problem PP55.
1. Compute the expected value, the variance and the standard deviation of X and
Y.
Answer:
𝐸(𝑋) = 11⁄3 , πœŽπ‘‹2 = 8⁄9 , πœŽπ‘‹ = √8⁄9
𝐸(π‘Œ) = 10⁄3 , πœŽπ‘Œ2 = 32⁄9 , πœŽπ‘Œ = √32⁄9;
2. Generate 500 values of X and Y as in Problem PP55. Make a graphical
representation of the sample means of X and Y as a function of the sample size
by using Insert\Scatter\Scatter with straight lines (see Problem PP61). Include
horizontal lines for the expected values of X and Y.
Do likewise for the sample variances.
Assignment PA74
Consider Assignment PA55.
Apply Steps 1 and 2 above to the random variables X and Y.
88
Problem PP75
Consider Problem PP56.
1. Compute the expected value, the variance and the standard deviation of X, Y
and V.
Answer:
𝐸(𝑋) = 1⁄2 , πœŽπ‘‹2 = 1⁄12 , πœŽπ‘‹ = √1⁄12
𝐸(π‘Œ) = 2⁄3 , πœŽπ‘Œ2 = 1⁄18 , πœŽπ‘Œ = √1⁄18
𝐸(𝑉) = 1⁄3 , πœŽπ‘‰2 = 4⁄45 , πœŽπ‘‰ = √4⁄45;
2. Generate 500 values of X, Y and V.
Make a graphical representation of the sample means of X, Y and V as a
function of the sample size (see Problem PP61). Include horizontal lines for
the expected values of X, Y, and V.
Do likewise for the sample variances.
Assignment PA75
Consider Assignment PA56.
Apply Steps 1 and 2 above to the random variables X, Y and V.
89
Problem PP76
Consider Problem PP58.
1. Compute the expected value, the variance and the standard deviation of the
circumference Y and the area W.
Answer:
𝐸(π‘Œ) = 3πœ‹, πœŽπ‘Œ2 = πœ‹ 2 ⁄3 , πœŽπ‘Œ = πœ‹⁄√3;
7
34
34
𝐸(π‘Š) = 3 πœ‹, πœŽπ‘Œ2 = 45 πœ‹ 2 , πœŽπ‘Œ = √45 πœ‹;
2. Generate 500 values of Y and W as in Problem PP58.
Make a graphical representation of the sample means of X and W as a function
of the sample size (see Problem PP61). Include horizontal lines for the
expected values of Y and W.
Do likewise for the sample variances.
Assignment PA76
The side of a cube is a random number between 0 and 1. Derive the pdf of the area Y
and the volume W of the cube.
Compute the expected value and the variance of Y? What is the expected value and
the variance of W?
Generate 500 values of Y and W. Make a graphical representation of the sample
means of X and W as a function of the sample size (see Problem PP61). Include
horizontal lines for the expected values of Y and W.
Do likewise for the sample variances.
90
Problem PP77
1. A random variable X has pdf 𝑓(π‘₯) = 1, 0 < π‘₯ < 1.
Verify that the expected value of π‘Œ = 1⁄𝑋 equals +∞ (or, does not exist);
2. Simulate the problem: generate 2000 values of X in the range A2:A2001 and
the corresponding values of Y in the range B2:B2001.
Compute the sample means of the Y-values as a function of the sample size in
cells C2:C2001.
Make a graphical representation of the evolution of the sample means as a
function of the sample size (see Problem PP61). Repeat your simulation a
number of times. Discuss your findings in view of your answer in Step 1.
Assignment PA77
Repeat Steps 1 and 2 above replacing the expected value (and sample mean) by the
median. Compare with the result for the mean in Step 2 above.
91
Problem PP78
Consider the problem described in PP51.
1. Let X be the number of rounds played. Possible values of X are 1, 2, …,r.
Compute the expected number of rounds that will be played as a function of N
and r.
1
Answer: π‘ž [1 − (1 − π‘ž)π‘Ÿ ] where π‘ž = 𝑁 ∗ (1⁄2)𝑁−1 ;
2. Compute using Excel the expected values derived in Step 1 for π‘Ÿ = 5 and 𝑁 =
3, 4, … , 25;
3. Simulate the problem for 𝑁 = 5 and π‘Ÿ = 5. The results of the five tosses of
round 1 in cells A2:A6: = 𝐼𝐹(𝑅𝐴𝑁𝐷( ) < .5; "𝐻";"𝑇"). Likewise for the
(possible) next rounds in columns B, C, D, E.
In cell A7, we mark 1 if a victim has been found in the first round:
= 𝐼𝐹(𝑂𝑅(πΆπ‘‚π‘ˆπ‘π‘‡πΌπΉ(𝐴2: 𝐴6; "𝐻") = 1; πΆπ‘‚π‘ˆπ‘π‘‡πΌπΉ(𝐴2: 𝐴6; "𝐻") = 4); 1; "").
Mark a 2, 3, 4 in cells B7, C7, D7 in a similar way for the next rounds. Mark a
5 in cell E7 when the range A7:D7 is empty, otherwise leave cell E7 empty.
The number of rounds played can now be computed in cell H2:
= 𝑀𝐼𝑁(𝐴7: 𝐸7).
Use the TABLE option to generate the process 1000 times in the range
H2:H1001.
Compute the average number of rounds over the 1000 processes.
Repeat the simulation a number of times and compare the average number of
rounds with the expected value computed in Step 2 for 𝑁 = 5 and π‘Ÿ = 5.
Assignment PA78
Three persons A, B and C order a coffee. The cost of a coffee is € 2. They then roll a
die and the total bill of € 6 is paid by the person(s) who gets the smallest outcome on
the dice. When the smallest outcome is not unique, the bill is evenly split among those
that roll the smallest outcome.
Derive the pmf of the amount that person A will have to pay.
Intuitively what do you think is the expected value of the amount that person A will
have to pay? Compute the expected value using the pmf derived.
Simulate this process over 1000 lines and compute the average amount that person A
has to pay. Compare the average value with the expected value.
92
Problem PP79
400 dice are rolled. Player P1 then rolls one die. Assume the face of P1’s die is π‘₯. P1
receives all dice with a face value of at most π‘₯ − 2. Next a second player P2 rolls a
die. Assume the face value of P2’s die is y. P2 receives all the dice not received by
P1 and with face value at most y.
1. Take randomly one die from the 400 dice. Compute the probability that P1
(P2) will receive that die.
Answer: 𝑃(𝑃1) = 10⁄36, 𝑃(𝑃2) = 19⁄54;
2. How many dice does P1 (P2) expect to receive?
Answer: 𝐸(𝑃1) = 1000⁄9 = 111.111, 𝐸(𝑃2) = 3800⁄27 = 140.7407;
3. Simulate the problem. Report the outcome of 400 dice in the range A2:A401,
the outcome of P1’s roll in cell B2. In the range C2:C401, mark 1 when P1
receives the die in the corresponding cell in column A.
Report the outcome of P2’s roll in cell D2. In cells E2:E401, mark 1 when P2
receives the die in the corresponding cell in column A. Example for cell E2:
= 𝐼𝐹(𝐴𝑁𝐷($𝐷$2 ≥ 𝐴2; 𝐢2 = 0); 1; 0).
Compute the number of dice received by P1 in cell G2, the number of dice
received by P2 in cell H2.
Use the TABLE option to repeat the process 1000 times in columns G and H.
Compute in cell J2 the average number of dice received by P1, in cell K2 the
average number received by P2.
Compare the average numbers of dice received by P1 and P2 with the
expected values computed in Step 2.
Assignment PA79
Consider Problem PP19. Assume 𝐾 = 160. How many coins does P5 expect to
receive?
How many coins are expected to be left after 5 rounds?
Simulate the problem using the TABLE option over 1000 lines. Derive estimates of
the expected number of coins received by P5 and the expected number left after 5
rounds.
Compare the estimates with the expected values.
93
Problem PP80
Every day a bus drives from point A to point B over a distance of 100 km. The bus
may break down. A repair station is available at A and B and a third station has to be
built between A and B, say at point C. When the bus breaks down, the bus is towed to
the nearest repair station. The objective is to build the third station in such a way that
the expected towing distance is minimal. Let Y represent the distance in km between
A and the point where the bus breaks down. Assume the pdf of Y equals
𝑓(𝑦) = 1⁄100 , 0 < 𝑦 < 100
1. Where do you intuitively expect the repair station should be built? What do
you think the expected towing distance to be for this location?
2. Compute the expected towing distance as a function of x, with x the distance
from location A to location C.
Minimize this expected value with respect to x. Compute the expected towing
distance for this optimal location.
Answer:
𝐸(π‘‘π‘œπ‘€π‘–π‘›π‘” π‘‘π‘–π‘ π‘‘π‘Žπ‘›π‘π‘’) = 1⁄100 ∗ (π‘₯ 2 ⁄2 − 50π‘₯ + 2500), minimal at
π‘₯ = 50, expected towing distance = 12.5 km;
3. Simulate the problem. Report any value for x in cell B1, the distance from A
to C, say 70. Generate values of Y in cells A2:A1001: = 100 ∗ 𝑅𝐴𝑁𝐷( ).
Compute the towing distance in B2:B1001 when the third station is located at
C. Example for cell B2:
= 𝐼𝐹 (𝐴2 <
𝐡$1
2
; 𝐴2; 𝐼𝐹 (𝐴2 < 𝐡$1; 𝐡$1 − 𝐴2; 𝐼𝐹 (𝐴2 <
𝐡$1
2
+ 50; 𝐴2 − 𝐡$1; 100 − 𝐴2))).
Compute the average value of cells B2:B1001.
Change the value in cell B1 to different values between 0 and 100. For the
value 50, compare the average towing distance with the expected towing
distance computed in Step 2.
Assignment PA80
Change the pdf of Y in the problem above to
𝑓(𝑦) = 𝑦⁄5000, 0 < 𝑦 < 100.
Intuitively, what do you think will happen with the location of repair station C
compared to the location above? Will the optimal value of x increase/decrease/remain
unchanged? Why? What will happen to the expected towing distance? Will it
increase/decrease/remain unchanged? Why?
Repeat Steps 2 and 3 above for the new pdf of Y (to derive the optimal value of x from
the expected towing distance, use the Solver of Excel).
94
Problem PP81
A large number N of people will be tested for a virus by taking a blood test. All
individuals can be tested separately. In that case, N blood tests have to be conducted.
The N people can also be divided randomly into N k groups of size π‘˜ ≥ 2 (assume
for simplicity N k to be integer). A mixture of the blood of k people in a group is
tested. If no virus is found, nobody in the group carries the virus and just one test
suffices for that group. If the virus is found, all k individuals of the group will be
tested, hence π‘˜ + 1 tests have to be conducted for that group. Assume a probability p
that a person carries the virus (and π‘ž = 1 − 𝑝 that he/she does not).
1. What is the probability that only one test is needed for a group of k people?
Answer: (1 − 𝑝)π‘˜ ;
2. What is the probability that π‘˜ + 1 tests will be needed for a group of k people?
Answer: 1 − (1 − 𝑝)π‘˜ ;
3. Compute the expected number of tests that will be needed for a group of k
people as a function of k.
Answer: π‘˜ + 1 − π‘˜ ∗ (1 − 𝑝)π‘˜ ;
4. Compute the expected number of tests that will have to be performed for all N
people as a function of k.
Answer: (𝑁⁄π‘˜) ∗ [π‘˜ + 1 − π‘˜ ∗ (1 − 𝑝)π‘˜ ];
5. Let 𝑁 = 4800 and 𝑝 = 0.001. Use the Solver to compute an optimal value of k.
How many tests do we expect to save, as a percentage, when comparing this
approach to the case of testing all individuals?
Answer:
π‘˜ ∗ = 32, 𝐸(π‘›π‘’π‘šπ‘π‘’π‘Ÿ π‘œπ‘“ 𝑑𝑒𝑠𝑑𝑠) = 301.243, 𝐸(π‘ π‘Žπ‘£π‘–π‘›π‘”) = 93.724%.
Assignment PA81
In the land of Nirwana all company workers get a day off when at least one of the
company workers has his/her birthday. All other days of the year they are active (have
to work). Assume no leap year in Nirwana so that every year has 365 days. People are
randomly hired by companies and births are independent with equal probabilities for
all days of the year.
When a company has x workers, what is the probability that the workers will be active
on a random day of the year?
What is the probability that all workers will get a day off on a random day of the
year?
What is the expected number of active workers on a random day for a company with x
workers?
What is the expected number of active workers for the whole year?
Use the Solver to compute the number of workers x the company should hire in order
to maximize the expected number of active workers for the whole year.
95
Problem PP82
John remembers having agreed to meet his girlfriend Mary at some time between 6
pm and 7 pm but he does not remember the exact time. Therefore he assumes the
minutes Mary will arrive after 6 pm to be a random variable X with pdf
𝑓(π‘₯) = 1⁄60, 0 < π‘₯ < 60.
1. Assume John decides to go to the meeting place at 6.15 pm. Compute his
expected waiting time W. Answer: 135/8 minutes;
2. John starts worrying about his girlfriend having to wait. Therefore he assumes
a penalty 𝑔2 when his girlfriend has to wait g minutes and a penalty b when he
has to wait b minutes. Compute the expected penalty when he decides to go to
the meeting place at 6.15 pm. Answer: 35.625;
3. Under the assumptions in Step 2, at what time should John go to the meeting
place when he decides to minimize the expected penalty?
Hint: derive the expected penalty as a function of his arrival time Y (minutes
after 6 pm) and minimize this expected penalty (you can use the Solver).
Answer:
𝐸(π‘π‘’π‘›π‘Žπ‘™π‘‘π‘¦) = 1⁄360 ∗ [2𝑦 3 + 3 ∗ (60 − 𝑦)2 ]
𝑦∗ =
−1+√241
2
= 7.262 minutes after 6 pm;
4. Simulate the problem.
Generate arrival times of Mary in the range A2:A1001: = 60 ∗ 𝑅𝐴𝑁𝐷( ).
Put the value 15 (arrival in minutes after 6 pm of John) in cells B1 and C1.
Compute John’s waiting time in cells B2:B1001 for the arrival times of Mary
in column A. Example for cell B2: = 𝐼𝐹(𝐴2 < 𝐡$1; 0; 𝐴2 − 𝐡$1). Compute
the penalty in cells C2:C1001:
= 𝐼𝐹(𝐴2 < 𝐢$1; π‘ƒπ‘‚π‘ŠπΈπ‘…(𝐢$1 − 𝐴2; 2); 𝐴2 − 𝐢$1).
Compute John’s average waiting time from column B and the average penalty
from column C. Compare those values with the expected values computed in
Steps 1 and 2. Change the value 15 in cell C1 to John’s optimal arrival time
(minutes after 6 pm) and compare the average penalty in column C to the
expected penalty computed in Step 3.
Assignment PA82
Assume the pdf of Mary’ arrival time (in minutes after 6 pm) is 𝑓(π‘₯) =
π‘₯⁄1800, 0 < π‘₯ < 60.
When John arrives at 6.15 pm, do you think his expected waiting time will
increase/decrease/remain unchanged compared to the solution in Step 1 above? Why?
Compute his expected waiting time.
Assume a penalty function as in Step 2. Compute the expected penalty when he
arrives at 6.15 pm. Derive his optimal arrival time when his objective is to minimize
the expected penalty.
Simulate the problem similar to Step 4.
96
Problem PP83
A random variable X has pdf 𝑓(π‘₯) = 1⁄100 , 0 < π‘₯ < 100. You may choose any
positive number c.
1. When a realization of X is smaller than c, your gain π‘Š1 is 0. When X is greater
or equal to c, your gain π‘Š1 is c. Compute your expected gain.
Which value of c results in maximal expected gain? Compute the maximal
expected gain.
Answer: 𝑐 = 50, 𝐸(π‘Š1 ) = 25;
2. As in Step 1 but the gain π‘Š2 equals –c when X is smaller than c, equals c
when X is greater or equal to c.
Answer: 𝑐 = 25, 𝐸(π‘Š2 ) = 25⁄2;
3. As in Step 1 but the gain π‘Š3 equals −𝑐 2 when X is smaller than c, equals 𝑐 2
when X is greater or equal to c.
Answer: 𝑐 = 100⁄3 , 𝐸(π‘Š3 ) = 370.37;
4. Simulate the problem. Generate values of X in the range A3:A1002. Report
arbitrary positive numbers as values of c in B2, C2 and D2. Compute values of
π‘Š1 , π‘Š2 and π‘Š3 in B3:B1002, C3:C1002 and D3:D1002 using the value of c in
B2, C2 and D2 and the values of X in column A.
Compute the average gains derived from columns B, C and D.
Change the values of c to the values derived in Step 1, Step 2 and Step 3.
Compare the average gains to the maximal expected gains in Steps 1 to 3.
Assignment PA83
Apply Steps 1 to 4 for a random variable X with pdf
1
1
𝑓(π‘₯) = 50 ∗ 𝑒 −50π‘₯ , π‘₯ > 0
97
Problem PP84
A shop sells a particular type of deli meat which spoils easily, hence can only be sold
during one day. Assume demand for that type of meat to be a random variable X (unit
is kg) with pdf 𝑓(π‘₯) = 1⁄(𝑏 − π‘Ž) , π‘Ž < π‘₯ < 𝑏 (a and b are known constants). The
shop owner has to decide on the amount of meat to stock at the beginning of the day
(no additional meat can be ordered later in the day). He buys the meat at a price of €
q/kg and sells it at a price of € s/kg (𝑠 > π‘ž). Units not sold at the end of the day
cannot be sold later.
1. Derive the expected daily profit of the shop when i kg of the deli meat (π‘Ž <
𝑖 < 𝑏) is available at the start of the day.
Answer:
1
𝑠
{[𝑏𝑠 − π‘ž ∗ (𝑏 − π‘Ž)] ∗ 𝑖 − ∗ (𝑖 2 − π‘Ž2 )};
(𝑏−π‘Ž)
2
2. Compute in Excel the expected profit for π‘Ž = 10, 𝑏 = 20, π‘ž = 20, 𝑠 = 25 and
values of i equal to 10, 10.25, …, 20.
Graph the expected profit and check the value of i for which the expected
value is maximal;
3. Derive the value of i that maximizes the expected profit derived in Step 1.
Compare this value to the value derived in Step 2.
1
Answer: 𝑠 ∗ [(𝑠 − π‘ž) ∗ 𝑏 + π‘žπ‘Ž];
4. Simulate the problem for the parameter values given in Step 2: generate 1000
demands for the product in the range A3:A1002. Report a value for i in cell
B2, e.g. 15. Compute profits in cells B3:B1002 for the demands in column A
and the value of i in cell B2. Compute the average profit from column B.
Change the value of i to the optimal value derived in Step 3 and compare the
average simulated profit to the expected profit.
Assignment PA84
Repeat Steps 1 to 4 when the pdf of demand equals
𝑓(π‘₯) = π‘₯⁄150 , 10 < π‘₯ < 20.
98
Problem PP85
Consider Problem PP59.
1. Derive the expected length of the shortest piece.
Answer: ¼;
2. Derive the expected length of the longest piece.
Answer: ¾;
3. Derive the expected length of the difference in length between the longest and
the shortest piece.
Answer: ½;
4. Derive the expected value of the ratio of the length of the shortest to the length
of the longest piece.
Answer: 2 ∗ 𝑙𝑛2 − 1;
5. Derive the expected value of the ratio of the length of the longest to the length
of the shortest piece.
Answer: does not exist ( or +∞ );
6. Simulate the problem as in Problem PP59. Compute average values of all the
variables in Steps 1 to 5. Compare the average values to the expected values
computed above.
Assignment PA85
Consider the Assignment in Problem PP59.
Compute the expected value of the difference in length between the left and the right
piece.
Compute the expected value of the ratio of the length of the left to the length of the
right piece.
Simulate the problem and compare average values derived from the simulation to the
expected values.
99
Problem PP86
Two teams T1 and T2 compete in a best of seven series (the team that first wins four
games is the winner). Assume the probability that T1 wins a game is constant and
equal to p. A game always ends with a winner (no ties).
1. Derive the pmf of the number of games X that will be played to determine a
winner as a function of p. Answer:
X
p(x)
4
4
𝑝
+ (1 − 𝑝)4
5
4 ∗ 𝑝 ∗ (1 − 𝑝)
∗ (3𝑝2 − 3𝑝 + 1)
6
10 ∗ 𝑝 ∗ (1 − 𝑝)2
∗ (2𝑝2 − 2𝑝 + 1)
2
7
20 ∗ 𝑝3
∗ (1 − 𝑝)3
2. Compute the pmf derived in Step 1 for values of 𝑝 = 0, 0.1, 0.2, … , 1 (use
Excel);
3. Compute the expected value of the number of games that will be played as a
function of 𝑝 = 0, 0.1, 0.2, … , 1 (use Excel). Graph the expected number as a
function of p;
4. Simulate this competition 1000 times as follows: report the probability p in
cell E1, e.g. 0.5. Denote the winner of 7 games in cells A2.A8:
= 𝐼𝐹(𝑅𝐴𝑁𝐷( ) < $𝐸$1; "𝑇1";"𝑇2").
In cells B5:B8 compute how many games are needed to determine the winner.
Example for cell B5:
= 𝐼𝐹(𝐴𝑁𝐷(𝑀𝐴𝑋(πΆπ‘‚π‘ˆπ‘π‘‡πΌπΉ(𝐴$2: 𝐴5; "𝑇1"); πΆπ‘‚π‘ˆπ‘π‘‡πΌπΉ(𝐴$2: 𝐴5; "𝑇2")) =
4; 𝑀𝐴𝑋(𝐡$2: 𝐡5) = 0); 4; ""). Similarly for cells B7 to B9.
Copy the number of games into cell D3: = 𝑀𝐴𝑋(𝐡5: 𝐡8).
Use the TABLE-option to simulate the problem 1000 times in column D.
Compute the average number of games and compare the average number to
the expected value computed in Step 3.
Assignment PA86
Repeat the problem above for the best of nine games.
100
Problem PP87
You play a game where the probability of winning is p. When you win, the pay-off is
twice your bet. You can repeat the game and the probability of winning remains
unchanged.
You decide on the following betting strategy: you begin by betting € 1 and you double
your bet as long as you lose, if you win you stop. If you can keep up this strategy, you
will win € 1 eventually. For instance, when you lose three times in a row and win the
fourth time your total betting amount is € 15 (=1+2+4+8) and you win € 16 (2*8).
However you are a poor student and you have only € 56 in your pocket. So you adapt
the above strategy as follows: you double the bet at most four times to € 16 and when
you lose five times in a row you bet your remaining money (= € 25) and pray. Notice
that your gain is € 1 when you win one of the first five games, that you lose € 6 when
you lose the first five games and wins the sixth game and that you lose € 56 when you
lose all six games. Call a complete game the above series of games until you either
win or lose money.
1. Derive the pmf of the gain (loss) X of a complete game as a function of p.
Answer:
X
p(x)
1
1 − (1 − 𝑝)5
-6
𝑝 ∗ (1 − 𝑝)5
-56
(1 − 𝑝)6
2. Compute the expected gain (loss) of a complete game as a function of p.
Answer: 1 − (1 − 𝑝)5 ∗ (57 − 50𝑝);
3. What is the expected value of a complete game for 𝑝 = 18⁄37 (a common
roulette value in casinos). Answer (rounded): -0.1668;
4. Use Excel to compute the expected value and the variance of the gain (loss)
for 𝑝 = 0, 0.1, … , 0.9, 1. Answer (rounded):
p
E(X)
Var(X)
0
-56
0
.1
-29.71
786.72
.2
-14.40
617.73
.3
-6.06
334.88
.4
-1.88
144.83
.5
.6
0
50.53
0.72
13.53
.7
0.95
2.45
.8
0.99
0.22
.9
0.9999
0.004
1
1
0
5. Find the value of p for which the complete game breaks even (expected value
= 0). Use the Solver to compute this value.
Answer: 𝑝 = 0.5;
6. Simulate the game as follows: report a value of p, say 𝑝 = 18⁄37, in cell A2,
put random numbers in the range A3:A8 for at most six games to be played.
Assume you win when a random number is smaller than the value in cell A2.
Compute your gains or losses in cells B3 to B8. Example: for the third game in
cell B5: = 𝐼𝐹(𝑀𝐴𝑋(𝐡$3: 𝐡4) = 1; ""; 𝐼𝐹(𝐴5 < $𝐴$2; 1; "")) and for the last
game in cell B8: = 𝐼𝐹(𝑀𝐴𝑋(𝐡$3: 𝐡7) = 1; "", 𝐼𝐹(𝐴8 < $𝐴$2; −6; −56)).
Copy the gain/loss in cell E2: = 𝐼𝐹(𝑀𝐴𝑋(𝐡3: 𝐡7) = 1; 1; 𝐡8).
Use the TABLE-option to repeat the game 2000 times and compare the average
gain/loss to the expected value computed in Step 2.
101
Assignment PA87
Assume in the above set up that you are somewhat better off financially. You play at
most 7 times and if you lose 7 times in a row you stop and lose all your bets (€ 127).
Perform the five steps above for this game.
102
Problem PP88
A total of 16 chairs numbered 1, 2, …, 16 are placed in a row. Eight people are
randomly assigned a (different) chair.
We use simulation to estimate the pmf and the expected value of the number of
persons who will have a companion. A person has a companion if somebody is sitting
on an adjoining chair, to the left and/or to the right.
Work as follows: the numbers 1 to 16 in the range A2:A17 representing the chairs.
Random numbers in the range B2:B17. Assume that a person is assigned to chair π‘˜ −
1 in column A, row k, when the corresponding random number in column B, row k, is
among the eight smallest numbers in the range B2:B17 (random assignment of
persons to chairs). This is reported in column C, row k, by a “yes” when a person is
assigned to chair π‘˜ − 1 and by a “no” when the chair remains unassigned. The
following array instruction will accomplish this for cell C2:
= 𝐼𝐹(𝑂𝑅(𝐡2 = 𝑆𝑀𝐴𝐿𝐿(𝐡$2: 𝐡$17; {1,2,3,4,5,6,7,8})) = π‘‡π‘…π‘ˆπΈ; "𝑦𝑒𝑠";"π‘›π‘œ").
In column D, row k, we report 1 when a person is sitting on chair π‘˜ − 1 and has a
companion. Example for cell D3:
= 𝐼𝐹(𝐴𝑁𝐷(𝐢3 = "𝑦𝑒𝑠"; 𝑂𝑅(𝐢2 = "𝑦𝑒𝑠"; 𝐢4 = "𝑦𝑒𝑠")); 1; "").
In cell G2 count the number of persons with a companion: = π‘†π‘ˆπ‘€(𝐷2: 𝐷17).
Use the TABLE-option in Excel to simulate the sum in cell G2 1000 times.
Derive an estimate of the pmf and an estimate of the expected value of the number of
persons who have a companion.
Assignment PA 88
Repeat the problem above when the chairs are placed around a round table so that
chair 16 is next to chair 1.
103
Problem PP89
A rather large number of people all of different stature are randomly placed in a row.
Select people from the row as follows: the first person in the row is selected, walk
further along the row and add a person to the selection when he/she is taller than the
ones selected so far. Repeat this process until you are at the end of the row of persons.
Simulate the average number of people selected for a row of 50 people.
Work as follows: the numbers 1 to 50 representing the 50 people in the range A2:A51.
Assume person 1 is the smallest, person 2 the next smallest, etc. Order the 50 persons
in column A randomly in column C using random numbers generated in cells B2 to
B51. Example for cell C2 where we report the person who is placed first in the row:
= 𝐼𝑁𝐷𝐸𝑋(𝐴$2: 𝐴$51; 𝑀𝐴𝑇𝐢𝐻(𝑆𝑀𝐴𝐿𝐿(𝐡$2: 𝐡$51; 𝐴2); 𝐡$2: 𝐡$51; 0)) and
similarly for the remaining persons in cells C3 to C51.
Column D reports when a person is added to the selection as you walk along the row.
Cell D2 equals cell C2, cell D3 contains the instruction = 𝐼𝐹(𝐢3 > 𝐢2; 𝐢3; 𝐷2) and
similarly for the remaining cells in column D.
In cell G2 we compute the number of different persons selected in column D by the
array instruction: = π‘†π‘ˆπ‘€(1⁄πΆπ‘‚π‘ˆπ‘π‘‡πΌπΉ(𝐷2: 𝐷51; 𝐷2: 𝐷51)).
Use the TABLE-option to repeat cell G2 1000 times and compute the average number
of different persons selected over the 1000 trials.
Compare this value to the number 𝑙𝑛(50) + 1⁄100 + .577 which can be shown to give a
close approximation to the expected value.
Assignment PA89
Change the selection of people in the above scheme as follows: choose the first two
persons in the row. Add a person to the selection when he/she is taller than the second
tallest person selected so far (Rule 1).
Repeat the simulation. Choose the first two persons in the row. Add a person to the
selection when he/she is taller than the second tallest person met so far but smaller
than the tallest person met so far (Rule 2).
104
Problem PP90
Consider Problem PP40.
Assume the prizes are valued 1, 2, …,12 with a larger value meaning a more valuable
prize. We determine through simulation the value of k for which the expected value of
the prize received is maximal.
Work as follows: the prizes numbered 1 to 12 in the range A3:A14. Arrange the prizes
in random order in the range C3:C14 using random numbers generated in B3:B14.
Example for cell C3 (the first prize in the list):
= 𝐼𝑁𝐷𝐸𝑋(𝐴$3: 𝐴$14; 𝑀𝐴𝑇𝐢𝐻(𝑆𝑀𝐴𝐿𝐿(𝐡$3: 𝐡$14; 𝐴3); 𝐡$3: 𝐡$14; 0)) and
similarly for cells C4:C14.
Report the values for π‘˜ = 0, 1, 2, … , 11 in the range D2:O2. Compute the prize
received in columns D to O for the values of k in row 2. Example for cell F8 (strategy
π‘˜ = 2): = 𝐼𝐹(𝐴𝑁𝐷(𝑀𝐴𝑋(𝐹$3: 𝐹7) = 0; 𝐢8 > 𝑀𝐴𝑋(𝐢$3: 𝐢7)); 𝐢8; "").
The cells in row 14 are slightly different. Example for cell F14:
= 𝐼𝐹(𝑀𝐴𝑋(𝐹$3: 𝐹13) = 0; $𝐢14; "").
In this way prizes have been determined for the list in column C and all values of k.
To repeat the process the TABLE-option will be used. In the range Q2:AB2 we repeat
the prizes for the different values of strategy k. Example for cell Q2: =
𝑀𝐴𝑋(𝐷3: 𝐷14) and similarly for cells R2 to AB2.
Use the TABLE-option on columns P to AB to repeat the prize selection 1000 times.
Compute the average value of the prize for all strategies in the range AD2:AO2.
Graph the average prize as a function of the value of k.
Does the seemingly optimal value of k differ from the optimal value of k in Problem
PP40 where the probability of hitting the best prize was maximized?
Assignment PA90
Consider Problem PP31. Assume 100 persons.
Use simulation to approximate the average value of X, the number of common
birthdays. To be precise X is defined as 𝑝2 + 2 ∗ 𝑝3 + 3 ∗ 𝑝4 + … where π‘π‘˜ is the
number of days of the year having k persons with a common birthday (when three
persons have the same birthday, count two common birthdays, when four persons
have the same birthday, count three common birthdays, etc.).
105
Problem PP91
Let X be the number of rolls with a fair die needed to get the outcome 6. Let Y be the
number of rolls needed to get two outcomes 6 successively.
1. Show that the expected value of X satisfies the equation
𝐸(𝑋) = 1⁄6 + 5⁄6 ∗ [𝐸(𝑋) + 1] and solve for 𝐸(𝑋).
Answer: 𝐸(𝑋) = 6;
2. Show that the expected value of Y satisfies the equation
𝐸(π‘Œ) = 5⁄6 ∗ [𝐸(π‘Œ) + 1] + 1⁄6 ∗ [1⁄6 ∗ 2 + 5⁄6 ∗ [𝐸(π‘Œ) + 2]] and solve
for 𝐸(π‘Œ).
Answer: 𝐸(π‘Œ) = 42;
3. Estimate the expected values in Steps 1 and 2 by simulation as follows: the
numbers 1 to 1000 in the range A2:A1001. Report the result of 1000 rolls of
the die in cells B2:B1001. Report 1 in column C when two successive Sixes
have been rolled in column B. Example for cell C3:
= 𝐼𝐹(𝐴𝑁𝐷(𝐡3 = 6; 𝐡2 = 6); 1; "") and similarly for cells C4:C1001 (we
assume that two successive outcomes 6 will realize with no more than 1000
rolls, a reasonable assumption).
Report the roll of the first 6 in cell E2 using the array instruction
= 𝐼𝑁𝐷𝐸𝑋(𝐴2: 𝐴1001, 𝑀𝐴𝑇𝐢𝐻(6; 𝐡2: 𝐡1001; 0))
Report the roll when two successive sixes appear for the first time in cell F2 as
the array instruction
= 𝐼𝑁𝐷𝐸𝑋(𝐴2: 𝐴1001, 𝑀𝐴𝑇𝐢𝐻(1, 𝐢2: 𝐢1001,0)).
Use the TABLE-option to repeat the values in cells E2 and F2 1000 times.
Estimate the average number of rolls from the simulated data and compare to
the exact values in Steps 1 and 2.
Assignment PA91
Let X be the number of rolls needed to get successively the outcomes 5 or 6 or both.
Derive the equation that 𝐸(𝑋) must satisfy (similar to Steps 1 and 2 above).
Simulate the problem similar to the simulation in Step 3.
106
Problem PP92
Let 𝑋6 be the number of rolls with a die to obtain every outcome 1 to 6 at least once.
To derive the expected value of 𝑋6, let 𝑋1 be the number of rolls further required to
obtain all 6 outcomes after having obtained 5 different outcomes at least once. Clearly
𝐸(𝑋1 ) = 6 (see Problem PP91). Let 𝑋2 be the number of rolls further needed to
obtain all six outcomes at least once after having obtained four different outcomes at
least once. Argue that 𝐸(𝑋2 ) must satisfy
𝐸(𝑋2 ) = 4⁄6 ∗ [𝐸(𝑋2 ) + 1] + 2⁄6 ∗ [𝐸(𝑋1 ) + 1]. From this equation it follows that
𝐸(𝑋2 ) = 9.
1. Compute 𝐸(𝑋6 ) by continuing the reasoning above for 𝑋3 (number of further
rolls needed after already having obtained three different outcomes), 𝑋4, etc..
Answer: 𝐸(𝑋6 ) = 14.7;
2. Estimate the expected number in Step 1 through simulation as follows: roll a
die 100 times in the range A2:A101 (we assume that not more than 100 rolls
will be needed to obtain all six outcomes at least once). Needing more than
100 rolls is indeed an extremely unlikely event and hence will be neglected.
Compute in column B the number of different outcomes obtained so far.
Example for cell B2, the array instruction:
= π‘†π‘ˆπ‘€(1/πΆπ‘‚π‘ˆπ‘π‘‡πΌπΉ(𝐴$2: 𝐴2; 𝐴$2: 𝐴2)) and likewise for cells B3:B101.
Count in cell E2 the number of rolls that is needed to obtain all six outcomes
at least once by the array instruction:
= 𝑀𝐼𝑁(𝐼𝐹(𝐡$2: 𝐡$101 = 6; π‘…π‘‚π‘Š(𝐡$2: 𝐡$101) − 1; "")).
Use the TABLE-option to repeat the process 500 times. Estimate 𝐸(𝑋6 ) and
compare to its exact value computed in Step 1.
Assignment PA92
Roll six fair dice. Compute the exact probability that all six outcomes 1, 2, …, 6 are
obtained.
Estimate the probability by simulating the process a large number of times, say 2000
times and compare to the exact probability.
Derive from the exact probability the expected number of rolls required with the six
dice to obtain all six outcomes. Compute the probability that at most the expected
number of rolls will be needed to roll all six outcomes.
Estimate this probability by simulation and compare to the exact probability.
Download