The 3rd raw moment of a binomial distribution

What is the 3rd raw moment (that is, $ E\{X^3\} $) of a Binomial distribution with parameters $n$ and $p$?

I am getting $n(n-1)(n-2)p^3 + 3n(n-1)p^2 + np$. Is it correct?


Solution 1:

For such a distribution, it is best to compute the probability generating function (PGF) rather than MGF. That is to say, $$P_X(t) = \operatorname{E}[t^X] = \sum_{x=0}^n t^x \binom{n}{x} p^x (1-p)^{n-x} = \sum_{x=0}^n \binom{n}{x} (pt)^x (1-p)^{n-x} = (pt+1-p)^n,$$ the last equality being a consequence of the binomial theorem. From here, we observe/recall that $$\left[\frac{dP}{dt}\right]_{t=1} = \operatorname{E}\left[X t^{X-1}\right]_{t=1} = \operatorname{E}[X],$$ and similarly $$\left[\frac{d^2P}{dt^2}\right]_{t=1} = \operatorname{E}[X(X-1)],$$ and in general, $$\left[\frac{d^k P}{dt^k}\right]_{t=1} = \operatorname{E}[X(X-1)\cdots(X-k+1)].$$ Therefore, for $k = 1, 2, 3$, we get $$\operatorname{E}[X] = \frac{d}{dt}\left[(pt+1-p)^n\right]_{t=1} = np,$$ $$\operatorname{E}[X(X-1)] = \frac{d^2}{dt^2}\left[(pt+1-p)^n\right]_{t=1} = n(n-1)p^2,$$ $$\operatorname{E}[X(X-1)(X-2)] = n(n-1)(n-2)p^3,$$ and indeed in the general case, $$\operatorname{E}[X(X-1)\ldots(X-k+1)] = n(n-1)\ldots(n-k+1)p^k.$$ Therefore, $$\operatorname{E}[X^3] = (n(n-1)(n-2)p^3) + 3(n(n-1)p^2) + np.$$

Solution 2:

We start by calculating the moment generating function $M_X(t)=E(e^{tX})$, which is $$\sum_0^n e^{tk}\binom{n}{k} p^kq^{n-k},$$ where $q$ is an abbreviation for $1-p$.

If we note that $e^{tk}p^k=(e^t p)^k$, we recognize the sum as $(e^{tp}+q)^n$.

Now use the fact that $E(X^3)$ is the third derivative of $M_X(t)$ at $t=0$. The calculation is a little unpleasant, but mechanical.