SECTION 6.1 Discrete Random Variables 345
PROGRAM: PRIZES
:Input “NO OF PRIZES: ”, M
:Input “NO OF TRIALS: ”, N
:0→A
:For(I,1,N)
:For(L,1,M)
:0→L 2 (L)
:End
1 →B
:For(J,1,M)
:B*L 2 (J)→B
:End
:0→C
:While B< 1
:C+1→C
:randInt(1,M)→D
:L 2 (D)+1→L 2 (D)
:1→B
:For(J,1,M)
:B*L 2 (J)→B
:End
:End
:C→L 3 (I)
:End
:Stop
- LetXbe the binomial random variable with success probabilityp
and whereXmeasures the number of successes inntrials. Define
the new random variable Y by settingY = 2X−n. Show that
Y =y, −n≤y≤n can be interpreted as the total earnings after
ngames, where in each game we win $1 with each success and we
lose $1 with each failure. Compute the mean and variance ofY. - Continuing with the random variable Y given above, let T be
the random variable which measures the number of trials needed
to first observeY = 1. In other words,T is the number of trials
needed in order to first observe one’s cumulative earnings reach $1.
ThereforeP(T = 1) =p, P(T = 2) = 0, P(T = 3) =p^2 (1−p).
Show that P(T = 2k+ 1) = C(k)pk+1(1−p)k, where C(k) =
1
k+ 1
Ñ
2 k
k
é
, n= 0, 1 , 2 ,...,are theCatalan numbers.
- We continue the thread of Exercise 20, above. Show that ifp =
1 /2—so the game is fair—then the expected time to first earn $1
is infinite! We’ll outline two approaches here: a short (clever?)
approach and a more direct approach.
(a) LetE be the expected waiting time and use a tree diagram as
on page 333 to show thatE =^12 +^12 (2E+ 1), which implies