Question:
We have a Random Number Generator defined as:
$\displaystyle U_{K} \sim \operatorname{Uni}\left[ 0,\frac{1}{k^{2}}\right] ,\ k\geqslant 1$.
We will take a random number from $I\sim \operatorname{Poi}( \lambda )$, by throwing a Poisson cube, add $1$ to the output, this will be the $k$ of our generator.
We will generate a random number with the $U_{k}$, let's call it $X$.
Find $E[ X]$.
My solution:
First, let's find what is the expected value from $I\sim \operatorname{Poi}(\lambda )$.
By definition, it is: $E[ I] =\frac{1}{\lambda}$.
Let's now add $1$ to it: $ \dfrac{1}{\lambda } +1=\dfrac{1+\lambda }{\lambda }$.
Hence, our generator is expected to look like:
$U_{\frac{1+\lambda }{\lambda }} \sim \operatorname{Uni}\left[ 0,\dfrac{1}{\left(\dfrac{1+\lambda }{\lambda }\right)^{2}}\right]$.
Since we add $1$ to the expectation $E[ I] \geqslant 0$, we are guaranteed to get a number $k\geqslant 1$.
Now, let's calculate what is the expected value from $\operatorname{Uni}\left[ 0,\dfrac{1}{\left(\dfrac{1+\lambda }{\lambda}\right)^{2}}\right]$.
This is a uniform distribution, hence, the expectation will be:
\begin{align} E[ X] &=\frac{\cfrac{1}{\left(\frac{1+\lambda }{\lambda }\right)^{2}}}{2}=\frac{1}{2\cdotp \left(\frac{1+\lambda }{\lambda }\right)^{2}}\\ &=\frac{1}{\cfrac{2\left( 1+\lambda ^{2} +2\lambda \right)}{\lambda ^{2}}} =\frac{\lambda ^{2}}{2+2\lambda ^{2} +4\lambda } \end{align}
Someone sent me this solution:
$$E[ X] =\sum ^{\infty }_{0}\frac{e^{-\lambda } \lambda ^{k-1}}{( k-1) !} \cdotp \frac{1}{2k^{2}}$$
Which is completely different from mine. What did I do wrong?
The mistake in your reasoning is as follows: if $Y$ is a random variable which can be expressed in terms of another random variable $X$ in the form of an equation $Y = f(X)$, it is not true in general that $\mathbb{E}(Y) = f(\mathbb{E}(X))$.