25.02.2013 Views

MATH1715 Tutee Revision Questions

MATH1715 Tutee Revision Questions

MATH1715 Tutee Revision Questions

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Response: Doodle! Draw a picture illustrating some examples! For example, HT, HHT,<br />

HHHT, HHHHT, TH, TTH, TTTH, and so on. It looks like a series of Bernoulli trials<br />

which stop when something different (a success) occurs. This should lead you to consider a<br />

geometric distribution, the distribution of the time to the first success. The main difference<br />

between this and the usual geometric distribution is that a “success” can be either H or T<br />

and is determined by the first toss. You need an initial toss to determine what the “success”<br />

is going to be!<br />

Let X denote the number of tosses required to see both sides once. We require E[X].<br />

We toss the coin once and see side A say. Let A now denote a Failure, and the other side<br />

B a Success. The probability of a Success is p = 0.5. Tosses are independent. A toss either<br />

gives side A, a failure, or side B, a success. What is the distribution of the number of<br />

(subsequent) tosses Y until the first Success? (Here Y takes values 1, 2, 3, ....) Clearly<br />

X = Y + 1, so E[X] can be found.<br />

An alternative approach is to determine the distribution of X directly and then calculate<br />

E[X] = �<br />

x P{X = x} .<br />

Thus<br />

P{X = 1} = 0<br />

P{X = 2} = P{HT or TH} = 0.25 + 0.25 = 0.5<br />

x<br />

P{X = 3} = P{HHT or TTH} = 0.125 + 0.125 = 0.25<br />

P{X = 4} = 0.125<br />

and so on. Writing Y = X − 1, then Y has the usual geometric distribution<br />

P{Y = 1} = P{X = 2} = 0.5<br />

P{Y = 2} = P{X = 3} = 0.5 2<br />

P{Y = 3} = P{X = 4} = 0.5 3<br />

and so on. Since E[Y ] = 1/0.5 = 2, then E[Y ] = E[X − 1] = E[X] − 1 gives E[X] = 3.<br />

A simple R program would let you check my answer.<br />

x=numeric(100000) # Initialise the counts of x to zero.<br />

for (i in 1:100000){ # Do 100000 simulations.<br />

u=rbinom(1,1,0.5) # Generate a random Bin(n=1,p=0.5) value.<br />

# u=0 gives a Tail and u=1 gives a Head.<br />

# Now generate tosses 2,3,4,5,.... until we get something not equal to u.<br />

x[i]=1 # For simulation i initialise the count of the number of tosses (1 so far!).<br />

v=-1 # v denotes subsequent tosses, set to -1 to start with.<br />

# This is just to give R a value v for the next line.<br />

while (v != u){ # While v does not equal u keep on tossing the coin.<br />

v=rbinom(1,1,0.5) # Generate subsequent tosses, v=0 is a T and v=1 is a H say.<br />

x[i]=x[i]+1<br />

}<br />

} # End the 100000 simulations.<br />

mean(x) # Mean of x.<br />

4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!