Skip to main content

Section 3.1 and 3.2

Expectation

You will be given this formula sheet on Checkpoints and the Final.

Discrete (3.1)

Question 3.1.1

The joint PMF of discrete random variables \(X\) and \(Y\) is given by:

\(X \backslash Y\) \(Y=0\) \(Y=1\) \(P(X=x)\)
\(X=0\) 0.30 0.05 0.35
\(X=1\) 0.20 0.25 0.45
\(X=2\) 0.10 0.10 0.20
\(P(Y=y)\) 0.60 0.40 1.00
  1. Compute \(E(X)\)

By definition of expectation for discrete random variables,

\[ \mathbb{E}(X) = \sum_{x}\sum_{y} x \, P(X = x, Y = y). \]

Going cell by cell through the joint table:

\[ \begin{aligned} \mathbb{E}(X) &= 0 \cdot P(0, 0) + 0 \cdot P(0, 1) + 1 \cdot P(1, 0) + 1 \cdot P(1, 1) + 2 \cdot P(2, 0) + 2 \cdot P(2, 1)\\ &= 0 + 0 + 1(0.20) + 1(0.25) + 2(0.10)+ 2(0.10)\\ &= 0.85 \end{aligned} \]

You could also use the marginal distribution of \(X\) (less computation as it’s given on the right hand column of the table):

\[ \begin{aligned} \mathbb{E}(X) &= 0(0.35) + 1(0.45) + 2(0.20)\\ &= 0.85 \end{aligned} \]

  1. Compute \(E(XY)\)

By definition of expectation for discrete random variables,

\[ \mathbb{E}(XY) = \sum_{x}\sum_{y} xy \, P(X = x, Y = y). \]

Going cell by cell through the joint table:

\[ \begin{aligned} \mathbb{E}(XY) &= 0 \cdot 0 \cdot P(0, 0) + 0 \cdot 1 \cdot P(0, 1) + 1 \cdot 0 \cdot P(1, 0) + 1 \cdot 1 \cdot P(1, 1) + 2 \cdot 0 \cdot P(2, 0) + 2 \cdot 1 \cdot P(2, 1)\\ &= 0 + 0 + 0 + 1(0.25) + 0 + 2(0.10)\\ &= 0.25 + 0.20\\ &= 0.45 \end{aligned} \]

Question 3.1.2

Suppose \(X\) and \(Y\) have joint probability:

\[ p_{X,Y}(x,y) = \begin{cases} 1/9 & x = -4, y = -2\\ 2/9 & x = 5, y = -2\\ 3/9 & x = 9, y = -2\\ 2/9 & x = 9, y = 0\\ 1/9 & x = 9, y = 4\\ 0&\text{otherwise} \end{cases} \] (a) What is \(\mathbb{E}(X)\)?

\[ \begin{aligned} \mathbb{E}(X) &= \sum_{x}\sum_yxp_{X,Y}(x,y)\\ &= -4(1/9) + 5(2/9) + 9(3/9) + 9(2/9) + 9(1/9)\\ &\approx 6.67 \end{aligned} \]

  1. What is \(\mathbb{E}(X^2)\)?

\[ \begin{aligned} \mathbb{E}(X^2) &= \sum_{x}\sum_yx^2p_{X,Y}(x,y)\\ &= (-4)^2(1/9) + 5^2(2/9) + 9^2(3/9) + 9^2(2/9) + 9^2(1/9)\\ &\approx 61.33 \end{aligned} \]

  1. What is \(\mathbb{E}(e^{tx})\)?

\[ \begin{aligned} \mathbb{E}(e^{tx}) &= \sum_{x}\sum_ye^{tx}p_{X,Y}(x,y)\\ &= e^{-4t}(1/9) + e^{5t}(2/9) + e^{9t}(3/9) + e^{9t}(2/9) +e^{9t}(1/9)\\ &= \frac{1}{9}e^{-4t} + \frac{2}{9}e^{5t} +\frac{2}{3}e^{9t} \end{aligned} \]

Question 3.1.3

Suppose you flip one fair coin and roll one fair six-sided die. Let \(X\) be the product of the numbers of heads (i.e., 0 or 1) times the number showing on the die. Compute \(\mathbb{E}(X)\).

Let \(X = Y\times Z\) where \(Y\) is the number of heads and \(Z\) is the number showing on the dice. These are both independent random variables, so \(\mathbb{E}(X) = \mathbb{E}(YZ) = \mathbb{E}(Y)\mathbb{E}(Z)\).

\(\mathbb{E}(Y) = (1/2)(0) + (1/2)(1) = 1/2\)

\(\mathbb{E}(Z) = (1/6)(1) + (1/6)(2) +...+ (1/6)(6) = 3.5\).

Thus, \(\mathbb{E}(X) = \mathbb{E}(YZ) = \mathbb{E}(Y)\mathbb{E}(Z) = (1/2)(3.5) = 1.75\)

Question 3.1.4

