Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Math 170E: Mini Project 2

While working through this project, you may use your textbook and notes from class, but you are to complete the project independently and without discussion or help from anyone else.  show all your work and answer all questions in complete sentences with full explana- tions (not just answers!).

 

 

I. Arbitrary numbers on paper

Our first problem is simple to describe. Consider a game in which your professor writes two numbers on two different sheets of paper; let’s call them X and Y .  Those are then placed face down on the table.  The only thing you, as the player, knows is that the probability these two numbers are exactly equal is zero:  E(X = Y) = 0.  You then get to select one paper to flip over (you can assume you flip a fair coin to select which paper to flip) and view the number written on it, let’s call the number you view W . You now have to guess whether the number on the remaining face down paper, let’s call it Z, is larger or smaller than the one you just flipped over. You win if your guess is correct.

(1) What strategy would you use to play this game in order to optimize the chance that you win?  (Answer this before reading on, do not change your answer later, this is just for fun for now).

 

(2) Your friend claims that since you know nothing about these real numbers, that you might as well guess that the number you flipped over, W , is largest if you see that it is a positive number.  They claim that since zero splits the number line in two, this seems like a reasonable strategy.  Give a (trivial) example that your professor may use (who writes the two numbers down recall) such that this strategy is meaningless.

(3) Now, let’s consider a simple strategy where you always guess the number that you viewed is the larger one.  Thus with our notation, you win when W > Z.  Compute this probability, showing all your work and justifying each step mathematically. Note there are only two ways to win, the event that W = X and X > Y or the event that W = Y and Y > X .

(4) Thus, with this strategy you will win with probability 1/2. Can you do any better? Recall you know nothing about the distribution of the numbers X  and Y  other than they are not equal.   So how could you possibly do any better than a 50-50 chance?!   Surprisingly, you can!   There is a strategy that gives you a probability of winning that is strictly  (and perhaps only very slightly) larger than 1/2.   The trick will be to use a continuous random number to your advantage.  Let G be an independent random number generated according to the Gaussian distribution (say, standard normal, although this won’t really matter).  The strategy will be to guess


that W is the larger number if it is larger than G, and the smaller number otherwise.

Let’s prove that this gives us the desired probability. Explain why E(win) = E(W > Z n W > G) + E(W < Z n W < G).

(5) Now break these two events into four events, depending on whether you view X or Y . Explain and fill in the blanks:

E(win) = E(W = X n X > Y n X > G) + E(W = Y n Y > X n Y > G) +          +          .

(6) From there, show (and explain each step) that:

E(win) =  ╱E(X > Y) + E(X > G > Y) + E(X < Y) + E(X < G < Y).

(7) Finally, show that

E(win) = 1 + ε > 1

where ε is some number strictly greater than zero.

 

(8) Compute this exact probability, namely E(win), if X  = 0 and Y = 1 and G is a standard normal random number.

(9) Compute this probability, namely E(win), if X = 100 and Y = 101 and G is a stan- dard normal random number.  Is the probability still greater than 1/2?  (Yes it is!! Explain.)

 

(10) Pretend you are the professor who gets to write down the numbers X and Y on the papers. This could be deterministically or randomly done. Write a short script that mimics the playing of this game, where the player uses the strategy outlined above. Run a large number of trials, tabulating the proportion of times the player wins. Run enough trials to show that this proportion converges to something greater than 1/2 (depending on your choice of X and Y this could take many many trials so think about this).  What  “law” dictates that indeed this proportion should converge to the true probability? Answer this question, and include a printout of this code and its output with this assignment.  Clearly label your code to correspond it with this question.

 

(11) How surprised are you by this problem?  How would you change your answer to (1) now? How awesome is probability?!

 

II. Patterns in coin ips

Consider tossing a fair coin and recording the outcomes as a string of H’s (Heads) and T’s (tails).  For example, HHTH denotes the experiment in which the coin first landed Heads, then Heads again, then Tails, then Heads.  What patterns are more common than others? How long would you expect to have to wait to observe your favorite pattern? We will delve into these answers here.


(1) Suppose you flip the coin three times. What is the probability you observe HHH as the result?

(2) Suppose you flip the coin three times. What is the probability you observe HTH as the result?

(3) Suppose you flip the coin five times. What is the probability you observe HHH some- where in the result?

(4) Suppose you flip the coin five times. What is the probability you observe HTH some- where in the result?

(5) Consider this experiment again, where now we view each flip as a trial, where the ith flip is “success” if on that flip we have just observed the pattern THT (i.e.  the (i - 2)th flip was T, the (i - 1)st flip was H, and the ith was T). Let N denote the number of flips needed until the pattern THT is observed. Explain why each trial is a Bernoulli random variable, but that N is not a negative binomial.

 

(6) Let N denote the number of coin flips until the pattern THT is observed (note for example that the result THT took only N = 3 flips, the result TTHT took N = 4, THHTHT took N = 6, etc.). Let Hi  denote the event that the ith flip was a Heads, and Ti  denote its complement.

(a) Explain why  (i) i(NlH1 )  =  1 + iN,  (ii) i(NlT1 , T2 )  =  1 + i(NlT1 ),  (iii)

i(NlT1 , H2 , T3 ) = 3, and (iv) i(NlT1 , H2 , H3 ) = 3 + iN .

(b) Show that iN = (1 + iN) + i(NlT1 ).

(c) Show that i(NlT1 ) =  (1 + i(NlT1 )) +  P  +  (3 + iN).

(d) Solve the two equations above for the unknown iN . Explain in words what this means.

(7) Use the techniques above to compute iM, where M is the number of coin flips until the pattern TTT is observed. Explain in words what this means.

 

(8) Recall the coin is a fair coin.   Should the expected number of flips until THT is observed be the same as the expected number of flips until TTT is observed? Why or why not?

 

(9) Write a script that simulates a series of coin flips and counts how many are needed to observe a particular pattern. Use this script to experimentally verify your answers for iN and iM above.  Include a printout of this code and its output with this assignment. Clearly label your code to correspond it with this question.