Finding the mean of the Poisson distribution using the moment generating function Problem:
Let $X$ have a Poisson distribution with parameters $\lambda$. Use moment generating function to find the mean and variance
of $X$.
Answer:
For the  Poisson distribution we have $M_x(t) = e^{\lambda(t-1)}$. Now, to find the mean, $u$, we compute $M_x'(0)$.
\begin{align*}
M_x'(t) &= \lambda e^{\lambda(t-1)} \\
M_x'(0) &= \lambda e^{\lambda(0-1)} = \lambda e^{-\lambda} \\
u &= \lambda e^{-\lambda}
\end{align*}
Where did I go wrong? The answer should be $\lambda$.
Here is a revised solution based upon the comments of Ekesh Kumar. I now correctly find the mean, but I get the wrong
value for the variance.
For the  Poisson distribution we have $M_x(t) = e^{\lambda(e^t-1)}$. Now, to find the mean, $u$, we compute $M_x'(0)$.
\begin{align*}
M_x'(t) &= \lambda e^t e^{\lambda(e^t-1)} \\
M_x'(0) &= \lambda e^0 e^{\lambda(e^0-1)} = \lambda  e^{\lambda(1-1)}  \\
M_x'(0) &=  \lambda \\
u &=  \lambda 
\end{align*}
Now to find $E(x^2)$, I find $M''_x(0)$.
\begin{align*}
M_x''(t) &= \lambda e^t ( \lambda e^t e^{\lambda(e^t-1) } ) + \lambda e^t \lambda e^t e^{\lambda(e^t-1)} \\
M_x''(0) &= \lambda e^0 ( \lambda e^0 e^{\lambda(e^0-1) } ) + \lambda e^0 \lambda e^0 e^{\lambda(e^0-1)} \\
M_x''(0) &= \lambda  ( \lambda  e^{\lambda(1-1) } ) + \lambda  \lambda e^0 e^{\lambda(1-1)} \\
M_x''(0) &= \lambda  ( \lambda  e^{\lambda(1-1) } ) + \lambda  \lambda  e^{\lambda(0)} \\
M_x''(0) &= \lambda \lambda + \lambda \lambda = 2{\lambda}^2 \\
\sigma_2 &= M_x''(0) - u^2 = 2{\lambda}^2 - {\lambda}^2 \\  
\sigma_2 &= {\lambda}^2
\end{align*}
 A: Your approach is right, but your moment generating function is wrong. It should be $M_X(t) = e^{\lambda(e^t-1)}$ as derived here.
A: Let's clarify the difference between two approaches. The probability-generating function$$G_X(t):=\Bbb Et^X=\sum_{k\ge0}t^ke^{-\lambda}\frac{\lambda^k}{k!}=e^{-\lambda}e^{\lambda t}$$satisfies$$G_X^{(n)}(t)=\Bbb Et^X(X)_n=\lambda^ne^{-\lambda}e^{\lambda t}$$in terms of falling Pochhammer symbols, so$$\Bbb E(X)_n=G_X^{(n)}(1)=\lambda^n.$$In particular$$\begin{align}\Bbb EX&=\lambda,\\\Bbb E(X^2-X)&=\lambda^2,\\\Bbb EX^2&=\lambda^2+\lambda,\\\operatorname{Var}X&=\Bbb EX^2-(\Bbb EX)^2=\lambda^2+\lambda-\lambda^2=\lambda.\end{align}$$The moment-generating function$$M_X(t):=\Bbb Ee^{tX}=G_X(e^t)=e^{-\lambda}e^{\lambda e^t}$$satisfies$$M_X^{(n)}(t)=\Bbb EX^ne^{tX}=e^{-\lambda}\frac{d^n}{dt^n}e^{\lambda e^t}$$so$$\Bbb EXe^{tX}=M_X^\prime(t)=\lambda e^{-\lambda}e^te^{\lambda e^t}$$and$$\Bbb EX^2e^{tX}=M_X^{\prime\prime}(t)=\lambda e^{-\lambda}e^te^{\lambda e^t}\left(1+\lambda e^t\right).$$Hence$$\Bbb EX=M_X^{\prime}(0)=\lambda e^{-\lambda}e^0e^\lambda=\lambda$$and$$\Bbb EX^2=M_X^{\prime\prime}(0)=\lambda e^{-\lambda}e^0e^{\lambda}\left(1+\lambda\right)=\lambda^2+\lambda,$$so $\operatorname{Var}X=\lambda$ by the same logic as before.
