Skip to main content

Section 3.5

Conditional Expectations

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

Question 3.5.1

Consider the following joint distribution between random variables \(X\) and \(Y\).

\[\mathbb{P}(X , Y)\] 1 2 3
0 0.10 0.15 0.05
1 0.20 0.30 0.10
2 0.05 0.03 0.02

(and of course, \(\mathbb{P}(X,Y) = 0\) otherwise.)

What is \(\mathbb{E}[X \ \vert\ Y]\)?

We first need to find \(\mathbb{P}_{X|Y}(X \ \vert\ Y) = \mathbb{P}_{X,Y}(x,y)/\mathbb{P}_Y(y)\)

We can sum over the columns to get \(\mathbb{P}(Y=y)\):

\[ P(Y=y) = \begin{cases} 0.35 & y = 1 \\ 0.48 & y = 2\\ 0.17 & y = 3\end{cases} \]

(notice these probabilities add to one).

Then, we can solve for \(\mathbb{P}(X = x \ \vert\ Y = y)\):

\(\mathbb{P}(X | Y)\) Y = 1 Y= 2 Y= 3
X = 0 0.10/0.35 = 2/7 0.15/0.48 = 5/16 0.05/0.17 = 5/17
X = 1 0.20/0.35 = 4/7 0.30/0.48 = 5/8 0.10/0.17 = 10/17
X = 2 0.05/0.35 = 1/7 0.03/0.48 = 1/16 0.02/0.17 = 2/17

\(\mathbb{E}[X \ \vert\ Y = 1] = \frac{2}{7}(0) + \frac{4}{7}[1] + \frac{1}{7}(2) = \frac{6}{7} = 0.857\)

\(\mathbb{E}[X \ \vert\ Y = 2] = \frac{5}{16}(0) + \frac{5}{8}[1] + \frac{1}{16}(2) = \frac{3}{4} = 0.750\)

\(\mathbb{E}[X \ \vert\ Y = 3] = \frac{5}{17}(0) + \frac{10}{17}[1] + \frac{2}{17}(2) = \frac{14}{17} = 0.824\)

Therefore,

\[ \mathbb{E}[X \ \vert\ Y = y] = \begin{cases} 0.857 & \text{ when y = 1}\\ 0.750 & \text{ when y = 2}\\ 0.824 & \text{ when y = 3} \end{cases} \]

(and otherwise undefined)

Question 3.5.2

Let \(\Theta \sim {\mathrm{Unif}}(0, 1)\) and let \(X \ \vert\ \Theta \sim {\mathrm{Binom}}(4, \Theta)\).

  1. What is \(\mathbb{E}[X]\)? You may refer to the general results of the expected values and variances of relevant distributions.

\[ \begin{aligned} \mathbb{E}[X] &= \mathbb{E}[\mathbb{E}[X \ \vert\ \Theta]]\\ &= \mathbb{E}[4\Theta]\\ &= 4\mathbb{E}[\Theta]\\ &= 4*0.5\\ &=2 \end{aligned} \]

  1. What is \(\operatorname{Var}[X]\)? You may refer to the general results of the expected values and variances of relevant distributions.

\[ \begin{aligned} \operatorname{Var}[X] &= \mathbb{E}[\operatorname{Var}[X \ \vert\ Y]] + \operatorname{Var}[\mathbb{E}[X \ \vert\ Y]]\\ &= \mathbb{E}[4(\Theta)(1 - \Theta)] + \operatorname{Var}[4\Theta]\\ &= 4\mathbb{E}[\Theta - \Theta^2] + 4^2\operatorname{Var}[\Theta]\\ &= 4\mathbb{E}[\Theta] - 4\mathbb{E}[\Theta^2] + 4^2\operatorname{Var}[\Theta]\\ &= 4[0.5] - 4\mathbb{E}[\Theta^2] + 4^2(1-0)^2/12\\ &= 2 - 4\mathbb{E}[\Theta^2] + 4/3\\ \end{aligned} \]

Now, we can actually solve for \(\mathbb{E}[\Theta^2]\) using \(\operatorname{Var}[\Theta] = \mathbb{E}[\Theta^2] - \mathbb{E}[\Theta]^2\). This implies \(\mathbb{E}[\Theta^2] = \operatorname{Var}[\Theta] + \mathbb{E}[\Theta]^2 = 1/12 + (1/2)^2 = 1/3\)

