1 00:00:00,000 --> 00:00:00,376 2 00:00:00,376 --> 00:00:01,130 Hi. 3 00:00:01,130 --> 00:00:04,830 In this problem, we'll get a chance to see the usefulness 4 00:00:04,830 --> 00:00:07,880 of conditioning in helping us to calculate quantities that 5 00:00:07,880 --> 00:00:10,440 would otherwise be difficult to calculate. 6 00:00:10,440 --> 00:00:13,330 Specifically, we'll be using the law of iterated 7 00:00:13,330 --> 00:00:16,120 expectations and the law of total variance. 8 00:00:16,120 --> 00:00:18,800 Before we get started, let's just take a quick moment to 9 00:00:18,800 --> 00:00:21,120 interpret what these two laws are saying. 10 00:00:21,120 --> 00:00:23,980 Really, what it's saying is, in order to calculate the 11 00:00:23,980 --> 00:00:26,980 expectation or the variance of some random variable x, if 12 00:00:26,980 --> 00:00:29,810 that's difficult to do, we'll instead attack 13 00:00:29,810 --> 00:00:31,490 this problem in stages. 14 00:00:31,490 --> 00:00:34,500 So the first stage is, we'll condition on some related 15 00:00:34,500 --> 00:00:35,980 random variable, y. 16 00:00:35,980 --> 00:00:38,810 And the hope is that by conditioning on this and 17 00:00:38,810 --> 00:00:42,200 reducing it to this conditional universe, the 18 00:00:42,200 --> 00:00:45,900 expectation of x will be easier to calculate. 19 00:00:45,900 --> 00:00:49,060 Now, recall that this conditional expectation is 20 00:00:49,060 --> 00:00:52,535 really a random variable, which is a function of the 21 00:00:52,535 --> 00:00:53,910 random variable y. 22 00:00:53,910 --> 00:01:02,880 So what we've done is we first average out x given some y. 23 00:01:02,880 --> 00:01:05,540 What remains is some new random variable, which is a 24 00:01:05,540 --> 00:01:07,190 function of y. 25 00:01:07,190 --> 00:01:10,250 And now, what we have is randomness in y, which will 26 00:01:10,250 --> 00:01:15,895 then average out again to get the final expectation of x. 27 00:01:15,895 --> 00:01:19,110 OK, so in this problem, we'll actually see an example of how 28 00:01:19,110 --> 00:01:21,130 this plays out. 29 00:01:21,130 --> 00:01:23,100 One more thing before we get started that's useful to 30 00:01:23,100 --> 00:01:26,310 recall is if y is a uniform random variable, distributed 31 00:01:26,310 --> 00:01:30,310 between a and b, then the variance of y is b minus a 32 00:01:30,310 --> 00:01:33,450 squared over 12, and the expectation of y is just a 33 00:01:33,450 --> 00:01:35,852 midpoint, a plus b over 2. 34 00:01:35,852 --> 00:01:38,310 All right, so let's get started on the problem. 35 00:01:38,310 --> 00:01:42,510 So what we have is we have a stick of some fixed length, l, 36 00:01:42,510 --> 00:01:45,600 and what we do is we break it uniformly at random. 37 00:01:45,600 --> 00:01:49,350 So what we do is we choose a point uniformly at random 38 00:01:49,350 --> 00:01:50,630 along this stick. 39 00:01:50,630 --> 00:01:53,960 And we break it there, and then we keep the left portion 40 00:01:53,960 --> 00:01:56,220 of that stick. 41 00:01:56,220 --> 00:02:00,410 So let's call the length of this left portion after the 42 00:02:00,410 --> 00:02:02,490 first break random variable y. 43 00:02:02,490 --> 00:02:04,440 So it's random because the point where 44 00:02:04,440 --> 00:02:06,940 we break it is random. 45 00:02:06,940 --> 00:02:09,120 And then what we do is we repeat this process. 46 00:02:09,120 --> 00:02:13,100 We'll take this left side of the stick that's left. 47 00:02:13,100 --> 00:02:16,920 And we'll pick another point, uniformly at random, along 48 00:02:16,920 --> 00:02:20,140 this left remaining side. 49 00:02:20,140 --> 00:02:22,610 And we'll break it again, and keep the left 50 00:02:22,610 --> 00:02:24,760 side of that break. 51 00:02:24,760 --> 00:02:29,030 And we'll call that the length of the final remaining piece, 52 00:02:29,030 --> 00:02:31,870 x, which again is random. 53 00:02:31,870 --> 00:02:34,580 The problem is really asking us to calculate the 54 00:02:34,580 --> 00:02:37,710 expectation of variance of x. 55 00:02:37,710 --> 00:02:42,980 So at first, it seems difficult to do, because the 56 00:02:42,980 --> 00:02:47,240 expectation and variance of x depends on where you break it 57 00:02:47,240 --> 00:02:51,250 the second time and also where you break it the first time. 58 00:02:51,250 --> 00:02:55,730 So let's see if conditioning can help us here. 59 00:02:55,730 --> 00:02:58,340 So the first thing that we'll notice is that, if we just 60 00:02:58,340 --> 00:03:01,670 consider y, the length of the stick after the first break, 61 00:03:01,670 --> 00:03:04,160 it's actually pretty easy to calculate the expectation and 62 00:03:04,160 --> 00:03:05,730 variance of y. 63 00:03:05,730 --> 00:03:13,360 Because y, when you think about it, is actually just the 64 00:03:13,360 --> 00:03:16,270 simple uniform in a variable, uniformly distributed between 65 00:03:16,270 --> 00:03:22,490 0 and l, the length of the stick. 66 00:03:22,490 --> 00:03:25,820 And this is because we're told that we choose the point of 67 00:03:25,820 --> 00:03:29,560 the break uniformly at random between 0 and l. 68 00:03:29,560 --> 00:03:32,030 And so wherever we choose it, that's going to be the length 69 00:03:32,030 --> 00:03:34,100 of the left side of the stick. 70 00:03:34,100 --> 00:03:38,480 And so because of this, we know that the expectation of y 71 00:03:38,480 --> 00:03:50,000 is just l/2, and the variance of y is l squared over 12. 72 00:03:50,000 --> 00:03:53,000 But unfortunately, calculating the expectation variance of x 73 00:03:53,000 --> 00:03:58,230 is not quite as simple, because x isn't just uniformly 74 00:03:58,230 --> 00:04:01,430 distributed between 0 and some fixed number. 75 00:04:01,430 --> 00:04:03,930 Because it's actually uniformly distributed between 76 00:04:03,930 --> 00:04:07,830 0 and y, wherever the first break was. 77 00:04:07,830 --> 00:04:11,140 But where the first break is is random too. 78 00:04:11,140 --> 00:04:14,170 And so we can't just say that x is a uniformly distributed 79 00:04:14,170 --> 00:04:16,320 random variable. 80 00:04:16,320 --> 00:04:18,085 So what do we do instead? 81 00:04:18,085 --> 00:04:22,730 Well, we'll make the nice observation that let's pretend 82 00:04:22,730 --> 00:04:24,940 that we actually know what y is. 83 00:04:24,940 --> 00:04:28,680 If we knew what y was, then calculating the expectation of 84 00:04:28,680 --> 00:04:32,010 x would be simple, right? 85 00:04:32,010 --> 00:04:40,150 So if we were given that y is just some little y, then x 86 00:04:40,150 --> 00:04:44,370 would in fact just be uniformly distributed between 87 00:04:44,370 --> 00:04:47,180 0 and little y. 88 00:04:47,180 --> 00:04:50,010 And then if that's the case, then our calculation is 89 00:04:50,010 --> 00:04:52,960 simple, because the expectation of x would just be 90 00:04:52,960 --> 00:04:57,090 y/2, and the variance would just be y squared over 12. 91 00:04:57,090 --> 00:05:02,120 All right, so let's make that a little bit more formal. 92 00:05:02,120 --> 00:05:06,060 What we're saying is that the expectation of x, If we knew 93 00:05:06,060 --> 00:05:09,610 what y was, would just be y/2. 94 00:05:09,610 --> 00:05:12,300 95 00:05:12,300 --> 00:05:20,840 And the variance of x If we knew what y was would just be 96 00:05:20,840 --> 00:05:24,080 y squared over 12. 97 00:05:24,080 --> 00:05:26,390 All right, so notice what we've done. 98 00:05:26,390 --> 00:05:31,140 We've taken the second stage and we've said, let's pretend 99 00:05:31,140 --> 00:05:33,760 we know what happens in the first stage where we break it. 100 00:05:33,760 --> 00:05:35,950 And we know what y, the first break, was. 101 00:05:35,950 --> 00:05:40,190 Then the second stage becomes simple, because the average of 102 00:05:40,190 --> 00:05:43,390 x is just going to be the midpoint. 103 00:05:43,390 --> 00:05:48,230 Now what we do to calculate the actual expectation of x, 104 00:05:48,230 --> 00:05:51,360 well, we'll invoke the law of iterated expectations. 105 00:05:51,360 --> 00:06:00,160 So expectation of x is expectation of the conditional 106 00:06:00,160 --> 00:06:04,710 expectation of x given 1, which in this case is just 107 00:06:04,710 --> 00:06:08,710 expectation of y/2. 108 00:06:08,710 --> 00:06:11,190 And we know what the expectation of y is. 109 00:06:11,190 --> 00:06:13,560 It's l/2. 110 00:06:13,560 --> 00:06:16,050 And so this is just l/4. 111 00:06:16,050 --> 00:06:19,350 112 00:06:19,350 --> 00:06:20,600 l/4. 113 00:06:20,600 --> 00:06:23,066 114 00:06:23,066 --> 00:06:28,740 All right, and so notice what we've done. 115 00:06:28,740 --> 00:06:32,820 We've taken this calculation and done it in stages. 116 00:06:32,820 --> 00:06:36,460 So we assume we know where the first break is. 117 00:06:36,460 --> 00:06:40,740 Given that, the average location of the second break 118 00:06:40,740 --> 00:06:41,130 becomes simple. 119 00:06:41,130 --> 00:06:42,880 It's just in the midpoint. 120 00:06:42,880 --> 00:06:45,470 And then, we move up to the higher stage. 121 00:06:45,470 --> 00:06:48,490 And that now we average out over where the first break 122 00:06:48,490 --> 00:06:49,410 could have been. 123 00:06:49,410 --> 00:06:50,900 And that gives us our final answer. 124 00:06:50,900 --> 00:06:55,590 And notice that this actually makes sense, if we just think 125 00:06:55,590 --> 00:06:58,820 about it intuitively, because on average, the first break 126 00:06:58,820 --> 00:07:00,670 will be somewhere in the middle. 127 00:07:00,670 --> 00:07:03,600 And then that will leave us with half the stick left, and 128 00:07:03,600 --> 00:07:04,260 we break it again. 129 00:07:04,260 --> 00:07:05,720 On average, that will leave us with another half. 130 00:07:05,720 --> 00:07:09,360 So on average, you get a quarter of the original stick 131 00:07:09,360 --> 00:07:12,270 left, which makes sense. 132 00:07:12,270 --> 00:07:15,220 All right, so that's the first part, where we use the law of 133 00:07:15,220 --> 00:07:17,150 iterated expectations. 134 00:07:17,150 --> 00:07:20,820 Now, let's go to part B, where we're actually asked to find 135 00:07:20,820 --> 00:07:22,070 the variance. 136 00:07:22,070 --> 00:07:26,160 137 00:07:26,160 --> 00:07:30,410 The variance is given by the law of total variance. 138 00:07:30,410 --> 00:07:34,400 So let's do it in stages. 139 00:07:34,400 --> 00:07:38,490 We'll first calculate the first term, the expectation of 140 00:07:38,490 --> 00:07:39,740 the conditional variance. 141 00:07:39,740 --> 00:07:42,380 142 00:07:42,380 --> 00:07:45,450 Well, what is the expectation of the conditional variance? 143 00:07:45,450 --> 00:07:46,930 We've already calculated out what this 144 00:07:46,930 --> 00:07:47,820 conditional variance is. 145 00:07:47,820 --> 00:07:50,510 The conditional variance is y squared over 12. 146 00:07:50,510 --> 00:07:52,380 So let's just plug that in. 147 00:07:52,380 --> 00:07:55,520 It's expectation of y squared over 12. 148 00:07:55,520 --> 00:07:59,090 149 00:07:59,090 --> 00:08:02,040 All right, now this looks like it could be a little difficult 150 00:08:02,040 --> 00:08:02,770 to calculate. 151 00:08:02,770 --> 00:08:09,610 But let's just first pull out the 1/12. 152 00:08:09,610 --> 00:08:13,560 And then remember, one way to calculate the expectation of 153 00:08:13,560 --> 00:08:14,620 the square of a random variable 154 00:08:14,620 --> 00:08:17,610 is to use the variance. 155 00:08:17,610 --> 00:08:23,800 So recall that the variance of any random variable is just 156 00:08:23,800 --> 00:08:30,800 expectation of the square minus the square of the 157 00:08:30,800 --> 00:08:33,190 expectation. 158 00:08:33,190 --> 00:08:36,990 So if we want to calculate the expectation of the square, we 159 00:08:36,990 --> 00:08:38,960 can just take the variance and add the square of the 160 00:08:38,960 --> 00:08:40,100 expectation. 161 00:08:40,100 --> 00:08:43,340 So this actually we can get pretty easily. 162 00:08:43,340 --> 00:08:50,265 It's actually just the variance of y plus the square 163 00:08:50,265 --> 00:08:51,640 of the expectation of y. 164 00:08:51,640 --> 00:08:55,870 165 00:08:55,870 --> 00:08:57,650 And we know what these two terms are. 166 00:08:57,650 --> 00:09:02,600 The variance of y is l squared over 12. 167 00:09:02,600 --> 00:09:05,490 And the expectation of y is l/2. 168 00:09:05,490 --> 00:09:07,540 So when you square that, you get l squared over 4. 169 00:09:07,540 --> 00:09:10,890 170 00:09:10,890 --> 00:09:13,610 So l squared over 12 plus l squared over 4 gives you l 171 00:09:13,610 --> 00:09:15,060 squared over 3. 172 00:09:15,060 --> 00:09:19,860 And you get that the first term is l squared over 36. 173 00:09:19,860 --> 00:09:22,390 174 00:09:22,390 --> 00:09:24,820 All right, now let's calculate the second term. 175 00:09:24,820 --> 00:09:28,450 Second term is the variance of the conditional expectation. 176 00:09:28,450 --> 00:09:33,830 So the variance of expectation of x given y. 177 00:09:33,830 --> 00:09:36,740 178 00:09:36,740 --> 00:09:39,060 Well, what is the expectation of x given y? 179 00:09:39,060 --> 00:09:40,230 We've already calculated that. 180 00:09:40,230 --> 00:09:42,260 That's y/2. 181 00:09:42,260 --> 00:09:46,340 So what we really want is the variance of y/2. 182 00:09:46,340 --> 00:09:48,810 And remember, when you have a constant inside the variance, 183 00:09:48,810 --> 00:09:50,730 you pull it out but you square it. 184 00:09:50,730 --> 00:09:58,660 So what you get is 1/4 the variance of y, which we know 185 00:09:58,660 --> 00:10:01,270 that the variance of y is l squared over 12. 186 00:10:01,270 --> 00:10:04,020 So we get that this is l squared over 48. 187 00:10:04,020 --> 00:10:06,740 188 00:10:06,740 --> 00:10:09,200 OK, so we've calculated both terms of 189 00:10:09,200 --> 00:10:10,340 this conditional variance. 190 00:10:10,340 --> 00:10:13,360 So all we need to do to find the final answer 191 00:10:13,360 --> 00:10:15,140 is just to add them. 192 00:10:15,140 --> 00:10:21,880 So it's l squared over 36 plus l squared over 48. 193 00:10:21,880 --> 00:10:31,530 And so, the final answer is 7 l squared over 144. 194 00:10:31,530 --> 00:10:36,710 OK, and so this is the first, the expectation of x, maybe 195 00:10:36,710 --> 00:10:38,150 you could have guessed intuitively. 196 00:10:38,150 --> 00:10:42,270 But the variance of x is not something that looks like 197 00:10:42,270 --> 00:10:44,250 something that you could have calculated off 198 00:10:44,250 --> 00:10:45,620 the top of your head. 199 00:10:45,620 --> 00:10:51,050 And so I guess the lesson from this example is that it is 200 00:10:51,050 --> 00:10:53,110 often very helpful if you condition on some things, 201 00:10:53,110 --> 00:10:55,930 because it allows you to calculate things in stages and 202 00:10:55,930 --> 00:10:58,800 build up from the bottom. 203 00:10:58,800 --> 00:11:01,900 But it's important to note that the choice of what you 204 00:11:01,900 --> 00:11:03,970 condition on-- so the choice of y-- is actually very 205 00:11:03,970 --> 00:11:06,440 important, because you could choose lots of other y's that 206 00:11:06,440 --> 00:11:07,940 wouldn't actually help you at all. 207 00:11:07,940 --> 00:11:11,270 And so how to actually choose this y is something that you 208 00:11:11,270 --> 00:11:14,200 can learn based on just having practiced with 209 00:11:14,200 --> 00:11:16,620 these kinds of problems. 210 00:11:16,620 --> 00:11:20,050 So again, the overall lesson is, conditioning can often 211 00:11:20,050 --> 00:11:22,510 help when you calculate these problems. 212 00:11:22,510 --> 00:11:24,370 And so you should look to see if that could 213 00:11:24,370 --> 00:11:26,970 be a possible solution. 214 00:11:26,970 --> 00:11:28,630 So I hope that was helpful, and see you next time. 215 00:11:28,630 --> 00:11:30,334