# Expected value for infinite sum

Let $X_1,X_2,X_3, \ldots$ be an infinite sequence of i.i.d. Bernoulli$(p)$ random variables, with $P(X_1=1)=p=1-P(X_1=0)$ and define the random real number $X=\sum_{i=1}^{\infty}\frac{X_i}{2^i}$.

It's simple to find $E[X]$ and $E[X^2]$.

$$E[X]=p, \qquad E[X^2]=\sum_{i=1}^\infty 2^{-2i} p + \sum_{i=1}^\infty \sum_{j=1,j \neq i}^\infty 2^{-i} 2^{-j} p^2=\frac{p+2p^2}{3}.$$

Question: What about $E[X^n]$?

Obviously, $E[X^n]$ is a polynomial of degree $n$, but it's difficult to consider it in the same way.

• MGF or Characteristic functions are trivial way to start. Commented Jul 2, 2017 at 16:38
• @MANMAID: I try to find MGF, it looks like: $M_X(t) = \prod_{n=1}^\infty (1-p+pe^\frac{t}{2^n})$. And I don't know, how to calculate this product. Commented Jul 2, 2017 at 16:45

I think the right way is to find a recurrence relation satisfied by the moments $A_n=\mathbb{E}(X^n)$. Clearly we have $A_0=1$.
Now the key obsevation is to consider the random variable $$Y=2X-X_1=\sum_{n=1}^\infty \frac{X_{n+1}}{2^n}$$ Now \eqalign{2^nX^n&=(Y+X_1)^n=Y^n+\sum_{k=0}^{n-1}\binom{n}{k}X_1^{n-k}Y^k\cr &=Y^n+X_1\sum_{k=0}^{n-1}\binom{n}{k}Y^k\cr } Taking expectations and noting that $Y$ is independent of $X_1$ and has the same law as $X$, we get $$2^nA_n=A_n+ p\sum_{k=0}^{n-1}\binom{n}{k}A_k$$ Or $$A_n=\frac{p}{2^n-1}\sum_{k=0}^{n-1}\binom{n}{k}A_k$$ Starting from $A_0=1$ we calculate immediately \eqalign{ A_1&=p,\cr A_2&=\frac{p}{3}(1+2p),\cr A_3&=\frac{p}{7}(1+4p+2p^2). } And a simple mathematical induction shows that $A_n$ is an $n$th degree polynomial in the variable $p$.