1 00:00:00,000 --> 00:00:00,390 2 00:00:00,390 --> 00:00:01,370 Hi. 3 00:00:01,370 --> 00:00:03,330 In this problem, we're going to get a bunch of practice 4 00:00:03,330 --> 00:00:05,710 working with multiple random variables together. 5 00:00:05,710 --> 00:00:09,200 And so we'll look at joint PDFs, marginal PDFs, 6 00:00:09,200 --> 00:00:12,000 conditional PDFs, and also get some practice calculating 7 00:00:12,000 --> 00:00:14,420 expectations as well. 8 00:00:14,420 --> 00:00:20,800 So the problem gives us a pair of random variables-- x and y. 9 00:00:20,800 --> 00:00:25,340 And we're told that the joint distribution is uniformly 10 00:00:25,340 --> 00:00:31,010 distributed on this triangle here, with the vertices being 11 00:00:31,010 --> 00:00:34,180 0, 0 1, 0, and 0, 1. 12 00:00:34,180 --> 00:00:37,180 So it's uniform in this triangle. 13 00:00:37,180 --> 00:00:39,640 And the first part of the problem is just to figure out 14 00:00:39,640 --> 00:00:45,280 what exactly is disjoint PDF of the two random variables. 15 00:00:45,280 --> 00:00:48,720 So in this case, it's pretty easy to calculate, because we 16 00:00:48,720 --> 00:00:50,320 have a uniform distribution. 17 00:00:50,320 --> 00:00:52,710 And remember, when you have a uniform distribution, you can 18 00:00:52,710 --> 00:00:55,540 just imagine it being a sort of plateau 19 00:00:55,540 --> 00:00:56,720 coming out of the board. 20 00:00:56,720 --> 00:00:57,800 And it's flat. 21 00:00:57,800 --> 00:01:01,827 And so the height of the plateau, in order to calculate 22 00:01:01,827 --> 00:01:04,849 it, you just need to figure out what the area of this 23 00:01:04,849 --> 00:01:06,630 thing is, of this triangle is. 24 00:01:06,630 --> 00:01:09,010 So remember, when you had single random variables, what 25 00:01:09,010 --> 00:01:13,380 we had to do was calculate, for uniform distribution, we 26 00:01:13,380 --> 00:01:14,910 had to integrate to 1. 27 00:01:14,910 --> 00:01:17,860 So you took the length, and you took 1 over the length was 28 00:01:17,860 --> 00:01:19,770 the correct scaling factor. 29 00:01:19,770 --> 00:01:24,460 Here, you take the area. 30 00:01:24,460 --> 00:01:28,610 And the height has to make it so that the entire volume here 31 00:01:28,610 --> 00:01:30,520 integrates to 1. 32 00:01:30,520 --> 00:01:33,810 So the joint PDF is just going to be 1 over 33 00:01:33,810 --> 00:01:34,960 whatever this area is. 34 00:01:34,960 --> 00:01:36,550 And the area is pretty simple to calculate. 35 00:01:36,550 --> 00:01:38,480 It's 1/2 base times height. 36 00:01:38,480 --> 00:01:40,390 So it's 1/2. 37 00:01:40,390 --> 00:01:42,960 And so what we have is that the area is 1/2. 38 00:01:42,960 --> 00:01:52,100 And so the joint PDF of x and y is going to equal 2. 39 00:01:52,100 --> 00:01:56,320 But remember, you always have to be careful when writing 40 00:01:56,320 --> 00:01:58,860 these things to remember the ranges when 41 00:01:58,860 --> 00:02:00,930 these things are valid. 42 00:02:00,930 --> 00:02:03,690 So it's only 2 within this triangle. 43 00:02:03,690 --> 00:02:05,650 And outside of the triangle, it's 0. 44 00:02:05,650 --> 00:02:09,070 So what exactly does inside the triangle mean? 45 00:02:09,070 --> 00:02:12,510 Well, we can write it more mathematically. 46 00:02:12,510 --> 00:02:19,980 So this diagonal line, it's given by x plus y equals 1. 47 00:02:19,980 --> 00:02:23,890 So everything in the triangle is really x plus y is less 48 00:02:23,890 --> 00:02:24,490 than or equal to 1. 49 00:02:24,490 --> 00:02:26,680 It means everything under this triangle. 50 00:02:26,680 --> 00:02:30,660 And so we need x plus y to be less then or equal to 1 and 51 00:02:30,660 --> 00:02:33,305 also x to be non-negative and y to be non-negative. 52 00:02:33,305 --> 00:02:36,400 53 00:02:36,400 --> 00:02:39,830 So with these inequalities, that captures everything 54 00:02:39,830 --> 00:02:41,020 within this triangle. 55 00:02:41,020 --> 00:02:47,020 And otherwise, the joint PDF is going to be 0. 56 00:02:47,020 --> 00:02:49,890 57 00:02:49,890 --> 00:02:54,280 The next part asks us to find, using this joint PDF, the 58 00:02:54,280 --> 00:02:56,140 marginal of y. 59 00:02:56,140 --> 00:02:59,600 And remember, when you have a joint PDF of two random 60 00:02:59,600 --> 00:03:01,580 variables, you essentially have everything that you need, 61 00:03:01,580 --> 00:03:03,620 because from this joint PDF, you can calculate marginals, 62 00:03:03,620 --> 00:03:05,840 you can calculate from the margins, you can calculate 63 00:03:05,840 --> 00:03:07,980 conditionals. 64 00:03:07,980 --> 00:03:10,000 The joint PDF captures everything that there is to 65 00:03:10,000 --> 00:03:13,980 know about this pair of random variables. 66 00:03:13,980 --> 00:03:17,620 Now, to calculate a marginal PDF of y, remember a marginal 67 00:03:17,620 --> 00:03:20,880 really just means collapsing the other 68 00:03:20,880 --> 00:03:22,300 random variable down. 69 00:03:22,300 --> 00:03:24,770 And so you can just imagine taking this thing and 70 00:03:24,770 --> 00:03:28,460 collapsing it down onto the y-axis. 71 00:03:28,460 --> 00:03:33,900 And mathematically, that is just saying that we integrate 72 00:03:33,900 --> 00:03:38,710 out the other random variable. 73 00:03:38,710 --> 00:03:41,250 74 00:03:41,250 --> 00:03:43,910 So the other random variable in this case will be x. 75 00:03:43,910 --> 00:03:47,020 We take x and we get rid of it by integrating out from 76 00:03:47,020 --> 00:03:49,640 negative infinity to infinity. 77 00:03:49,640 --> 00:04:01,130 Of course, this joint PDF is 0 in a lot of places. 78 00:04:01,130 --> 00:04:04,240 And so a lot of these will be 0. 79 00:04:04,240 --> 00:04:07,710 And only for a certain range of x's will this integral 80 00:04:07,710 --> 00:04:10,330 actually be non-zero. 81 00:04:10,330 --> 00:04:13,740 And so again, the other time when we have to be careful is 82 00:04:13,740 --> 00:04:16,500 when we have these limits of integration, we need to make 83 00:04:16,500 --> 00:04:18,720 sure that we have the right limits. 84 00:04:18,720 --> 00:04:22,150 And so we know that the joint PDF is 2. 85 00:04:22,150 --> 00:04:25,010 It's nonzero only within this triangle. 86 00:04:25,010 --> 00:04:33,810 And so it's only 2 within this triangle, which 87 00:04:33,810 --> 00:04:36,130 means what for x? 88 00:04:36,130 --> 00:04:39,120 Well, depending on what x and y are, this will 89 00:04:39,120 --> 00:04:41,380 be either 2 or 0. 90 00:04:41,380 --> 00:04:44,360 So let's just fix some value of y. 91 00:04:44,360 --> 00:04:49,550 Pretend that we've picked some value y, let's say here. 92 00:04:49,550 --> 00:04:52,170 We want this value of y. 93 00:04:52,170 --> 00:04:56,660 Well, what are the values of x such that the joint PDF for 94 00:04:56,660 --> 00:05:00,950 that value y is actually nonzero, it's actually 2? 95 00:05:00,950 --> 00:05:05,310 Well, it's everything from x equals 0 to whatever 96 00:05:05,310 --> 00:05:06,520 x value this is. 97 00:05:06,520 --> 00:05:09,680 But this x value, actually, if you think about it, is just 1 98 00:05:09,680 --> 00:05:13,840 minus y, because this line is x plus y equals 1. 99 00:05:13,840 --> 00:05:17,880 So whatever y is, x is going to be 1 minus that. 100 00:05:17,880 --> 00:05:21,010 And so the correct limits would actually be from 101 00:05:21,010 --> 00:05:23,040 0 to 1 minus y. 102 00:05:23,040 --> 00:05:26,120 103 00:05:26,120 --> 00:05:28,890 And then the rest of that is pretty simple. 104 00:05:28,890 --> 00:05:29,850 You integrate this. 105 00:05:29,850 --> 00:05:31,650 This is a pretty simple integral. 106 00:05:31,650 --> 00:05:35,570 And you get that it's actually two times 1 minus y. 107 00:05:35,570 --> 00:05:36,820 That's a y. 108 00:05:36,820 --> 00:05:40,930 109 00:05:40,930 --> 00:05:46,340 But of course, again, we need to make sure that we have the 110 00:05:46,340 --> 00:05:48,260 right regions. 111 00:05:48,260 --> 00:05:51,590 So this is not always true for y, of course. 112 00:05:51,590 --> 00:05:58,380 This is only true for y between 0 and 1. 113 00:05:58,380 --> 00:06:04,690 And otherwise, it's actually 0, because when you take a y 114 00:06:04,690 --> 00:06:08,890 down here, well, there's no values of x that will give you 115 00:06:08,890 --> 00:06:10,550 a nonzero joint PDF. 116 00:06:10,550 --> 00:06:13,000 And if you take a value of y higher than this, the same 117 00:06:13,000 --> 00:06:14,250 thing happens. 118 00:06:14,250 --> 00:06:16,610 119 00:06:16,610 --> 00:06:18,900 So we can actually draw this out and see 120 00:06:18,900 --> 00:06:20,720 what it looks like. 121 00:06:20,720 --> 00:06:25,480 So let's actually draw a small picture here. 122 00:06:25,480 --> 00:06:27,440 Here's y. 123 00:06:27,440 --> 00:06:29,900 Here's the marginal PDF of y. 124 00:06:29,900 --> 00:06:32,530 And here's 2. 125 00:06:32,530 --> 00:06:34,123 And it actually looks like this. 126 00:06:34,123 --> 00:06:40,760 It's a triangle and a 0 outside this range. 127 00:06:40,760 --> 00:06:42,010 So does that make sense? 128 00:06:42,010 --> 00:06:49,870 Well, first of all, you see that actually does in fact 129 00:06:49,870 --> 00:06:51,730 integrates to 1, which is good. 130 00:06:51,730 --> 00:06:57,980 And the other thing we notice is that there is a higher 131 00:06:57,980 --> 00:07:00,010 density for smaller values of y. 132 00:07:00,010 --> 00:07:00,950 So why is that? 133 00:07:00,950 --> 00:07:03,500 Why are smaller values of y more likely than 134 00:07:03,500 --> 00:07:04,720 larger values of y? 135 00:07:04,720 --> 00:07:06,830 Well, because when you have smaller values of 136 00:07:06,830 --> 00:07:10,770 y, you're down here. 137 00:07:10,770 --> 00:07:14,520 And it's more likely because there are more values of x 138 00:07:14,520 --> 00:07:18,400 that go along with it that make that value of y more 139 00:07:18,400 --> 00:07:19,350 likely to appear. 140 00:07:19,350 --> 00:07:21,630 Say you have a large value of y. 141 00:07:21,630 --> 00:07:22,850 Then you're up here at the tip. 142 00:07:22,850 --> 00:07:25,660 Well, there aren't very many combinations of x and y that 143 00:07:25,660 --> 00:07:28,010 give you that large a value of y. 144 00:07:28,010 --> 00:07:31,700 And so that large value of y becomes less likely. 145 00:07:31,700 --> 00:07:33,420 Another way to think about it is, when you collapse this 146 00:07:33,420 --> 00:07:38,440 down, there's a lot more stuff to collapse down its base. 147 00:07:38,440 --> 00:07:40,560 There's a lot of x's to collapse down. 148 00:07:40,560 --> 00:07:44,175 But up here, there's only a very little bit of x to 149 00:07:44,175 --> 00:07:44,550 collapse down. 150 00:07:44,550 --> 00:07:49,280 And the PDF of y becomes more skewed towards 151 00:07:49,280 --> 00:07:50,530 smaller values of y. 152 00:07:50,530 --> 00:07:55,450 153 00:07:55,450 --> 00:07:59,560 So now, the next thing that we want to do is calculate the 154 00:07:59,560 --> 00:08:02,850 conditional PDF of x, given y. 155 00:08:02,850 --> 00:08:07,490 Well, let's just recall what that means. 156 00:08:07,490 --> 00:08:09,480 This is what we're looking for-- the conditional PDF of 157 00:08:09,480 --> 00:08:11,490 x, given y. 158 00:08:11,490 --> 00:08:17,380 And remember, this is calculated by taking the joint 159 00:08:17,380 --> 00:08:19,180 and dividing by the marginal of y. 160 00:08:19,180 --> 00:08:22,220 161 00:08:22,220 --> 00:08:25,460 So we actually have the top and the bottom. 162 00:08:25,460 --> 00:08:28,760 We have to joint PDF from part A. And from part B, we 163 00:08:28,760 --> 00:08:30,630 calculated the marginal PDF of y. 164 00:08:30,630 --> 00:08:33,309 So we have both pieces. 165 00:08:33,309 --> 00:08:38,230 So let's actually plug them in. 166 00:08:38,230 --> 00:08:42,450 Again, the thing that you have to be careful here is about 167 00:08:42,450 --> 00:08:46,410 the ranges of x and y where these things are valid, 168 00:08:46,410 --> 00:08:50,770 because this is only non-zero when x and y 169 00:08:50,770 --> 00:08:52,410 fall within this triangle. 170 00:08:52,410 --> 00:08:57,070 And this is only non-zero when y is between 0 and 1. 171 00:08:57,070 --> 00:08:59,510 So we need to be careful. 172 00:08:59,510 --> 00:09:03,360 So the top, when it's non-zero, it's 2. 173 00:09:03,360 --> 00:09:06,720 And the bottom, when it's non-zero, it's 2 174 00:09:06,720 --> 00:09:08,790 times 1 minus y. 175 00:09:08,790 --> 00:09:14,270 So we can simplify that to be 1 over 1 minus y. 176 00:09:14,270 --> 00:09:16,250 And when is this true? 177 00:09:16,250 --> 00:09:23,240 Well, it's true when x and y are in the triangle and y is 178 00:09:23,240 --> 00:09:26,040 between 0 and 1. 179 00:09:26,040 --> 00:09:30,400 So put another way, that means that this is valid when y is 180 00:09:30,400 --> 00:09:50,380 between 0 and 1 and x is between 0 and 1 minus y, 181 00:09:50,380 --> 00:09:54,540 because whatever x has to be, it has to be such that they 182 00:09:54,540 --> 00:09:57,860 actually still fall within this triangle. 183 00:09:57,860 --> 00:10:03,150 And outside of this, it's 0. 184 00:10:03,150 --> 00:10:06,690 185 00:10:06,690 --> 00:10:09,970 So let's see what this actually looks like. 186 00:10:09,970 --> 00:10:14,710 187 00:10:14,710 --> 00:10:21,140 So this is x, and this is the conditional PDF of x, given y. 188 00:10:21,140 --> 00:10:24,160 189 00:10:24,160 --> 00:10:25,410 Let's say this is 1 right here. 190 00:10:25,410 --> 00:10:33,100 191 00:10:33,100 --> 00:10:37,480 Then what it's saying is, let's say we're given that y 192 00:10:37,480 --> 00:10:38,280 is some little y. 193 00:10:38,280 --> 00:10:41,810 Let's say it's somewhere here. 194 00:10:41,810 --> 00:10:46,050 Then it's saying that the conditional PDF of x given y 195 00:10:46,050 --> 00:10:47,350 is this thing. 196 00:10:47,350 --> 00:10:50,790 But notice that this value, 1 over 1 minus y, does not 197 00:10:50,790 --> 00:10:52,030 depend on x. 198 00:10:52,030 --> 00:10:56,090 So in fact, it actually is uniform. 199 00:10:56,090 --> 00:11:03,360 So it's uniform between 0 and 1 minus y. 200 00:11:03,360 --> 00:11:11,560 And the height is something like 1 over 1 minus y. 201 00:11:11,560 --> 00:11:15,810 And this is so that the scaling makes it so that 202 00:11:15,810 --> 00:11:23,100 actually is a valid PDF, because the integral is to 1. 203 00:11:23,100 --> 00:11:25,030 So why is the case? 204 00:11:25,030 --> 00:11:28,340 Why is that when you condition on y being some value, you get 205 00:11:28,340 --> 00:11:32,690 that the PDF of x is actually uniform? 206 00:11:32,690 --> 00:11:35,370 Well, when you look over here, let's again just pretend that 207 00:11:35,370 --> 00:11:37,070 you're taking this value of y. 208 00:11:37,070 --> 00:11:41,290 Well, when you're conditioning on y being this value, you're 209 00:11:41,290 --> 00:11:45,640 basically taking a slice of this joint PDF at this point. 210 00:11:45,640 --> 00:11:49,350 But remember, the original joint PDF was uniform. 211 00:11:49,350 --> 00:11:52,830 So when you take a slice of a uniform distribution, joint 212 00:11:52,830 --> 00:11:54,070 uniform distribution, you still get 213 00:11:54,070 --> 00:11:55,480 something that is uniform. 214 00:11:55,480 --> 00:11:59,300 Just imagine that you have a cake that is flat. 215 00:11:59,300 --> 00:12:02,080 Now, you take a slice at this level. 216 00:12:02,080 --> 00:12:05,810 Then whatever slice you have is also going to be imagine 217 00:12:05,810 --> 00:12:08,320 being a flat rectangle. 218 00:12:08,320 --> 00:12:10,520 So it's still going to be uniform. 219 00:12:10,520 --> 00:12:13,840 And that's why the conditional PDF of x 220 00:12:13,840 --> 00:12:15,100 given y is also uniform. 221 00:12:15,100 --> 00:12:19,500 222 00:12:19,500 --> 00:12:25,780 Part D now asks us to find a conditional expectation of x. 223 00:12:25,780 --> 00:12:30,000 So we want to find the expectation of x, given that y 224 00:12:30,000 --> 00:12:33,320 is some little y. 225 00:12:33,320 --> 00:12:37,610 And for this, we can use the definition. 226 00:12:37,610 --> 00:12:40,720 Remember, expectations are really just weighted sums. 227 00:12:40,720 --> 00:12:44,210 Or in the [? continuous ?] case, it's an integral. 228 00:12:44,210 --> 00:12:48,390 So you take the value. 229 00:12:48,390 --> 00:12:51,700 And then you weight it by the density. 230 00:12:51,700 --> 00:12:54,410 And in this case, because we're taking conditional a 231 00:12:54,410 --> 00:12:59,250 expectation, what we weight it by is the conditional density. 232 00:12:59,250 --> 00:13:02,440 So it's the conditional density of x given 233 00:13:02,440 --> 00:13:04,526 that y is little y. 234 00:13:04,526 --> 00:13:06,470 We integrate with respect to x. 235 00:13:06,470 --> 00:13:09,800 236 00:13:09,800 --> 00:13:12,440 And fortunately, we know what this conditional PDF is, 237 00:13:12,440 --> 00:13:17,380 because we calculated it earlier in part C. And we know 238 00:13:17,380 --> 00:13:18,530 that it's this-- 239 00:13:18,530 --> 00:13:20,240 1 over 1 minus y. 240 00:13:20,240 --> 00:13:25,930 But again, we have to be careful, because this formula, 241 00:13:25,930 --> 00:13:29,590 1 over 1 minus y, is only valid certain cases. 242 00:13:29,590 --> 00:13:31,230 So let's think about this first. 243 00:13:31,230 --> 00:13:32,620 Let's think about some extreme cases. 244 00:13:32,620 --> 00:13:36,450 What if y, little y, is negative? 245 00:13:36,450 --> 00:13:38,740 If little y is negative, we're conditioning on 246 00:13:38,740 --> 00:13:41,480 something over here. 247 00:13:41,480 --> 00:13:48,620 And so there is no density for y being negative or for y, 248 00:13:48,620 --> 00:13:51,640 say, in other cases when y is greater than 1. 249 00:13:51,640 --> 00:13:54,790 And so in those cases, this expectation is just undefined, 250 00:13:54,790 --> 00:13:57,780 because conditioning on that doesn't really make sense, 251 00:13:57,780 --> 00:14:02,910 because there's no density for those values of y. 252 00:14:02,910 --> 00:14:06,560 Now, let's consider the case that actually makes, sense 253 00:14:06,560 --> 00:14:09,120 where y is between 0 and 1. 254 00:14:09,120 --> 00:14:12,500 Now, we're in business, because that is the range 255 00:14:12,500 --> 00:14:15,010 where this formula is valid. 256 00:14:15,010 --> 00:14:17,870 So this formula is valid, and we can plug it in. 257 00:14:17,870 --> 00:14:21,760 So it's 1 over 1 minus y dx. 258 00:14:21,760 --> 00:14:24,665 And then the final thing that we again need to check is what 259 00:14:24,665 --> 00:14:27,270 the limits of this integration is. 260 00:14:27,270 --> 00:14:29,610 So we're integrating with respect to x. 261 00:14:29,610 --> 00:14:33,810 So we need to write down what values of x, what ranges of x 262 00:14:33,810 --> 00:14:36,560 is this conditional PDF valid. 263 00:14:36,560 --> 00:14:39,070 Well, luckily, we specified that here. 264 00:14:39,070 --> 00:14:43,072 x has to be between 0 and 1 minus y. 265 00:14:43,072 --> 00:14:46,200 266 00:14:46,200 --> 00:14:52,310 So let's actually calculate this integral. 267 00:14:52,310 --> 00:14:56,660 This 1 over 1 minus y is a constant with respect to x. 268 00:14:56,660 --> 00:14:58,090 You can just pull that out. 269 00:14:58,090 --> 00:15:01,130 And then now, you're really just integrating x from 270 00:15:01,130 --> 00:15:02,970 0 to 1 minus y. 271 00:15:02,970 --> 00:15:06,530 So the integral of x is [? 1 ?], 1/2x squared. 272 00:15:06,530 --> 00:15:10,960 So you get a 1/2x squared, and you integrate that from 273 00:15:10,960 --> 00:15:12,580 0 to 1 minus y. 274 00:15:12,580 --> 00:15:14,600 And so when you plug in the limits, you'll 275 00:15:14,600 --> 00:15:18,200 get a 1 minus y squared. 276 00:15:18,200 --> 00:15:20,550 That will cancel out the 1 over 1 minus y. 277 00:15:20,550 --> 00:15:24,570 And what you're left with is just 1 minus y over 2. 278 00:15:24,570 --> 00:15:28,600 279 00:15:28,600 --> 00:15:31,780 And again, we have to specify that this is only true for y 280 00:15:31,780 --> 00:15:34,650 between 0 and 1. 281 00:15:34,650 --> 00:15:39,720 Now, we can again actually verify that this makes sense. 282 00:15:39,720 --> 00:15:42,450 What we're really looking for is the conditional expectation 283 00:15:42,450 --> 00:15:44,870 of x given some value of y. 284 00:15:44,870 --> 00:15:47,750 And we already said that condition on y being some 285 00:15:47,750 --> 00:15:50,800 value of x is uniformly distributed between 286 00:15:50,800 --> 00:15:52,700 0 and 1 minus y. 287 00:15:52,700 --> 00:15:55,190 And so remember for our uniform distribution, the 288 00:15:55,190 --> 00:15:56,140 expectation is simple. 289 00:15:56,140 --> 00:15:57,310 It's just the midpoint. 290 00:15:57,310 --> 00:16:00,550 So the midpoint of 0 and 1 minus y is 291 00:16:00,550 --> 00:16:02,350 exactly 1 minus y/2. 292 00:16:02,350 --> 00:16:05,340 So that's a nice way of verifying that this answer is 293 00:16:05,340 --> 00:16:06,590 actually correct. 294 00:16:06,590 --> 00:16:09,450 295 00:16:09,450 --> 00:16:15,740 Now, the second part of part D asks us to do 296 00:16:15,740 --> 00:16:16,990 a little bit more. 297 00:16:16,990 --> 00:16:20,060 298 00:16:20,060 --> 00:16:26,000 We have to use the total expectation theorem in order 299 00:16:26,000 --> 00:16:29,510 to somehow write the expectation of x in terms of 300 00:16:29,510 --> 00:16:30,760 the expectation of y. 301 00:16:30,760 --> 00:16:33,560 302 00:16:33,560 --> 00:16:36,510 So the first thing we'll do is use the 303 00:16:36,510 --> 00:16:37,880 total expectation theorem. 304 00:16:37,880 --> 00:16:41,630 So the total expectation theorem is just saying, well, 305 00:16:41,630 --> 00:16:44,970 we can take these conditional expectations. 306 00:16:44,970 --> 00:16:54,420 And now, we can integrate this by the marginal density of y, 307 00:16:54,420 --> 00:16:58,080 then we'll get the actual expectation of x. 308 00:16:58,080 --> 00:17:02,115 You can think of it as just kind of applying the law of 309 00:17:02,115 --> 00:17:03,365 iterated expectations as well. 310 00:17:03,365 --> 00:17:06,490 311 00:17:06,490 --> 00:17:12,990 So this integral is going to look like this. 312 00:17:12,990 --> 00:17:17,329 You take the conditional expectation. 313 00:17:17,329 --> 00:17:22,569 So this is the expectation of x if y were equal to little y. 314 00:17:22,569 --> 00:17:26,260 And now, what is that probability? 315 00:17:26,260 --> 00:17:30,370 Well, now we just multiply that by the density of y at 316 00:17:30,370 --> 00:17:32,830 that actual value of little y. 317 00:17:32,830 --> 00:17:34,310 And we integrate with respect to y. 318 00:17:34,310 --> 00:17:37,470 319 00:17:37,470 --> 00:17:39,540 Now, we've already calculated what this conditional 320 00:17:39,540 --> 00:17:40,700 expectation is. 321 00:17:40,700 --> 00:17:42,100 It's 1 minus y/2. 322 00:17:42,100 --> 00:17:45,430 So let's plug that in. 323 00:17:45,430 --> 00:17:49,680 1 minus y/2 times the marginal of y. 324 00:17:49,680 --> 00:17:55,540 325 00:17:55,540 --> 00:17:58,010 There's a couple ways of attacking this problem now. 326 00:17:58,010 --> 00:18:00,310 One way is, we can actually just plug in 327 00:18:00,310 --> 00:18:01,490 that marginal of y. 328 00:18:01,490 --> 00:18:06,710 We've already calculated that out in part B. And then we can 329 00:18:06,710 --> 00:18:09,570 do this integral and calculate out the expectation. 330 00:18:09,570 --> 00:18:13,230 But maybe we don't really want to do so much calculus. 331 00:18:13,230 --> 00:18:15,190 So let's do what the problem says and 332 00:18:15,190 --> 00:18:16,710 try a different approach. 333 00:18:16,710 --> 00:18:20,870 So what the problem suggests is to write this in terms of 334 00:18:20,870 --> 00:18:22,450 the expectation of y. 335 00:18:22,450 --> 00:18:23,960 And what is the expectation of y? 336 00:18:23,960 --> 00:18:28,370 Well, the expectation of y is going to look something like 337 00:18:28,370 --> 00:18:33,010 the integral of y times the marginal of y. 338 00:18:33,010 --> 00:18:35,220 So let's see if we can identify something like that 339 00:18:35,220 --> 00:18:36,500 and pull it out. 340 00:18:36,500 --> 00:18:38,630 Well, yeah, we actually do have that. 341 00:18:38,630 --> 00:18:42,070 We have y times the marginal of y, integrated. 342 00:18:42,070 --> 00:18:44,700 So let's isolate that. 343 00:18:44,700 --> 00:18:48,660 So besides that, we also have this. 344 00:18:48,660 --> 00:18:57,930 We have the integral of the first term, is 1/2 times the 345 00:18:57,930 --> 00:18:59,320 marginal of y. 346 00:18:59,320 --> 00:19:04,320 And then the second term is minus 1/2 times the integral 347 00:19:04,320 --> 00:19:10,580 of y of dy. 348 00:19:10,580 --> 00:19:13,000 This is just me splitting this integral up into 349 00:19:13,000 --> 00:19:15,980 two separate integrals. 350 00:19:15,980 --> 00:19:17,690 Now, we know what this is. 351 00:19:17,690 --> 00:19:18,950 The 1/2 we can pull out. 352 00:19:18,950 --> 00:19:21,870 And then the rest of it is just the integral of a 353 00:19:21,870 --> 00:19:24,540 marginal of a density from minus infinity to infinity. 354 00:19:24,540 --> 00:19:27,810 And by definition, that has to be equal to 1. 355 00:19:27,810 --> 00:19:32,250 So this just gives us a 1/2. 356 00:19:32,250 --> 00:19:33,820 And now, what is this? 357 00:19:33,820 --> 00:19:35,130 We get a minus 1/2. 358 00:19:35,130 --> 00:19:39,290 And now this, we already said that is the expectation of y. 359 00:19:39,290 --> 00:19:44,060 So what we have is the expectation of y. 360 00:19:44,060 --> 00:19:49,500 So in the second part of this part D, we've expressed the 361 00:19:49,500 --> 00:19:53,050 expectation of x in terms of the expectation of y. 362 00:19:53,050 --> 00:19:56,520 Now, maybe that seems like that's not too helpful, 363 00:19:56,520 --> 00:19:59,710 because we don't know what either of those two are. 364 00:19:59,710 --> 00:20:04,170 But if we think about this problem, and as part E 365 00:20:04,170 --> 00:20:07,190 suggests, we can see that there's symmetry in this 366 00:20:07,190 --> 00:20:12,420 problem, because x and y are essentially symmetric. 367 00:20:12,420 --> 00:20:16,740 So imagine this is x equals y. 368 00:20:16,740 --> 00:20:20,430 There's symmetry in this problem, because if you were 369 00:20:20,430 --> 00:20:24,530 to swap the roles of x and y, you would have exactly the 370 00:20:24,530 --> 00:20:26,510 same joint PDF. 371 00:20:26,510 --> 00:20:31,660 So what that suggests is that by symmetry then, it must be 372 00:20:31,660 --> 00:20:36,060 that the expectation of x and the expectation of y are 373 00:20:36,060 --> 00:20:39,230 exactly the same. 374 00:20:39,230 --> 00:20:41,080 And that is using the symmetry argument. 375 00:20:41,080 --> 00:20:45,850 And that helps us now, because we can plug that in and solve 376 00:20:45,850 --> 00:20:46,920 for expectation of x. 377 00:20:46,920 --> 00:20:54,340 So expectation of x is 1/2 minus 1/2 expectation of x. 378 00:20:54,340 --> 00:21:00,860 So we have 3/2 expectation of x equals 1/2. 379 00:21:00,860 --> 00:21:05,810 So expectation of x equals 1/3. 380 00:21:05,810 --> 00:21:09,770 And of course, expectation of y is also 1/3. 381 00:21:09,770 --> 00:21:14,970 And so it turns out that the expectation is around there. 382 00:21:14,970 --> 00:21:17,760 383 00:21:17,760 --> 00:21:21,220 So this problem had several parts. 384 00:21:21,220 --> 00:21:26,120 And it allowed us to start out from just a raw joint 385 00:21:26,120 --> 00:21:28,840 distribution, calculate marginals, calculate 386 00:21:28,840 --> 00:21:31,650 conditionals, and then from there, calculate all kinds of 387 00:21:31,650 --> 00:21:34,530 conditional expectations and expectations. 388 00:21:34,530 --> 00:21:39,020 And a couple of important points to remember are, when 389 00:21:39,020 --> 00:21:42,620 you do these joint distributions, it's very 390 00:21:42,620 --> 00:21:47,230 important to consider where values are valid. 391 00:21:47,230 --> 00:21:50,340 So you have to keep in mind when you write out these 392 00:21:50,340 --> 00:21:55,620 conditional PDFs and joint PDFs and marginal PDFs, what 393 00:21:55,620 --> 00:21:59,590 ranges the formulas you calculated are valid for. 394 00:21:59,590 --> 00:22:02,880 And that also translates to when you're calculating 395 00:22:02,880 --> 00:22:03,930 expectations and such. 396 00:22:03,930 --> 00:22:06,805 When you have integrals, you need to be very careful about 397 00:22:06,805 --> 00:22:08,590 the limits of your integration, to make sure that 398 00:22:08,590 --> 00:22:12,290 they line up with the range where the values 399 00:22:12,290 --> 00:22:13,860 are actually valid. 400 00:22:13,860 --> 00:22:17,180 And the last thing, which is kind of unrelated, but it is 401 00:22:17,180 --> 00:22:20,890 actually a common tool that's used in a lot of problems is, 402 00:22:20,890 --> 00:22:25,170 when you see symmetry in these problems, that can help a lot, 403 00:22:25,170 --> 00:22:28,590 because it will simplify things and allow you to use 404 00:22:28,590 --> 00:22:31,330 facts like these to help you calculate what the 405 00:22:31,330 --> 00:22:32,190 final answer is. 406 00:22:32,190 --> 00:22:35,520 Of course, this is also comes along with practice. 407 00:22:35,520 --> 00:22:37,620 You may not immediately see that there could be a symmetry 408 00:22:37,620 --> 00:22:39,120 argument that will help with this problem. 409 00:22:39,120 --> 00:22:42,680 But with practice, when you do more of these problems, you'll 410 00:22:42,680 --> 00:22:44,440 eventually build up that kind of-- 411 00:22:44,440 --> 00:22:45,690