# Moment Generating Function
A moment generating function of a real valued random variable is an *alternative specification* of its probability distribution. This, it provides the basis of an alternative route to analytical results compared with working directly with probability density functions of cumulative distribution functions.
As its name implies, the moment generating function can be used to compute a distributions *moments*. The *n*th moment about 0 is the *n*th derivative of the moment-generating function, evaluated at 0.
### From My Notes...
Recall that a moment generating function of an RV $Y$ is defined as:
$M_Y(t) = E[e^{tY}] \; , \; t \in \mathbb{R}$
If we expand $e^{tY}$ we see that:
$e^{tY} = 1 + tY + \frac{t^2Y^2}{2!} + \frac{t^3Y^3}{3!} + \dots + + \frac{t^nY^n}{n!}$
Where we can then apply our expectation:
$M_Y(t) = E[e^{tY}] = E \Big[ 1 + tY + \frac{t^2Y^2}{2!} + \frac{t^3Y^3}{3!} + \dots + + \frac{t^nY^n}{n!} \Big]
$
Then, applying *linearity of expectation*:
$M_Y(t) = E[e^{tY}] = E \Big[ 1 \Big] +
t \overbrace{E \Big[ Y \Big]}^{\text{1st moment}} +
\frac{t^2}{2!}\overbrace{E\Big[ Y^2 \Big]}^{\text{2nd moment}} +
\frac{t^3}{3!}\overbrace{E\Big[ Y^3 \Big]}^{\text{3rd moment}} +
\dots +
\frac{t^n}{n!}\overbrace{E\Big[ Y^n \Big]}^{\text{nth moment}}
$
If we then differentiate $M_Y(t)$ $i$ times and set $t$ to 0, we obtain the $i$th moment about the origin.
### Key Ideas and Intuitions
* The moment generating function is a function of $t$, *not* our random variable in any way.
* The MGF provides a way of **encoding** the moments of $Y$
* While it is a function of $t$, it's growth rate isn't really dependent on $t$ per se; it is a function of the moments of the rv $Y$
* For instance, a quick experiment shows that if we have $Y ~ N(0,1)$ and $W ~ N(0, 10)$, $W$ has an MGF that grows *far faster* than $Y$
### Whiteboards
* [WB1](https://photos.google.com/search/whiteboards/photo/AF1QipMEDjnDHO8Y1q6AZGSfk_lCLbmM9o79HYPDHNMQ)
* [WB2](https://photos.google.com/search/whiteboards/photo/AF1QipPe198uXJys9dcAyas2IQOVGA_gRt6l84s6718o)
* [WB3](https://photos.google.com/search/whiteboards/photo/AF1QipOcPm7mSQJ1fWSvQp0SPzdp3uK3J97vAaaV5PNd)
---
Date: 20210825
Links to: [Mathematics MOC](Mathematics%20MOC.md) [Generating-Functions](Generating-Functions.md) [Johnson-Lindenstrauss-Lecture](Johnson-Lindenstrauss-Lecture.md)
Tags:
References:
* Notes in filing cabinet (high dimensional stats binder)
* Moments and Characteristic Functions notebook in math appendix of intuitively ML