Thus,

\[ \begin{aligned} \operatorname{Var}[X] &= \mathbb{E}[\operatorname{Var}[X \ \vert\ Y]] + \operatorname{Var}[\mathbb{E}[X \ \vert\ Y]]\\ &= 2 - 4(1/3) + 4/3\\ &= 2 \end{aligned} \]

Question 3.5.3

Let \(X\) and \(Y\) be discrete random variables whose joint distribution puts probability \(1/5\) on each of the five pairs shown below.

(X , Y) 2 3 17
2 1/5 1/5 0
3 1/5 1/5 1/5

(and \(\mathbb{P}(X = x, Y = y) = 0\) otherwise.)

  1. What is \(\mathbb{E}[X \ \vert\ Y = 3]\)?

The column \(Y = 3\) has total probability \(\mathbb{P}(Y = 3) = 1/5 + 1/5 = 2/5\).

Then, \(\mathbb{P}(X = 2 \ \vert\ Y = 3) = \frac{\mathbb{P}(X = 2, Y = 3)}{\mathbb{P}(Y = 3)} = \frac{1/5}{2/5} = 1/2\). \(\mathbb{P}(X = 3 \ \vert\ Y = 3)\) is computed similarly, and equals 1/2 as well. Then:

\[ \mathbb{E}[X \ \vert\ Y = 3] = 2\left(\tfrac{1}{2}\right) + 3\left(\tfrac{1}{2}\right) = \frac{5}{2}. \]

  1. What is \(\mathbb{E}[Y \ \vert\ X = 3]\)?

The row \(X = 3\) has total probability \(\mathbb{P}(X = 3) = 3/5\).

Then, \(\mathbb{P}(Y = 2 \ \vert\ X = 3) = \frac{\mathbb{P}(X = 3, Y = 2)}{\mathbb{P}(X = 3)} = \frac{1/5}{3/5} = 1/3\). \(\mathbb{P}(Y = 3 \ \vert\ Y = 3)\) and \(\mathbb{P}(Y = 17 \ \vert\ Y = 3)\) are computed similarly, all yeilding 1/3 as well. Then:

\[ \mathbb{E}[Y \ \vert\ X = 3] = 2(1/3) + 3(1/3) + 17(1/3) = \frac{22}{3} \approx 7.33. \]

  1. What is \(\mathbb{E}[X \ \vert\ Y]\)?

We already have \(\mathbb{E}[X \ \vert\ Y = 3] = 5/2\) from part (a).

Redoing this computation for \(Y = 2\) gives us \(\mathbb{E}[X \ \vert\ Y = 2] = 5/2\).

Then, When \(Y = 17\), the only possible value is \(X = 3\), so \(\mathbb{E}[X \ \vert\ Y = 17] = 3\). Therefore

\[ \mathbb{E}[X \ \vert\ Y] = \begin{cases} 5/2 & \text{when } Y = 2 \\ 5/2 & \text{when } Y = 3 \\ 3 & \text{when } Y = 17. \end{cases} \]

Question 3.5.4

Let \(X\) and \(Y\) be jointly continuous with joint density

\[ f_{X,Y}(x,y) = \frac{9\,(xy + x^5y^5)}{16{,}000{,}900}, \qquad 0 < x < 4,\ 0 < y < 5, \]

and \(f_{X,Y}(x,y) = 0\) otherwise.

  1. What is \(\mathbb{E}[X \ \vert\ Y]\)?

First, the marginal density of \(Y\): for \(0 < y < 5\),

\[ f_Y(y) = \int_0^4 \frac{9}{16{,}000{,}900}\,(xy + x^5y^5)\,dx = \frac{9}{16{,}000{,}900}\left(8y + \tfrac{2048}{3}y^5\right). \]

Then for \(0 < y < 5\),

\[ \begin{aligned} \mathbb{E}[X \ \vert\ Y = y] &= \int_0^4 x\,\frac{f_{X,Y}(x,y)}{f_Y(y)}\,dx \\ &= \frac{\frac{9}{16{,}000{,}900}\int_0^4 (x^2 y + x^6 y^5)\,dx}{\frac{9}{16{,}000{,}900}\left(8y + \tfrac{2048}{3}y^5\right)} \\ &= \frac{\tfrac{64}{3}y + \tfrac{16384}{7}y^5}{8y + \tfrac{2048}{3}y^5}. \end{aligned} \]

