Lecture 17

Expectation


Grace Tompkins

Last modified — 13 Nov 2026

Learning Outcomes

By the end of this lecture, students are anticipated to be able to:

  • Calculate expected values from continuous and discrete random variables/distributions

  • Apply properties to functions of expected values

1 Expected Values

Expected Value of Random Variables

The expected value of a random variable \(g(X)\) is defined by

\[ \mathbb{E}[g(X)] = \begin{cases} \displaystyle\sum_{x} g(x) p_X(x) & \text{if $X$ is discrete}\\ \\ \displaystyle\int_{-\infty}^\infty g(x) f_X(x) \mathsf{d}x & \text{if $X$ is absolutely continuous} \end{cases} \]

provided that the sum or integral exists.

  • The sum in the discrete case is over all \(x\) such that \(p_X(x) > 0\) (countable).
  • The sum/integral exists when \(\mathbb{E}[|g(X)|] < \infty\). Otherwise, we say that \(\mathbb{E}[g(X)]\) does not exist.
  • Note that you do not need to know the distribution/PMF/PDF/CDF of \(g(X)\) to compute \(\mathbb{E}[g(X)]\), only the distribution of \(X\) itself.

Expected Value of a Random Variable

Let \(X\) be the value of the face of a die when rolled. What is the expected value of \(X\)?

Expected Value of a Random Variable

Let \(X \sim {\mathrm{Binom}}(n, \theta)\). What is \(\mathbb{E}[X]\)?

Hint: we can use kernel matching and use the fact that \(x\binom{n}{x} = n\binom{n-1}{x-1}\).

Expected Value of a Random Variable

Expected Value of a Random Variable

Recall that the PDF of a RV \(Y\sim{\mathrm{Gam}}(\theta, \beta)\) is given by \[f_X(x) = \frac{\lambda^\alpha}{\Gamma(\alpha)} x^{\alpha - 1} e^{-\lambda x} I_{(0,\infty)}(x).\]

Suppose\(X \sim \textrm{Gamma}(\alpha, \lambda )\). What is \(\mathbb{E}[X]\)?

Expected Value of a Random Variable

Expected Value of a Random Variable

Let \(X \sim {\mathrm{Gam}}(\alpha, \lambda)\) where \(\alpha>0\) and \(\lambda > 0\).

Let \(t < \lambda\). Find \(\mathbb{E}[\exp(tX)]\).

Expected Value of a Random Variable

Important Properties

(Where the expected value exists.)

Linearity
for any \(a, b, c \in {\mathbb{R}}\), any functions \(g\) and \(h\), and any random variables \(X\) and \(Y\). \[\mathbb{E}[a g(X) + b h(Y) + c] = a \mathbb{E}[g(X)] + b \mathbb{E}[h(Y)] + c\]
Boundedness
If \(a< g(x) < b\) for all \(x\) in the support of \(X\), then \(a < \mathbb{E}[g(X)] < b.\)


Monotonicity
If \(g(x) \le h(x)\) for all \(x\) in the support of \(X\), then \(\mathbb{E}[g(X)] \le \mathbb{E}[h(X)].\)


Independence
If \(X\) and \(Y\) are independent, then \[\mathbb{E}[g(X) h(Y)] = \mathbb{E}[g(X)] \mathbb{E}[h(Y)].\] NOTE: the converse is false.

Expected Value of A Function of Two Random Variables

Let \(X\sim U(0,\theta)\) and \(Y\sim{\mathrm{Exp}}(1)\) be independent.

Find \(\mathbb{E}\left[\frac{1}{2}(X + Y)^2\right]\).

Expected Value of A Function of Two Random Variables

Scalar-valued Functions of Multiple Random Variables

Let \(g : {\mathbb{R}}^2 \to {\mathbb{R}}\) be a function.

If \(X\) and \(Y\) are both discrete random variables, then \[\begin{aligned} \mathbb{E}[g(X, Y)] &= \sum_{x} \sum_{y} g(x, y) p_{X,Y}(x, y). \end{aligned}\] If \(X\) and \(Y\) are jointly absolutely continuous random variables, then \[\begin{aligned} \mathbb{E}[g(X, Y)] &= \int_{-\infty}^\infty \int_{-\infty}^\infty g(x, y) f_{X,Y}(x, y) \mathsf{d}x \mathsf{d}y. \end{aligned}\]

Product of Expectations

  • If \(X\) and \(Y\) are independent, then \(\mathbb{E}[g(X)h(Y)] = \mathbb{E}[g(X)]\mathbb{E}[h(Y)]\).

Suppose that \(X\) and \(Y\) are jointly absolutely continuous random variables with joint PDF \(f_{X,Y}(x, y)\). Note that \(\mathbb{E}[g(X)h(Y)]\) is a scalar-valued function of \(X\) and \(Y\).

\[\begin{aligned} \mathbb{E}[g(X)h(Y)] &= \int_{-\infty}^\infty \int_{-\infty} ^\infty g(x) h(y) f_{X,Y}(x, y) \mathsf{d}x \mathsf{d}y \\ &= \int_{-\infty}^\infty \int_{-\infty}^\infty g(x) h(y) f_X(x) f_Y(y) \mathsf{d}x\mathsf{d}y && \text{$X$ and $Y$ are independent} \\ &= \int_{-\infty}^\infty g(x) f_X(x) \mathsf{d}x \int_{-\infty}^\infty h(y) f_Y(y) \mathsf{d}y \\ &= \mathbb{E}[g(X)] \mathbb{E}[h(Y)]. \end{aligned}\]

Expectations from a Joint Distribution

Let \(X\) and \(Y\) have joint PDF \[f_{X,Y}(x,y) = 8xyI_{\{0 < x < y < 1\}}(x,y).\]

  1. Calculate \(\mathbb{E}[X]\).
  2. Calculate \(\mathbb{E}[Y]\).
  3. Calculate \(\mathbb{E}[XY]\).

Expectations from a Joint Distribution

Expectations from a Joint Distribution

Expectations from a Joint Distribution

Consider the following joint distribution:

\(\mathbb{P}(X,Y)\) \(1\) \(2\) \(3\)
\(0\) 0.10 0.05 0.05
\(1\) 0.10 0.20 0.10
\(2\) 0.05 0.10 0.25

Find \(\mathbb{E}[XY]\).

This is the end of the Midterm 2 content

  • Midterm 2 is in class on Friday November 20 (testing sections 2.4 (continuous RV/distributions) to 3.2 (today’s class))

  • Start prepping your cheat sheet

    • MUST BE HAND WRITTEN! No photo copies, typed, or tablet-written and printed sheets allowed
    • 8.5 inches x 11 inches or less
    • You can have one (1) single page, and can write on both sides
  • Calculators will be inspected

    • Must be non-programmable, non-graphing, non-wifi-ing.