By definition, a MGF (Pg. 366) is the sum of their probabilities * \(e^{tj}\) ;
\[ g(t) = E(e^{tX}) = \sum_{k=0}^{∞} \frac{μ_k t^k}{k!} = \sum_{j=1}^{∞} e^{tx_j}p(x_j) \]
For a binomial distribution \[ p_X(j) = \binom{n}{j}p^jq^{n-j} \] So the MGF g(t)
\[ g(t) = \sum_{j=0}^n e^{tj} \binom{n}{j}p^jq^{n-j} = (pe^t +q)^n \] To find variance and the mean, we need to calculate the first and the second derivative of the MGF with respect to t, and evaluate at 0. The first derivative is \[ g'(t=0) = npe^t(pe^t +1-p)^{n-1} = npe^0(pe^0 +1-p)^{n-1} = np(p-p+1)^{n-1} = np(1)^{n-1} = np \]
The second derivative is \[ g''(t=0) = npe^t(pe^t - p +1)^{n-2} (npe^t -p+1) = npe^0(pe^0 - p +1)^{n-2} (npe^0 -p+1) = np(np-p+1) \]
The expected value is \(μ_1 = g'(0) = np\).
The variance is \(μ_2 = g''(0) = np(np-p+1)\).
For an exponential distribution, for \(x \geq 0\) \[ p_X(j) = λ e^{-λx} \]
So the MGF g(t), where \(t < λ\) \[ g(t)=\int^∞_0 e^{tx}*λ e^{-λ x} = e^{-λ} \sum_{j=0}^∞ \frac{{(e^t λ)}^j}{j!} = -\frac{λ}{λ-t} \]
To find variance and the mean, we need to calculate the first and the second derivative of the MGF with respect to t, and evaluate at 0. The first derivative is \[ g'(t=0) = -\frac{-λ}{(λ-t)^2} = \frac{λ}{(λ-0)^2} = \frac{1}{λ} \]
The second derivative is \[ g''(t=0) = λ(-2)\frac{1}{(λ-t)^3}(-1) = \frac{2λ}{(λ-0)^3} = \frac{2}{λ^2} \]
The expected value is \(μ_1 = g'(0) = \frac{1}{λ}\).
The variance is \(μ_2 = g''(0) = E(X^2)-E(X)^2 = \frac{2}{λ^2} - (\frac{1}{λ})^2 = \frac{1}{λ^2}\).