# Poisson Variable is Independent of sum of Bernoulli Variables

Let $$(X_n)_{n\geq 1}$$ be i.i.d. Bernoulli random variables with parameter $$p\in(0,1)$$. Let $$N$$ be a Poisson random variable with parameter $$\lambda>0$$. Assume $$N$$ is independent from $$(X_n)_{n\geq 1}$$.

Let $$S = \sum_{i=1}^N X_i$$, $$D = N - S$$.

1. What is the joint distribution of $$(S, N)$$?

2. Prove that $$S$$ and $$D$$ are independent.

If I had that all of these objects were independent, I know what to do here. But how do I prove that $$N, S$$, and the second question - $$S, D$$ are independent?

$$\begin{eqnarray*} P\left(S=k,N=n\right) &=& P\left(S=k\mid N=n\right)P\left(N=n\right)\\ &=& {n\choose k}p^k\left(1-p\right)^{n-k}\cdot e^{-\lambda}\frac{\lambda^n}{n!}\\ &=& \frac{1}{k!}e^{-\lambda p}\left(\lambda p\right)^k\cdot \frac{1}{\left(n-k\right)!}e^{-\lambda\left(1-p\right)}\left(\lambda\left(1-p\right)\right)^{n-k} \end{eqnarray*}$$
which is exactly the product of two independent Poisson pmfs, which are exactly the pmfs of $$S$$ and $$D$$ because $$P\left(S=k,N=n\right) = P\left(S=k,D=n-k\right)$$. Thus, $$S$$ and $$N$$ are not independent but $$S$$ and $$D$$ are.