The Binomal distribution is given as:
\(\binom{n}{x}p^x(1-p)^{n-x}\) or \(b(x; n, p) = \frac{n!}{x!(n − x)!}p^xq^{n−x}\) with \(q = 1 − p\)
Moment Generation function is given by
\[ \begin{aligned} M(t)&=\sum_{x = 0}^{n} e^{tx}\binom{n}{x}p^x(1-p)^{n-x}\\ &=\sum_{x = 0}^{n} e^{tx}\frac{n!}{x!(n − x)!}p^xq^{n−x}\\ &=\sum_{x = 0}^{n} (pe^t)^x\frac{n!}{x!(n − x)!}xq^{n−x}\\ &=(pe^t + 1 − p)^n\\ &=(pe^t + q)^n\\ \end{aligned} \]
With the first moment we differentiate the MFG with respect to t
\[ \begin{aligned} M'(t)&=n(pe^t + q)^{n-1}pe^t\\ &=npe^t(pe^t+q)^{n-1} \end{aligned} \]
Evaluating at t=0 we get the mean \[\begin{aligned}M'(0)=E(X)&= np(q + p)^{n−1}\\ &=np(1-p+p)^{n-1}\\ &=np \end{aligned}\]
For the second moment with t = 0
\[ \begin{aligned} M''(t)= E(X^2)&=(n-1)npe^t(pe^t+q)^{n-2}pe^t + (npe^t)(pe^t + q)^{n-1}\\ &=np(n-1)(p+q)^{n-2}(p)+np(p+q)^{n-1}\\ &=np(n-1)p+np\\ &=(n^2p - np)p+np\\ &=n^2p^2-np^2 + np\\ &= np(np-p+1)\\ &=np(np+q) \end{aligned} \]
The Variance
\[ \begin{aligned} V(X)&=E(X^2) - [E(X)]^2\\ &=np(np+q)- n^2p^2\\ &=n^2p^2+npq-n^2p^2\\ &=npq \end{aligned} \]
The exponential function goes as follows:
\(f_X^{(x)} = \lambda e^{-\lambda x}\)
Using the MFG method
[ \begin{aligned}M(t)&= ({-}^{+} e{tx}f_X{(x)} ; dx)\ &=({0}^{} e{tx}e{-x} ; dx)\ &=({0}^{} e^{x(t- )}; dx)\ &={0}^{}\ &=\ &=[0-1]\ &=where t-< 0, t<\end{aligned}
]
N.B \(M(t)\) can be written also as \(\lambda(\lambda-t)^{-1}\)
Finding the first moment
\[ \begin{aligned} M'(0) = E(X)&= \lambda(\lambda-t)^{-1}\\ &=(-1)(\lambda)(\lambda-t)^{-2}(-1) \quad use \ of \ chain \ rule\\ &=\lambda(\lambda-t)^{-2}\\ &=\lambda(\lambda-0)^{-2}\\ &=\frac{\lambda}{(\lambda)^2}=\frac{1}{\lambda} \end{aligned} \]
Second derivative
\[ \begin{aligned} M''(0)=E(X^2)&= \lambda(\lambda-t)^{2}\\ &=(-2)(\lambda)(\lambda-t)^{-3}(-1) \quad use \ of \ chain \ rule\\ &=2\lambda(\lambda-t)^{-3}\\ &=2\lambda(\lambda-0)^{-3}\\ &=\frac{2\lambda}{(\lambda)^3}= \frac{2\lambda}{\lambda^2} \end{aligned} \]
The Variance
\[ \begin{aligned}V(X) &= E(X^2) - [E(X)]^2\\ &=\frac{2}{\lambda^2} - \frac{1}{\lambda^2}\\ &=\frac{1}{\lambda^2} \end{aligned} \]