# Math Help - Coin tossing, Expected values N and N^2

1. ## Coin tossing, Expected values N and N^2

Here's the problem I'm working with, what I'm stumped on is below:
A biased coin has probability p of coming up Heads. The coin is tossed repeatedly. Let N be the number of tosses until Heads appears for the first time. By conditioning on the outcome of the first toss, find the expected values of $N$ and $N^2$. Use this to find the variance of $N$.

So, I know how to compute $E[N]$ & $E[N^2]$ here without conditioning on the first toss (i.e. I know what the answers are), but I'm a little stumped on how to get $E[N^2]$ via that route. I know I can utilize $E[N^2]=E[E[N^2|Y]]$, but I'm not sure how to solve $E[N^2|Y]$. I think a little nudge in the right direction is all I need! Thanks

2. ## Re: Coin tossing, Expected values N and N^2

Originally Posted by puggles
Here's the problem I'm working with, what I'm stumped on is below:
A biased coin has probability p of coming up Heads. The coin is tossed repeatedly. Let N be the number of tosses until Heads appears for the first time. By conditioning on the outcome of the first toss, find the expected values of $N$ and $N^2$. Use this to find the variance of $N$.

So, I know how to compute $E[N]$ & $E[N^2]$ here without conditioning on the first toss (i.e. I know what the answers are), but I'm a little stumped on how to get $E[N^2]$ via that route. I know I can utilize $E[N^2]=E[E[N^2|Y]]$, but I'm not sure how to solve $E[N^2|Y]$. I think a little nudge in the right direction is all I need! Thanks
$E(N^2|Y=y)=\sum_n n^2 p(n|y)$

CB

3. ## Re: Coin tossing, Expected values N and N^2

Originally Posted by puggles
Here's the problem I'm working with, what I'm stumped on is below:
A biased coin has probability p of coming up Heads. The coin is tossed repeatedly. Let N be the number of tosses until Heads appears for the first time. By conditioning on the outcome of the first toss, find the expected values of $N$ and $N^2$. Use this to find the variance of $N$.

So, I know how to compute $E[N]$ & $E[N^2]$ here without conditioning on the first toss (i.e. I know what the answers are), but I'm a little stumped on how to get $E[N^2]$ via that route. I know I can utilize $E[N^2]=E[E[N^2|Y]]$, but I'm not sure how to solve $E[N^2|Y]$. I think a little nudge in the right direction is all I need! Thanks
The probability that a head appears for the first time at the k-th toss is...

$p_{k}= \frac{1}{2^{k}}$ (1)

... and from (1) You derive...

$E \{n\} = \sum_{k=1}^{\infty} \frac{k}{2^{k}}$ (2)

$E \{n^{2}\} = \sum_{k=1}^{\infty} \frac{k^{2}}{2^{k}}$ (3)

For the series (2) You can consider that for $|x|<1$ is...

$\sum_{k=0}^{\infty} x^{k}= \frac{1}{1-x} \implies \sum_{k=1}^{\infty} k\ x^{k-1}= \frac{1}{(1-x)^{2}} \implies\sum_{k=1}^{\infty} k\ x^{k}= \frac{x}{(1-x)^{2}}$ (4)

... and inserting in (4) $x=\frac{1}{2}$ You obtain...

$E \{n\}= 2$ (5)

For the series (3) You can consider that for $|x|<1$ is...

$\sum_{k=2}^{\infty} k\ (k-1)\ x^{k-2}= \frac{2}{(1-x)^{3}} \implies \sum_{k=2}^{\infty} k\ (k-1)\ x^{k}= \frac{2\ x^{2}}{(1-x)^{3}}$ (6)

... and combining (4), (6) and a bit of patience You arrive to write...

$\sum_{k=1}^{\infty} k^{2}\ x^{k} = \frac{x\ (1+x)}{(1-x)^{3}}$ (7)

... ... and inserting in (7) $x=\frac{1}{2}$ You obtain...

$E \{n^{2}\}= 6$ (8)

The computation of variance using (5) and (8) is left to You...

Kind regards

$\chi$ $\sigma$

4. ## Re: Coin tossing, Expected values N and N^2

Hmmm, I don't think that's how I'm supposed to approach the problem here (we've already worked out this problem in my class doing the above method). I solved for $E[N]$ by conditioning on the first toss:
let Y = 0 If first toss is tails & 1 if first toss is heads
then $E[N|Y=1] = 1$ because the first toss would give you heads
and $E[N|Y=0] = 1 + E[N]$

then: $E[N]=E[N|Y=0]P(Y=0) + E[N|Y=1]P(Y=1) = 1/p$

I was hoping that $E[N^2]=E[N^2|Y=0]P(Y=0) + E[N^2|Y=1]P(Y=1)$
would be just as easy, but like I said earlier, $E[N^2|Y]$ doesn't jump out right away like the earlier work I did.

5. ## Re: Coin tossing, Expected values N and N^2

OK time to be explicit: The conditional probabilities are:

$Pr(N=1|Y=1)=1$

$Pr(N > 1|Y=1)=0$

$Pr(N=n|Y=0)=Pr(N=n-1);\ \ n>1$

$Pr(N=1|Y=0)=0$.

$E(N^2|Y=0)= \sum_{n=1}^{\infty}n^2 Pr(n|Y=0)$

$E(N^2|Y=1)=1$

CB

6. ## Re: Coin tossing, Expected values N and N^2

Thanks for the clarification!