Multiplying the numerator and denominator by \(21/(8y)\) gives

\[ \mathbb{E}[X \ \vert\ Y] = \frac{56 + 6144\,Y^4}{21 + 1792\,Y^4}. \]

  1. What is \(\mathbb{E}[Y \ \vert\ X]\)?

The marginal density of \(X\): for \(0 < x < 4\),

\[ f_X(x) = \int_0^5 \frac{9}{16{,}000{,}900}\,(xy + x^5y^5)\,dy = \frac{9}{16{,}000{,}900}\left(\tfrac{25}{2}x + \tfrac{15625}{6}x^5\right). \]

Then for \(0 < x < 4\),

\[ \begin{aligned} \mathbb{E}[Y \ \vert\ X = x] &= \frac{\frac{9}{16{,}000{,}900}\int_0^5 (x y^2 + x^5 y^6)\,dy}{\frac{9}{16{,}000{,}900}\left(\tfrac{25}{2}x + \tfrac{15625}{6}x^5\right)} \\ &= \frac{\tfrac{125}{3}x + \tfrac{78125}{7}x^5}{\tfrac{25}{2}x + \tfrac{15625}{6}x^5}. \end{aligned} \]

Multiplying the numerator and denominator by \(42/(25x)\) gives

\[ \mathbb{E}[Y \ \vert\ X] = \frac{70 + 18750\,X^4}{21 + 4375\,X^4}. \]

  1. Compute \(\mathbb{E}[\mathbb{E}[X \ \vert\ Y]]\) and verify that it equals \(\mathbb{E}[X]\).

Using \(f_Y\) and \(\mathbb{E}[X \ \vert\ Y = y]\) from part (a), the product \(\mathbb{E}[X \ \vert\ Y = y]\,f_Y(y)\) simplifies to \(9/16,000,900\left(\tfrac{64}{3}y + \tfrac{16384}{7}y^5\right)\). So

\[ \begin{aligned} \mathbb{E}[\mathbb{E}[X \ \vert\ Y]] &= \int_0^5 \frac{9}{16{,}000{,}900}\left(\tfrac{64}{3}y + \tfrac{16384}{7}y^5\right)dy \\ &= \frac{9}{16{,}000{,}900}\left(\tfrac{64}{3}\cdot\tfrac{25}{2} + \tfrac{16384}{7}\cdot\tfrac{15625}{6}\right) \\ &= \frac{9}{16{,}000{,}900}\left(\tfrac{800}{3} + \tfrac{128{,}000{,}000}{21}\right) \\ &= \frac{9}{16{,}000{,}900}\cdot\frac{128{,}005{,}600}{21} \approx 3.4285. \end{aligned} \]

Now compute \(\mathbb{E}[X]\) directly using \(f_X\) from part (b):

\[ \begin{aligned} \mathbb{E}[X] &= \int_0^4 x\,f_X(x)\,dx = \frac{9}{16{,}000{,}900}\int_0^4 \left(\tfrac{25}{2}x^2 + \tfrac{15625}{6}x^6\right)dx \\ &= \frac{9}{16{,}000{,}900}\left(\tfrac{25}{2}\cdot\tfrac{64}{3} + \tfrac{15625}{6}\cdot\tfrac{16384}{7}\right) \\ &= \frac{9}{16{,}000{,}900}\left(\tfrac{800}{3} + \tfrac{128{,}000{,}000}{21}\right) \approx 3.4285. \end{aligned} \]

The two agree, so \(\mathbb{E}[\mathbb{E}[X \ \vert\ Y]] = \mathbb{E}[X]\), as the law of total expectation says.

Question 3.5.5

A student must decide which summer job to take. Let \(C\) be the event that the student has to take a summer course, with \(\mathbb{P}(C) = 0.6\).

  • If \(C\) does not occur, the student works as a waiter.
  • If \(C\) occurs, the student works part-time at a hotel.

Let \(S\) be the student’s summer earnings (rounded to the nearest $1000). The distribution of \(S\) in each case is:

Earnings $1000 $2000 $3000 $4000
Waiter job (no course) 0.1 0.3 0.4 0.2
Hotel job (course) 0.3 0.4 0.2 0.1

What are the student’s expected summer earnings?

By the law of total expectation, conditioning on whether or not the course is needed,

