If $X \sim Bin(n,p)$ using $E(X(X-1)) = g''(1) = n(n-1)p^2$ show that Var$(X) = npg$.
I understand that g is the generating function $g_{x}(t) = \sum_{k=0}^{\infty} p_{k}t^{k}$, and I know that the mean, E(X) = $g''(1) = n(n-1)p^2$. But does E(X(X-1) represent? And how does it prove that the Var(X) = npq?
Observing that $$\begin{align} g'(1) &=\Bbb E(X)\\ g''(1)&= \Bbb E(X(X − 1)) \end{align} $$ so you have $$ \begin{align} g''(1)+g'(1)-[g'(1)]^2 &=\Bbb E(X(X − 1))+\Bbb E(X)-[\Bbb E(X)]^2\\ &= \Bbb E(X^2) -\Bbb E(X)+\Bbb E(X)-[\Bbb E(X)]^2\\ &= \Bbb E(X^2) -[\Bbb E(X)]^2\\ n(n-1)p^2+np-(np)^2&=\mathrm{Var}(X)=npq \end{align} $$