# Third central moment of a sum of a random number of iid random variables

Inspired by this question, I tried to get an expression for the third central moment of a sum of a random number of iid random variables. My question is whether it is correct and, if not, what is wrong or what additional assumptions might be missing.

Specifically, let:

$$S=\sum_1^N{X_i},$$ where $N$ is a non-negative integer-valued random variable.

Suppose that the distributions of both $N$ and $X$ are known (and $X_i$ are iid), I want to know the value of the third central moment of $S$.

Using the law of total cummulance:

$$\mu_3(S)=E[\mu_3(S|N)]+\mu_3(E[S|N])+3cov(E[S|N],V[S|N]),$$

but $E[S|N]=N\cdot E[X]$, $E[S|N]=N\cdot V[X]$ and, if I am right, $\mu_3(S|N)=N\cdot \mu_3[X]$. Hence:

$$\mu_3(S)=E[N\cdot \mu_3(X)]+\mu_3(N\cdot E[X])+3cov(N\cdot E[X],N\cdot V[X]),$$

and, since the moments of $X$ are supposed to be known:

$$\mu_3(S)=\mu_3(X)E[N]+E[X]^3\mu_3(N)+3E[X]V[X]cov(N,N)$$

Of course, $cov(N,N)=V[N]$, so:

$$\mu_3(S)=\mu_3(X)E[N]+E[X]^3\mu_3(N)+3E[X]V[X]V[N]$$

Is it right? What is wrong? What additional assumptions am I missing?

Your steps look right to me. We need to assume that the moments exist. The only step I was unsure about was $\mu_3(S | X) = N \cdot \mu_3[X]$. But, we can prove that:
\begin{align} \mu_3(S | X) &= E\left[(S - E[S])^3 | N \right] \\ &= E\left[ \left( \sum_{i=1}^N (X_i - E[X]) \right)^3 \middle| N \right] \\ &= E \left[ \sum_{i=1}^N (X_i - E[X])^3 \middle| N\right] \end{align} where to establish the last equality, we can use the multinomial theorem. For a given $n$,
\begin{align} E\left[ \left( \sum_{i=1}^n (X_i - E[X]) \right)^3 \right] &= E \left[ \sum_{\sum_{i=1}^n k_i = 3} {3 \choose{k_1, \ldots, k_n}} (X_1 - E[X])^{k_1} \cdots (X_n - E[X])^{k_n} \right] \\ &= E\left[ \sum_{i=1}^n (X_i - E[X])^3 \right], \end{align} because when $k_i = 2$ for any $i$, there exists another $j$ where $k_j=1$ (Due to independence of $X_i$ and $X_j$ and the fact that the expectation of $X_j - E[X]$ is zero, causing that particular term to become zero). Now it should be clear that $\mu_3(S | X) = N \cdot \mu_3[X]$.