1. Learning goals
By the end, students should be able to compute and interpret expectations, moments, variance, and MGFs.
Expectation
Use sums or integrals to compute the theoretical average.
Moments
Summarize location, spread, and shape of a distribution.
MGF
Differentiate at zero to obtain moments when the MGF exists near zero.
2. Interactive expectation calculator
Enter a finite probability mass function. The probabilities are automatically normalized if they do not sum to one.
Discrete random variable
Bar chart of the PMF
The blue vertical line marks $E[X]$. The spread around this line is measured by variance.
3. Moments and variance
Moments are expectations of powers of the random variable.
Moment table
Teaching note
The first raw moment is the mean. The second raw moment gives variance after subtracting the square of the mean. Higher moments describe asymmetry and tail behavior.
Standard normal vs a discrete distribution with matching moments
Homework-style fact: a finite collection of moments may not determine the distribution.
4. Moment-generating function explorer
Select a distribution, change parameters, and compare the MGF with the moments.
Choose a distribution
Graph of $M_X(t)$ near 0
5. Mean vs median through loss functions
The mean minimizes squared error; the median minimizes absolute error.
Distribution: $f(x)=3x^2$, $0
This example has mean $E[X]=3/4$ and median $m=2^{-1/3}\approx 0.7937$.
In-class prompt: Move $a$. Which loss is smallest near the mean? Which is smallest near the median?
This example has mean $E[X]=3/4$ and median $m=2^{-1/3}\approx 0.7937$.
Loss curves
6. Course examples
Short interactive computations inspired by Section 4 homework problems.
Uniform and triangular MGFs
Poisson threshold
Find the smallest mean λ such that $P(X\ge 2)>0.99$ for $X\sim Poisson(\lambda)$.
Pareto mean and variance
7. Quick check
Use these as short in-class questions or self-study prompts.
Question 1
If $M_X(t)=e^{3t+2t^2}$, what are $E[X]$ and $Var(X)$?
Question 2
For $X\sim Poisson(\lambda)$, what is $M_X(t)$?
Question 3
Which value minimizes $E[(X-a)^2]$?