We have the random variable $X$ distributed geometrically with parameter $Y$ which is itself a random variable uniformly distributed over the interval $[0, \frac{n-1}{n}]$.
We want to find $E[E[X \mid Y]]$.
First, it is important to recognize that $E[X \mid Y=y] = \frac{1}{y}$ by the definition of a geometric distribution's expectation. So, this implies we can treat $E[X \mid Y=y]$ as a random variable that has expectation $\frac{1}{y}$ when $y \in [0, \frac{n-1}{n}]$
Because $E[X \mid Y]$ is itself a random variable, we can just label it as $M$: a new random variable.
The question is to find $E[M]$. I have already solved this, without much thinking and uninterestingly, by using the law of iterated expectations:
$$E[M] = E[E[X \mid Y]] = E[X] = \frac{1}{Y}$$
But, I feel like there is a more rigorous proof of this relationship. Is there a way to use the PDF of $Y$ to more deliberately solve for $E[M]$?
Thank you.
For clarity, I'll write $E_Y(E_X(X|Y))$ to indicate that the inner expectation is taken over $X$ and the outer over $Y$.
The inner expectation, $E_X(X|Y)$ is equal either to $\frac{1}{Y}$ or $\frac{1}{Y}-1$, depending on the particular "flavour" of the geometric distribution you're referring to.
The outer expectation, $E_Y(\frac{1}{Y})$ or $E_Y(\frac{1}{Y}-1)$, is then infinite, as it's basically the area under the curve $z=1/y$.