I am interested in the expectation of $X^3$, and I came across this post
I don't really understand how to come up with this part "the sum from $1$ to $n$ of $k 3p(1−p)k−1$".
Can someone please provide me with a more comprehensive calculation?
I am interested in the expectation of $X^3$, and I came across this post
I don't really understand how to come up with this part "the sum from $1$ to $n$ of $k 3p(1−p)k−1$".
Can someone please provide me with a more comprehensive calculation?
Simply put, you want to calculate $\sum_{k=1}^\infty k^3 (1-p)^{k-1}p$. Let's omit the $p$, we can multiply it at the end. We define the function $f(x) = \sum_{k=0}^\infty k^3x^{k-1}$. Also define $h(x) = \sum_{k=0}^\infty x^k = \frac{1}{1-x}$ when $x \in (0,1)$.
Note that $h'(x) = \sum_{k=1}^\infty kx^{k-1} = \frac{1}{(1-x)^2}$, and therefore $\sum_{k=1}^\infty kx^k = \frac{x}{(1-x)^2}$. Differentiating again, we get $\sum_{k=2}^\infty k^2x^{k-1}$ is the derivative of $\frac{x}{(1-x)^2}$, which we will call $g(x)$ and you can compute this using the quotient rule.
Next, multiply by $x$ to get $\sum_{k=2}^\infty k^2x^k = xg(x)$. Differentiate again to get $\sum_{k=3}^\infty k^3x^{k-1} = \frac{d}{dx}(xg(x))$. Finally, add the missing terms: $\sum_{k=1}^\infty k^3x^{k-1} = 1 + 8x + \frac{d}{dx}(xg(x))$. Then, put $x= 1-p$ once you get the closed form, and multiply by $p$ to get the result.
It is just differentiation once you have the geometric series, as I have shown here. However this process is definitely cumbersome, so it is good practice for you.