$\newcommand{\br}{\\}$ $\newcommand{\R}{\mathbb{R}}$ $\newcommand{\Q}{\mathbb{Q}}$ $\newcommand{\Z}{\mathbb{Z}}$ $\newcommand{\N}{\mathbb{N}}$ $\newcommand{\C}{\mathbb{C}}$ $\newcommand{\P}{\mathbb{P}}$ $\newcommand{\F}{\mathbb{F}}$ $\newcommand{\L}{\mathcal{L}}$ $\newcommand{\spa}[1]{\text{span}(#1)}$ $\newcommand{\dist}[1]{\text{dist}(#1)}$ $\newcommand{\max}[1]{\text{max}(#1)}$ $\newcommand{\min}[1]{\text{min}(#1)}$ $\newcommand{\supr}[1]{\text{sup}(#1)}$ $\newcommand{\infi}[1]{\text{inf}(#1)}$ $\newcommand{\ite}[1]{\text{int}(#1)}$ $\newcommand{\ext}[1]{\text{ext}(#1)}$ $\newcommand{\bdry}[1]{\partial #1}$ $\newcommand{\argmax}[1]{\underset{#1}{\text{argmax }}}$ $\newcommand{\argmin}[1]{\underset{#1}{\text{argmin }}}$ $\newcommand{\set}[1]{\left\{#1\right\}}$ $\newcommand{\emptyset}{\varnothing}$ $\newcommand{\tilde}{\text{~}}$ $\newcommand{\otherwise}{\text{ otherwise }}$ $\newcommand{\if}{\text{ if }}$ $\newcommand{\proj}{\text{proj}}$ $\newcommand{\union}{\cup}$ $\newcommand{\intercept}{\cap}$ $\newcommand{\abs}[1]{\left| #1 \right|}$ $\newcommand{\norm}[1]{\left\lVert#1\right\rVert}$ $\newcommand{\pare}[1]{\left(#1\right)}$ $\newcommand{\brac}[1]{\left[#1\right]}$ $\newcommand{\t}[1]{\text{ #1 }}$ $\newcommand{\head}{\text H}$ $\newcommand{\tail}{\text T}$ $\newcommand{\d}{\text d}$ $\newcommand{\limu}[2]{\underset{#1 \to #2}\lim}$ $\newcommand{\der}[2]{\frac{\d #1}{\d #2}}$ $\newcommand{\derw}[2]{\frac{\d #1^2}{\d^2 #2}}$ $\newcommand{\pder}[2]{\frac{\partial #1}{\partial #2}}$ $\newcommand{\pderw}[2]{\frac{\partial^2 #1}{\partial #2^2}}$ $\newcommand{\pderws}[3]{\frac{\partial^2 #1}{\partial #2 \partial #3}}$ $\newcommand{\inv}[1]{{#1}^{-1}}$ $\newcommand{\inner}[2]{\langle #1, #2 \rangle}$ $\newcommand{\nullity}[1]{\text{nullity}(#1)}$ $\newcommand{\rank}[1]{\text{rank }#1}$ $\newcommand{\nullspace}[1]{\mathcal{N}\pare{#1}}$ $\newcommand{\range}[1]{\mathcal{R}\pare{#1}}$ $\newcommand{\var}[1]{\text{var}\pare{#1}}$ $\newcommand{\cov}[1]{\text{cov}(#1)}$ $\newcommand{\cov}[2]{\text{cov}\pare{#1, #2}}$ $\newcommand{\tr}[1]{\text{tr}(#1)}$ $\newcommand{\oto}{\text{ one-to-one }}$ $\newcommand{\ot}{\text{ onto }}$ $\newcommand{\ceil}[1]{\lceil#1\rceil}$ $\newcommand{\floor}[1]{\lfloor#1\rfloor}$ $\newcommand{\Re}[1]{\text{Re}(#1)}$ $\newcommand{\Im}[1]{\text{Im}(#1)}$ $\newcommand{\dom}[1]{\text{dom}(#1)}$ $\newcommand{\fnext}[1]{\overset{\sim}{#1}}$ $\newcommand{\transpose}[1]{{#1}^{\text{T}}}$ $\newcommand{\b}[1]{\boldsymbol{#1}}$ $\newcommand{\None}[1]{}$ $\newcommand{\Vcw}[2]{\begin{bmatrix} #1 \br #2 \end{bmatrix}}$ $\newcommand{\Vce}[3]{\begin{bmatrix} #1 \br #2 \br #3 \end{bmatrix}}$ $\newcommand{\Vcr}[4]{\begin{bmatrix} #1 \br #2 \br #3 \br #4 \end{bmatrix}}$ $\newcommand{\Vct}[5]{\begin{bmatrix} #1 \br #2 \br #3 \br #4 \br #5 \end{bmatrix}}$ $\newcommand{\Vcy}[6]{\begin{bmatrix} #1 \br #2 \br #3 \br #4 \br #5 \br #6 \end{bmatrix}}$ $\newcommand{\Vcu}[7]{\begin{bmatrix} #1 \br #2 \br #3 \br #4 \br #5 \br #6 \br #7 \end{bmatrix}}$ $\newcommand{\vcw}[2]{\begin{matrix} #1 \br #2 \end{matrix}}$ $\newcommand{\vce}[3]{\begin{matrix} #1 \br #2 \br #3 \end{matrix}}$ $\newcommand{\vcr}[4]{\begin{matrix} #1 \br #2 \br #3 \br #4 \end{matrix}}$ $\newcommand{\vct}[5]{\begin{matrix} #1 \br #2 \br #3 \br #4 \br #5 \end{matrix}}$ $\newcommand{\vcy}[6]{\begin{matrix} #1 \br #2 \br #3 \br #4 \br #5 \br #6 \end{matrix}}$ $\newcommand{\vcu}[7]{\begin{matrix} #1 \br #2 \br #3 \br #4 \br #5 \br #6 \br #7 \end{matrix}}$ $\newcommand{\Mqw}[2]{\begin{bmatrix} #1 & #2 \end{bmatrix}}$ $\newcommand{\Mqe}[3]{\begin{bmatrix} #1 & #2 & #3 \end{bmatrix}}$ $\newcommand{\Mqr}[4]{\begin{bmatrix} #1 & #2 & #3 & #4 \end{bmatrix}}$ $\newcommand{\Mqt}[5]{\begin{bmatrix} #1 & #2 & #3 & #4 & #5 \end{bmatrix}}$ $\newcommand{\Mwq}[2]{\begin{bmatrix} #1 \br #2 \end{bmatrix}}$ $\newcommand{\Meq}[3]{\begin{bmatrix} #1 \br #2 \br #3 \end{bmatrix}}$ $\newcommand{\Mrq}[4]{\begin{bmatrix} #1 \br #2 \br #3 \br #4 \end{bmatrix}}$ $\newcommand{\Mtq}[5]{\begin{bmatrix} #1 \br #2 \br #3 \br #4 \br #5 \end{bmatrix}}$ $\newcommand{\Mqw}[2]{\begin{bmatrix} #1 & #2 \end{bmatrix}}$ $\newcommand{\Mwq}[2]{\begin{bmatrix} #1 \br #2 \end{bmatrix}}$ $\newcommand{\Mww}[4]{\begin{bmatrix} #1 & #2 \br #3 & #4 \end{bmatrix}}$ $\newcommand{\Mqe}[3]{\begin{bmatrix} #1 & #2 & #3 \end{bmatrix}}$ $\newcommand{\Meq}[3]{\begin{bmatrix} #1 \br #2 \br #3 \end{bmatrix}}$ $\newcommand{\Mwe}[6]{\begin{bmatrix} #1 & #2 & #3\br #4 & #5 & #6 \end{bmatrix}}$ $\newcommand{\Mew}[6]{\begin{bmatrix} #1 & #2 \br #3 & #4 \br #5 & #6 \end{bmatrix}}$ $\newcommand{\Mee}[9]{\begin{bmatrix} #1 & #2 & #3 \br #4 & #5 & #6 \br #7 & #8 & #9 \end{bmatrix}}$
Definition: Moment Generating Function (MGF)

Let $X$ be a random variable, we define the moment generating function (or transform) of $X$ to be the function $M_X: \R \to \R $ such that

$$M_X(t) = E\brac{ e^{Xt}}, t \in \R $$

Discrete:

$$M_X(t) = \sum_{x \in \R} e^{xt} p_X(t)$$

Continuous:

$$M_X(t) = \int_{ \R } e^{xt} f_X(x) \d x$$

Example

Let $X$ be a random variable with $\begin{align*} \frac{ 1 }{ 2 } & x = 2 \br \frac{ 1 }{ 6 } & x = 3 \br \frac{ 1 }{ 3 } & x = 5 \br 0 & \otherwise \end{align*}$

$M_X(t) = E\brac{ e^{Xt}} = \frac{ 1 }{ 2 } e^{2t} + \frac{ 1 }{ 6 } e^{3t} + \frac{ 1 }{ 3 } e^{5t}$

Lemma : The MGF Associated With a Linear Function of a Random Variable

Let $M_X(s)$ be the transform associated with a random variable $X$. Consider a new random variable $Y = aX + b$, $ a, b \in \R $.

$$M_Y(t) = e^{bt} M_X(at)$$

Proof
  </span>
</span>
<span class="proof__expand"><a>[expand]</a></span>

$M_Y(t) = E\brac{ e^{yt}} = E\brac{ e^{(aX + b)t}} = E\brac{ e^{(at)x} e^{bt}} = e^{bt} E\brac{ e^{(at)X}}$

Example

$Y \text{~} N(\mu, \sigma^2), X \text{~} N(0, 1)$

$Y = \sigma X + \mu $

$f_X(x) = \frac{ 1 }{ \sqrt[ ]{ 2 \pi }} e ^{- \frac{ x^2 }{ 2 }} $

$M_X(t) = \int_{ \R } e^{xt} f_X(x) \d x = \int_{ \R } \frac{ 1 }{ \sqrt[ ]{ 2 \pi } e ^{ - \frac{ x^2 }{ 2 }}} \d x = \int_{ \R } e^{ - (\frac{ x^2 }{ 2 } - xt + \frac{ t^2 }{ 2 })} e^{ \frac{ t^2 }{ 2 }} \d x = e^ { \frac{ t^2 }{ 2 }}$

Example

$X \text{~} \text{ Poisson}(\lambda) , p_X(k) = \begin{cases} \frac{\lambda^k}{k!} e^{-\lambda} & k = 0, 1, 2, … \br 0 & \otherwise \end{cases}$

$M_X(t) = \sum_{ k = 0 }^{ \infty } e^{kt} \frac{ \lambda^k e^{- \lambda}}{ k! } = e ^{ - \lambda } e^{ e^t \lambda } = e^{ \lambda (e^t - 1)}, \forall t \in \R$

Remarks

$M_X(t)$ may not be defined for all $t \in \R $

$f_X(x) = \begin{cases} \frac{ 1 }{ x^2 } & x \geq 1\br 0, & x < 1 \end{cases}$

$M_X(t) = \int_{ 1 }^{ \infty } \frac{ e^{xt}}{ x^2 } \d x $ does not converge for $t > 0 $

$\int_{ \R } x \d x = \int_{ 1 }^{ \infty } \frac{ 1 }{ x^2 } \d x = 1$

Moment generating function is only defined for $(-\infty, 0]$.

Remarks

For $t = 0 $, $M_X(0) = E\brac{ e^{0x}} = E\brac{ 1 } = 1$

If $h: \R \to \R $ such that $h(0) \neq 1 $, then $h $ cannot be the MGF function for some random variable $X$.

That is, here is no random variable $X$, such that $M_X(t) = h(t), \forall t \in \R$.

Theorem : Inversion Theorem

Let $X $ and $Y $ be two random variable with $M_X(t) $ and $M_Y(t) $ defined for all $t \in \R $ (for all $t$ in some open interval $(a, b)$ in $\R$). If $M_X(t) = M_Y(t), \forall t \in \R$($\forall t \in (a, b)$).

Then $F_X(s) = F_Y(s) \forall s \in R$. $X $ and $Y $ have the same distribution.

Example

Suppose a random variable $X $ has MGF given as

$$M_X(t) = \frac{ 1 }{ y } e^{-t} + \frac{ 1 }{ 2 } + \frac{ 1 }{ 8 } e^{yt} + \frac{ 1 }{ 8 } e^{5t} $$

What is the distribution of $X $

$$ p_X(x) = \begin{cases} \frac{ 1 }{ 4 } & x = -1 \br \frac{ 1 }{ 2 } & x= 0 \br \frac{ 1 }{ 8 } & x = 4 \br \frac{ 1 }{ 8 } & x = 5 \br 0 & \otherwise \end{cases} $$

Note

Recall that the nth moment of a random variable $X $ is $E\brac{ X^n } $ from MGF to moments.

$\der{ }{ t } M_X(t) = \der{ }{ t } E\brac{ e^{xt}} = E\brac{ \der{ }{ t } e^{xt}} = E\brac{ x e^{xt}} $

$\der{ }{ t } M_X(t) \big |_{t = 0} = E\brac{ X } $

$E\brac{ e^{xt}} = E\brac{ 1 + \frac{ xt }{ 1 ! } + \frac{ \pare{xt}^2 }{ 2! } + … } = \sum_{ n = 0 }^{ \infty } E\brac{ \frac{(xt)^n }{ n! }} = \sum_{ n = 0 }^{ \infty } \frac{ E\brac{ X } t^n }{ n! } $

This is the “exponential” quality function for the sequence $E\brac{ X^2 } \big |^ \infty _{n = 0} $

$\frac{ \d ^n }{ \d t^n } E\brac{ e^{xt}} \big |_{t = 0} = \frac{ \d ^n }{ \d t^n } \frac{ \pare{E\brac{ x^n } t^n }}{ n! } \big |_ {t = 0} = E\brac{ X^n } $

Theorem

If $M_X(t) $ is defined in a neighborhood of $0$ then

$$\frac{ \d ^n }{ \d t^n } M_X(t) \big | _{t = 0} = E\brac{ X^n }$$

Proof
  </span>
</span>
<span class="proof__expand"><a>[expand]</a></span>

Discrete:

$\der{ }{ t } (M_X(t)) = \der{ }{ t } (\sum_{ x \in \R } e^{xt p_X(x)}) = \sum_{ x \in \R } \der{ }{ t } \pare{e^{xt} p_X(x)} = \sum_{ x \in \R } x e^{xt} p_X(x) $

$\frac{ \d ^n }{ \d t^n } M_X(t) = \sum_{ r \in \R } x^n e^{xt} p_X(x) $

$\der{ }{ t } M_X(t) \big | _{t = 0} = \sum_{ x \in \R } x p_X(x) = E\brac{ X } $

Example

$X \text{~}\text{ Exp}(\lambda), \lambda > 0$

$f_X(x) = \begin{cases} \lambda e^{ - \lambda }x & x \geq 0 \br 0 & \otherwise \end{cases}$

$M_X(x) = \int_{ x \in \R } e^{xt} f_X(x) \d x = \int_{ 0 }^{ \infty } e^{xt} (\lambda e^{ - \lambda x }) \d x = \lambda \int_{ 0 }^{ \infty } e^{x (t - \lambda)} \d x $

for $t < \lambda $

$= \frac{ \lambda }{ t - \lambda } e^{x (t - \lambda)} \big | ^ \infty _0 = \frac{ \lambda^0 }{ t - \lambda } (0 - 1) = \frac{ \lambda }{ \lambda - t } $

$\der{ }{ t } M_X(t) \big | _{t = 0} = \frac{ \lambda }{(\lambda - t)^2 } \big | _{t = 0} = \frac{ 1 }{ \lambda } = E\brac{ X } $

$\frac{ \d ^n }{ \d t^n } M_X(t) \big | _{t = 0} = \frac{ n! }{ \lambda^n }$(by induction)

Note that $\frac{ \lambda }{ \lambda - t } = \frac{ 1 }{ 1 - \frac{ t }{ \lambda }} = 1 + \frac{ t }{ \lambda } + \frac{ t^2 }{ \lambda^2 } + … = \sum_{ n=0 }^{ \infty } \frac{ t^n }{ \lambda^n }$