How to find the moment generating function of this scenario.

78 Views Asked by At

Suppose a computer can generate either 0's or 1's, and I want to get two consecutive 1's. The computer generates 0's with probability of $1/2$ and 1's with probability of $1/2$. Let's call the number of times required to get two consecutive 1's $K$. I need to find the moment generating function of $M$. I know that $M_K(t)=E[e^{tK}]$, and I'm thinking that if I can express $K$ in terms of each individual trial, I would be able to find the mgf. I know each individual trial is an independent Bernoulli. I think that if I call $X_i$ the outcome of each trial, then $K=X_1+X_2+\cdots+X_n$ where $n$ is the number of trials until the sequence 1, 1 occurs. Is this correct?

1

There are 1 best solutions below

0
On

Let $\tau_0=\inf\{n>0: X_n=X_{n-1}=1\}$ (the quantity we are interested in) and $\tau_1=\inf\{n>0: X_n=1\mid X_{n-1}=1\}$. Then \begin{align} \mathbb E[\tau_0] &= 1 + (1-p)\mathbb E[\tau_0] + p\mathbb E[\tau_1]\\ \mathbb E[\tau_01 &= 1 + (1-p)\mathbb E[\tau_0],\\ \end{align} and hence $$ \mathbb E[\tau_0] = \frac{1+p}{p^2},\quad \mathbb E[\tau_1] = \frac1{p^2}. $$