\[ \mathbb{E}[S] = \mathbb{E}[S \ \vert\ C^c]\,\mathbb{P}(C^c) + \mathbb{E}[S \ \vert\ C]\,\mathbb{P}(C). \]

The two conditional expectations are

\[ \begin{aligned} \mathbb{E}[S \ \vert\ C^c] &= 1000(0.1) + 2000(0.3) + 3000(0.4) + 4000(0.2) = 2700,\\ \mathbb{E}[S \ \vert\ C] &= 1000(0.3) + 2000(0.4) + 3000(0.2) + 4000(0.1) = 2100. \end{aligned} \]

Therefore

\[ \mathbb{E}[S] = 2700(0.4) + 2100(0.6) = 1080 + 1260 = 2340. \]

The student’s expected summer earnings are $2340.

Question 3.5.6

Roll two fair six-sided dice. Let \(X\) be the number showing on the first die and let \(Z\) be the sum of the two numbers.

  1. What is \(\mathbb{E}[Z \ \vert\ X = 1]\)?

Let \(W\) be the number on the second die, so \(Z = X + W\), and \(W\) is independent of \(X\). By linearity of conditional expectation, and since \(X\) is known once we condition on it,

\[ \mathbb{E}[Z \ \vert\ X = x] = x + \mathbb{E}[W \ \vert\ X = x] = x + \mathbb{E}[W] = x + \frac{7}{2}. \]

With \(x = 1\), this gives \(\mathbb{E}[Z \ \vert\ X = 1] = 1 + 3.5 = 4.5\).

(Check directly: given \(X = 1\), \(Z\) is equally likely to be \(2, 3, 4, 5, 6, 7\), and the average of these is \(4.5\).)

  1. What is \(\mathbb{E}[Z \ \vert\ X = 6]\)?

Using the formula from part (a) with \(x = 6\),

\[ \mathbb{E}[Z \ \vert\ X = 6] = 6 + 3.5 = 9.5. \]

Question 3.5.7

Let \(X\) and \(Y\) be jointly continuous with joint density

\[ f_{X,Y}(x,y) = \frac{6}{19}\left(x^2 + y^3\right), \qquad 0 < x < 2,\ 0 < y < 1, \]

and \(f_{X,Y}(x,y) = 0\) otherwise.

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

First find the marginal density of \(X\): for \(0 < x < 2\),

\[ f_X(x) = \int_0^1 \frac{6}{19}\left(x^2 + y^3\right)dy = \frac{6}{19}\left(x^2 + \frac{1}{4}\right). \]

Then

\[ \mathbb{E}[X] = \int_0^2 x\,\frac{6}{19}\left(x^2 + \frac14\right)dx = \frac{6}{19}\left(\frac{2^4}{4} + \frac{1}{4}\cdot\frac{2^2}{2}\right) = \frac{6}{19}\left(4 + \frac12\right) = \frac{27}{19} \approx 1.42. \]

  1. What is \(\mathbb{E}[Y]\)?

The marginal density of \(Y\): for \(0 < y < 1\),

\[ f_Y(y) = \int_0^2 \frac{6}{19}\left(x^2 + y^3\right)dx = \frac{6}{19}\left(\frac{8}{3} + 2y^3\right) = \frac{16 + 12y^3}{19}. \]

Then

\[ \mathbb{E}[Y] = \int_0^1 y\,\frac{16 + 12y^3}{19}\,dy = \frac{1}{19}\left(8 + \frac{12}{5}\right) = \frac{52}{95} \approx 0.547. \]

  1. What is \(\mathbb{E}[X \ \vert\ Y]\)?

Using \(f_Y\) from part (b), for \(0 < y < 1\),

\[ \begin{aligned} \mathbb{E}[X \ \vert\ Y = y] &= \int_0^2 x\,\frac{\tfrac{6}{19}(x^2 + y^3)}{\tfrac{6}{19}\left(\tfrac{8}{3} + 2y^3\right)}\,dx \\ &= \frac{\int_0^2 (x^3 + x y^3)\,dx}{\tfrac{8}{3} + 2y^3} \\ &= \frac{4 + 2y^3}{\tfrac{8}{3} + 2y^3} \\ &= \frac{6 + 3y^3}{4 + 3y^3}. \end{aligned} \]

Therefore

\[ \mathbb{E}[X \ \vert\ Y] = \frac{6 + 3Y^3}{4 + 3Y^3}. \]