A coffee shop records the number of drinks \(X\) in each mobile order. The PMF of \(X\) is \[ p_X(x) = \frac{x}{c} \quad \text{for } x \in \{1, 2, 3, 4\}, \] and \(p_X(x) = 0\) otherwise.

  1. Find the constant \(c\) that makes \(p_X\) a valid PMF.

  2. Compute \(E[X]\).

  3. Compute \(E[X^2]\). Is \(E[X^2] = (E[X])^2\)?

  4. The shop’s cost (in dollars) to process an order with \(X\) drinks is \(C = 2X^2 + 1\). Find the expected cost of processing an order, \(E[C]\).

The probabilities must sum to 1: \[ \sum_{x=1}^{4} \frac{x}{c} = \frac{1 + 2 + 3 + 4}{c} = \frac{10}{c} = 1 \] so \(c = 10\).

\[ \begin{aligned} E[X] &= \sum_{x=1}^{4} x \, p_X(x) \\ &= 1\left(\tfrac{1}{10}\right) + 2\left(\tfrac{2}{10}\right) + 3\left(\tfrac{3}{10}\right) + 4\left(\tfrac{4}{10}\right) \\ &= \frac{1 + 4 + 9 + 16}{10} = \frac{30}{10} = 3 \end{aligned} \]

Apply the function \(g(x) = x^2\) to each value and weight by the PMF: \[ \begin{aligned} E[X^2] &= \sum_{x=1}^{4} x^2 \, p_X(x) \\ &= 1^2\left(\tfrac{1}{10}\right) + 2^2\left(\tfrac{2}{10}\right) + 3^2\left(\tfrac{3}{10}\right) + 4^2\left(\tfrac{4}{10}\right) \\ &= \frac{1 + 8 + 27 + 64}{10} = \frac{100}{10} = 10 \end{aligned} \] Since \((E[X])^2 = 3^2 = 9 \neq 10\), we see that \(E[X^2] \neq (E[X])^2\). In general, \(E[g(X)] \neq g(E[X])\).

With \(g(x) = 2x^2 + 1\), \[ \begin{aligned} E[C] &= \sum_{x=1}^{4} (2x^2 + 1)\, p_X(x) \\ &= 3\left(\tfrac{1}{10}\right) + 9\left(\tfrac{2}{10}\right) + 19\left(\tfrac{3}{10}\right) + 33\left(\tfrac{4}{10}\right) \\ &= \frac{3 + 18 + 57 + 132}{10} = \frac{210}{10} = 21 \end{aligned} \] So the expected cost is \(\$21\).

Check using linearity: \(E[2X^2 + 1] = 2E[X^2] + 1 = 2(10) + 1 = 21\). ✓

Question 3.1.5 (NEWLY ADDED)

Suppose a new set of Pokemon cards is dropping, and you’re considering buying a pack (that contains 10 cards) for the purposes of reselling the individual cards.

To simplify the problem, we will assume that a set number of cards are produced, and then randomly placed in packs.

Card Type Resale Value Number of cards produced
Standard $0.01 100,000
Poke-ball Foil $0.05 50,000
Double Rare $0.50 7,000
Ultra Rare $1 3,500
Master Ball Foil $3 1,750
Special Illustration Rare $15 500
Hyper Rare $100 10
Chase Card $1000 1

If a pack of cards costs $10, is this a good strategy to make money?

What we need to do is compare the expected value of 10 cards to the cost of a 10-pack of cards. If the expected value is higher than $10, this might be a good strategy.

Let \(X\) be a random variable representing the cost (in dollars) of one card. The distribution of \(X\) is:

\[ p_X(x) = \begin{cases} \frac{100,000}{162761} \approx 0.6144 & x = 0.01\\ \frac{50,000}{162761} \approx 0.3072 & x = 0.05\\ \frac{7,000}{162761} \approx 0.0430 & x = 0.50\\ \frac{3,500}{162761} \approx 0.0215 & x = 1\\ \frac{1,750}{162761} \approx 0.0108 & x = 3\\ \frac{500}{162761} \approx 0.0031 & x = 15\\ \frac{10}{162761} \approx 0.00006 & x = 100\\ \frac{1}{162761} \approx 0.000006 & x = 1000\\ 0 & \text{otherwise} \end{cases} \]

Thus the expected value of a single card is:

\[ \mathbb{E}[X] =\sum_x xp_X(x) = 0.1551 \] and the expected value of a pack (ten cards) is:

\[ \begin{aligned} \mathbb{E}\left[\sum_{i = 1}^{10}X_i\right] &= \sum_{i = 1}^{10}E\left[X_i\right] \text{ by linearity} \\ &= \sum_{i = 1}^{10}(0.1551) \\ &= 10(0.1551) \\ &= 1.551 \end{aligned} \]

This is far less than the cost of the pack at $10. This is not a good strategy as we would, on average, see a revenue loss.

Continuous (3.2)

Question 3.2.1

Let \(f_X(x) = 2xI_{(0, 1)}(x)\).

  1. What is \(\mathbb{E}(X)\)?

