Working out the variance of the Poisson distribution My lecturer in his notes uses this definition of Poisson distribution:
$$ P_{X}(t)= \exp( \lambda (t-1)) $$
You differentiate once and set equal $t=1$ to get $E[X]=\lambda$, but in the notes to get 
$E[X^2]$, he doesn't differentiate $P_{X}(t) = \exp( \lambda (t-1))$ twice and set equal $t=1$.
Instead the formulae used is this $E[X^2-X]=P_{X}''(1)$.
Can someone explain that? As it confusing the hell out of me. Like I don't know when to just differentiate twice and make it equal to $E[X^2]$ or I have to do that trick. 
Or maybe you can't actually differentiate twice to get $E[X^2]$.  
 A: The formula $P_X(t)$ is your notes is the factorial moment generating function, defined as
$$
   P_X(t) = \mathbb{E}( t^X )
$$
Therefore:
$$
   P_X^\prime(t) = \mathbb{E}(X t^{X-1} ) \qquad
   P_X^{\prime\prime}(t) = \mathbb{E}(X (X-1) t^{X-2} ) \qquad
   P_X^{(k)}(t) = \mathbb{E}( X(X-1) \cdots (X-k+1) t^{X-k} )
$$
Setting $t=1$ afterwords makes $t^{X-k}$ factor equal 1 and you are left with expectations of linear combination of moments. Thus
$$
  m_1 = P^\prime(1) \qquad m_2 = P_X^{\prime\prime}(1) + P_X^\prime(1)
  \qquad m_k = \sum_{m=0}^k \mathsf{S}^{(2)}_{k,m} P_X^{(m)}(1)
$$
where $\mathsf{S}^{(2)}_{k,m}$ is the Stirling number of the second kind.
A: If you were thinking about the moment generating function rather than the factorial moment generating function it would look like this: 
$M_{X}(t)=\exp( \lambda (e^t-1))$ is the moment generating function of a Poisson distribution, not $\exp( \lambda (t-1))$.
Differentiate it once to $M'_{X}(t)=\lambda \exp(\lambda (e^t-1)+t)$ and set $t=0$ (not $1$) to get $E[X]=M'_{X}(0)=\lambda$.
Differentiate it again to $M''_{X}(t)=\lambda^2 \exp(\lambda (e^t-1)+2t)+\lambda \exp(\lambda (e^t-1)+t)$ and set $t=0$ to get $E[X^2]=M''_{X}(0)=\lambda^2+\lambda$.
So $\operatorname{Var}(X)=E[X^2]-(E[X])^2=\lambda^2+\lambda-\lambda^2=\lambda$ as expected.
