Probability and Statistics – 1 : coin flips

Question 1. I toss a fair coin until I obtain Heads. How many times am I expected to toss the coin (this number includes the coin toss which resulted in the Head)? What is the variance of the number of coin tosses?

Solution. This is exactly the geometric distribution with p = 0.5. Hence, I am expected to toss the coin 1/p = 2 times.

We can derive it as follows:

Let X be the random variable denoting the number of coin tosses.

If we get a H in the 1st toss, we are done. —- Pr [ X = 1 ] = 1/2. ( the probability is 1/2 since it is a fair coin.)

For us to have X = 2, the 1st toss must result in a T, and the 2nd in a H. —-

Pr [X=2]=0.5^2.

Similarly, X = 3 only if we get the sequence T T H in our 1st 3 coin tosses. —- Pr [ X = 3] = 0.5^3.

Thus, we have that,

E [ X ] = 1 \times 0.5 + 2 \times 0.5^2 + 3 \times 0.5^3 \ldots

\Rightarrow 0.5 E[X] = 0.5^2 + 2 \times 0.5^3 + \ldots

Subtracting the 2nd equation from the 1st, we get:

0.5 E [X] = 0.5 + 0.5^2 + 0.5^3 + \ldots

\Rightarrow E[X] = 2.

—-

Variance of X:

Var (X) = E[X^2] - (E[X])^2

We have that, E[X^2] = 1 \times 0.5 + 4 \times 0.5^2 + 9 \times 0.5^3 + \ldots

\Rightarrow 0.5 E[X^2] = 0.5^2 + 4 \times 0.5^3 + 9 \times 0.5^4 + \ldots

Subtracting the 2nd equation from the 1st:

0.5 E[X^2] = 0.5 + 3 \times 0.5^2 + 5 \times 0.5^3 + \ldots

\Rightarrow 0.25 E [X^2] = 0.5^2 + 3 \times 0.5^3 + \ldots

\Rightarrow 0.25 E[X^2] = 0.5 + 2 (o.5^2 + 0.5^3 +\ldots)

\Rightarrow E[X^2] = 6.

Therefore, Var (X) = 6 - 4 = 2.

—–

Question 2.I toss a fair coin until I get either HH or TT. Let X be the number of coin tosses I make. Find E[X].

Solution.

The 1st coin toss can result in either a H or a T. If we are given that X = k, then the remaining k-1 coin tosses are uniquely determined given the result of the 1st toss. The fixed sequence occurs with probability 0.5^{k-1}.

Thus, we have that, E [X] = 2 \times 0.5 + 3 \times 0.5^2 + 4 \times 0.5^3 + \ldots

Solving, we get, E[X] = 3.

—-

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: