Let N~Geo(p) and $X_{1}, X_{2},...\sim Exp(\lambda)$, all independent of N. Assume $\lambda > 0$ and $p∈(0,1)$. Define the compound random variable $S_{N} = \sum_{i=1}^N X_{i}$.
(a) Determine the conditional probability mass function of N given that $S_{N}=n$ for some fixed s > 0, i.e. the probabilities $\mathbb{P}(N=n|S_{N}=s)$, for n=1,2,..., and s>0.
(b) Find the conditional expectation of N given that $S_{N}=s$.
What I have done so far is using: $$\mathbb{P}(N=n|S_{N}=s)=\frac{\mathbb{P}(S_{N}=s|N=n)\mathbb{P}(N=n)}{\mathbb{P}(S_{N}=s)}$$ where $$\mathbb{P}(S_{N}=s)=p\lambda e^{-p\lambda s}$$ and $$\mathbb{P}(N=n)=p(1-p)^{n-1}$$ and $$\mathbb{P}(S_{N}=s|N=n)=\frac{1}{\Gamma(n)}\lambda ^ns^{n-1}e^{-\lambda s}$$I get $$\mathbb{P}(N=n|S_{N}=s)=\frac{1}{\Gamma(n)}(\lambda s)^{n-1}(1-p)^{n-1}e^{-\lambda s(1-p)}$$
I know that for part (b), $\mathbb{E}=\sum_{n=1}^{\infty}n\mathbb{P}(N=n|S_{N}=s)$, but the calculation for that is really long and complicated, which makes me think that I've made a mistake somewhere. Am I treating n as the wrong random variable in this case?
If I am wrong, can someone please explain why? If not, how would I approach part (b)? Thanks!
Your solution for the probability is correct.
Hint for the part b).
Try calculating $E(N -1\mid S_N = n)$. The sum will resemble to that of the expectation for a Poisson distribution.