# Conditional expectation of a discrete random variable

Suppose $$X_1, X_2, \ldots$$ are i.i.d. random variables with an exponential distribution with mean $\mu$. Suppose $N$ is independent of $(X_i)_{i = 1}^{\infty}$ and $$\mathbb{P}(N=k) = p(1-p)^k$$ for $k = 0, 1, 2, \ldots$ Let $S_{N} = \sum_{k=1}^{N}X_k$ and $S_N = 0$ whenever $N=0$. Calculate the conditional expectation $\mathbb{E}\left[N \mid S_{N}\right]$.

Any hint would be great, I wouldn't have any problems with calculating $\mathbb{E}\left[S_{N} \mid N \right]$ or if a random vector $(S_N, N)$ had density. I don't have any smart idea how to tackle this problem.

• do you want $E[N\mid S_N]$ or $E[S_N\mid N]$ ? – idm Sep 25 '15 at 11:25
• As my question says, I want $\mathbb{E} \left[ N \mid S_N\right]$, calculating $\mathbb{E} \left[ S_N \mid N \right]$ is easy. – tosi3k Sep 25 '15 at 11:30
• While I have not worked out any details, does the following naive approach not work? Start by figuring out the conditional probability $\mathbb P_{S_N \mid N}$, use Bayes theorem to get $\mathbb P_{N \mid S_N}$, then just sum up $\sum_k k \mathbb P[ N=k \mid S_n]$ to get your final result. – air Sep 25 '15 at 11:38
• $P(S_N=x)=0$ for all $x \in \mathbb R$. $S_N$ has the Erlang distribution with parameters $N, λ$. – Jimmy R. Sep 25 '15 at 11:38
• @air, if you were so kind to expand your idea, I'd be really grateful. I used the Bayes theorem only in the discrete version, never have I heard of it in the continuous case. – tosi3k Sep 25 '15 at 11:51