I am reading a book, and there is an example there that doesn't work for me, I get a different result each and every time, and I can't figure out why. Gemini claims that I am correct. The book is respectable, so I am hesitating about this.
In a random experiment a coin is flipped until $H$ comes up. Let $Y$ be the number of flips before the $H$ comes up.
The probability function is $Y$ is then:
$$p(Y=y)= \left(\frac{1}{2}\right)^{y+1}$$
Now we define a new random variable:
$$Z=e^{-Y}$$
And I am interested in $Z$'s expected value.
What I did was:
$$E(Z)=\sum_0^\infty e^{-y} \left(\frac{1}{2} \right)^{y+1} = \frac{1}{2} \sum_0^\infty \left(\frac{1}{2} e^{-1}\right)^y$$
Which led me into this geometric series (or sum). Using the formula for the sum, and since the first element ($y=0$) is $1/2,$ I got:
$$E(Z)=\frac{\frac{1}{2}}{1-\frac{1}{2e}}=\frac{\frac{1}{2}2e}{2e(1-\frac{1}{2e})}=\frac{e}{2e-1}$$
In the book however, the answer is:
$$E(Z)=\frac{2e^2}{2e-1}$$
which is not equivalent.
Help please...