\[ \begin{aligned} \mathbb{E}(X) &= \int_{0}^{1} x\cdot2x \,dx\\ &= \int_{0}^{1} 2x^2 \,dx\\ &= \frac{2}{3}x^3\Big|_{x = 0}^{x = 1}\\ &= \frac{2}{3} \end{aligned} \]

  1. What is \(\mathbb{E}(e^{tx})\) for \(t > 0\)?

\[ \begin{aligned} \mathbb{E}(e^{tx}) &= \int_{0}^{1} e^{tx}\cdot2x \,dx\\ &= \int_{0}^{1} 2xe^{tx} \,dx\\ \end{aligned} \]

Let \(u = 2x \implies du = 2dx\) and \(dv = e^{tx}dx \implies v = \frac{1}{t}e^{tx}\). By integration by parts we have:

\[ \begin{aligned} \mathbb{E}(e^{tx}) &= \int_{0}^{1} e^{tx}\cdot2x \,dx\\ &= \int_{0}^{1} 2xe^{tx} \,dx\\ &= (2x)\frac{1}{t}e^{tx}\Big|_{x = 0}^{x = 1} - \int_{0}^1\frac{2}{t}e^{tx}dx\\ &= \left[(2x)\frac{1}{t}e^{tx} - \frac{2}{t^2}{e^{tx}}\right]\Big|_{x = 0}^{x = 1}\\ &= \left(\frac{2}{t}- \frac{2}{t^2}\right)e^t + \frac{2}{t^2} \end{aligned} \]

Question 3.2.2

Let \(X\) and \(Y\) be jointly absolutely continuous random variables, with joint density function \[ f_{X,Y}(x,y) = \frac{3}{2}x^2I_{(0,1)}(x)I_{(0,2)}(y) \]

What is \(E(XY)\)?

\[ \begin{aligned} \mathbb{E}(XY) &= \int_{0}^{1} \int_0^{2}xy\cdot\frac{3}{2}x^2\, dydx\\ &= \int_{0}^{1} \int_0^{2}\frac{3}{2}x^3y\, dydx\\ &= \int_{0}^{1} \frac{3}{4}x^3y^2\Big|_{y = 0}^{y = 2}dx\\ &= \int_{0}^{1} \frac{3}{4}x^3(4)dx\\ &= \int_{0}^{1} 3x^3dx\\ &= \frac{3}{4}x^4 \Big|_{x = 0}^{x = 1}\\ &= \frac{3}{4} \end{aligned} \]

Question 3.2.3

Let \(X\) and \(Y\) be jointly absolutely continuous random variables, with joint density function \[ f_{X,Y}(x,y) = 6xy + \frac{9}{2}x^2y^2I_{(0,x)}(y)I_{(0,1)}(x) \]

What is \(E(X^3)\)?

\[ \begin{aligned} \mathbb{E}(X^3) &= \int_{0}^{1} \int_0^{x}x^3\cdot(6xy + \frac{9}{2}x^2y^2)\, dydx\\ &= \int_{0}^{1} \int_0^{x}(6x^4y + \frac{9}{2}x^5y^2)\, dydx\\ &= \int_{0}^{1} (3x^4y^2 + \frac{3}{2}x^5y^3)\Big|_{y = 0}^{y = x}\, dx\\ &= \int_{0}^{1} (3x^4x^2 + \frac{3}{2}x^5x^3)\, dx\\ &= \int_{0}^{1} (3x^6+ \frac{3}{2}x^8)\, dx\\ &= \left[ \frac{3}{7}x^7 + \frac{3}{18}x^9 \right]_{x = 0}^{x = 1}\\ &\approx 0.5952 \end{aligned} \]

Question 3.2.4

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

We have that \[\begin{aligned} \mathbb{E}[X^2] &= \int_0^\infty x^2 \frac{\lambda^\alpha}{\Gamma(\alpha)} x^{\alpha - 1} e^{-\lambda x} \mathsf{d}x \\ &= \frac{\lambda^\alpha}{\Gamma(\alpha)} \int_0^\infty x^{\alpha + 1} e^{-\lambda x} \mathsf{d}x \\ &= \frac{\lambda^\alpha}{\Gamma(\alpha)} \cdot \color{blue}{\frac{\Gamma(\alpha + 2)}{\lambda^{\alpha + 2}} } \int_0^\infty \color{blue}{\frac{\lambda^{\alpha + 2}}{\Gamma(\alpha + 2)}} \color{black}{x^{\alpha + 2 - 1} e^{-\lambda x} \mathsf{d}x} && \color{blue}{\text{multiply by 1}} \\ &= \frac{\Gamma(\alpha + 2)}{\lambda^2 \Gamma(\alpha)} && \text{integral is pdf of Gamma}(\alpha + 2, \lambda)\\ &= \frac{(\alpha + 1)\alpha(\alpha-1)!}{\lambda^2 (\alpha - 1)!} \\ &= \frac{(\alpha + 1)(\alpha)}{\lambda^2}. \end{aligned}\]