1 00:00:01,100 --> 00:00:03,960 We will now go through an example that brings together 2 00:00:03,960 --> 00:00:07,300 all of the concepts that we have introduced. 3 00:00:07,300 --> 00:00:10,480 We have a stick of length l. 4 00:00:13,100 --> 00:00:17,910 And we break that stick at some random location, which 5 00:00:17,910 --> 00:00:21,860 corresponds to a random variable, X. 6 00:00:21,860 --> 00:00:27,060 And we assume that this random variable is uniform over the 7 00:00:27,060 --> 00:00:28,790 length of the stick. 8 00:00:28,790 --> 00:00:31,350 So its PDF has this particular shape. 9 00:00:31,350 --> 00:00:34,770 And for the PDF to integrate to 1, the height of this PDF 10 00:00:34,770 --> 00:00:37,660 must be equal to 1 over l. 11 00:00:37,660 --> 00:00:41,660 Then we take the piece of the stick that we are left with, 12 00:00:41,660 --> 00:00:46,380 which has length X, and we break it at a random location, 13 00:00:46,380 --> 00:00:51,050 which we call Y. And we assume that this location Y is 14 00:00:51,050 --> 00:00:54,830 uniformly distributed over the length of the stick that we 15 00:00:54,830 --> 00:00:56,540 were left with. 16 00:00:56,540 --> 00:00:58,500 What does this assumption mean? 17 00:00:58,500 --> 00:01:02,350 It means that if the first break was at some particular 18 00:01:02,350 --> 00:01:08,370 value, x, then the random variable Y has a conditional 19 00:01:08,370 --> 00:01:14,350 distribution, which is uniform over the interval from 0 to x. 20 00:01:14,350 --> 00:01:16,490 So the conditional PDF is uniform. 21 00:01:16,490 --> 00:01:19,350 A conditional PDF, like any other PDF, must 22 00:01:19,350 --> 00:01:20,560 integrate to 1. 23 00:01:20,560 --> 00:01:23,430 So the height of this conditional PDF is 24 00:01:23,430 --> 00:01:25,930 equal to 1 over x. 25 00:01:25,930 --> 00:01:28,020 Are X and Y independent? 26 00:01:28,020 --> 00:01:28,920 No. 27 00:01:28,920 --> 00:01:32,780 One way to see it is that if you change little x, the 28 00:01:32,780 --> 00:01:37,110 conditional PDF of Y would have been something different. 29 00:01:37,110 --> 00:01:39,690 Whereas if we have independence, all the 30 00:01:39,690 --> 00:01:43,860 conditional PDFs have to be the same when you change the 31 00:01:43,860 --> 00:01:45,720 value of little x. 32 00:01:45,720 --> 00:01:51,810 Another way to see it is that if I tell you that x is 0.5, 33 00:01:51,810 --> 00:01:55,310 this gives you lots of information about Y. It tells 34 00:01:55,310 --> 00:01:59,570 you that Y has to be less than or equal to 0.5. 35 00:01:59,570 --> 00:02:02,540 So the value of the random variable X gives you plenty of 36 00:02:02,540 --> 00:02:05,050 information about the other random variable. 37 00:02:05,050 --> 00:02:07,950 And so we do not have independence. 38 00:02:07,950 --> 00:02:10,199 Notice that in this example, instead of starting with a 39 00:02:10,199 --> 00:02:13,300 full description of the random variables in terms of a joint 40 00:02:13,300 --> 00:02:18,430 PDF, we use a marginal PDF and then a conditional PDF to 41 00:02:18,430 --> 00:02:20,420 construct our model. 42 00:02:20,420 --> 00:02:23,390 Of course, with these two pieces of information, we can 43 00:02:23,390 --> 00:02:28,500 reconstruct the joint PDF using the multiplication rule. 44 00:02:28,500 --> 00:02:30,400 The marginal is 1 over l. 45 00:02:30,400 --> 00:02:32,220 The conditional is 1 over x. 46 00:02:32,220 --> 00:02:37,350 So the joint is equal to 1 over lx. 47 00:02:37,350 --> 00:02:40,620 But for which values of x and y is this the correct 48 00:02:40,620 --> 00:02:41,860 expression? 49 00:02:41,860 --> 00:02:45,640 It is correct only for those values that are possible. 50 00:02:45,640 --> 00:02:54,920 So 0 has to be less than y, less than x, less than l. 51 00:02:54,920 --> 00:02:58,079 This is the range of values that are possible in this 52 00:02:58,079 --> 00:02:59,680 particular experiment. 53 00:02:59,680 --> 00:03:01,670 And we can visualize those values. 54 00:03:01,670 --> 00:03:05,540 They are those that correspond to this shaded triangle here. 55 00:03:05,540 --> 00:03:08,610 x and y are less than or equal to l. 56 00:03:08,610 --> 00:03:13,050 And y has to be less than or equal to x. 57 00:03:13,050 --> 00:03:17,760 If you try to visualize the joint PDF, notice that since 58 00:03:17,760 --> 00:03:22,310 it only depends on x not on y, if you fix a value of x and 59 00:03:22,310 --> 00:03:26,600 you look at the slice of the joint PDF, the value of the 60 00:03:26,600 --> 00:03:30,550 joint PDF is going to be a constant on that slice. 61 00:03:30,550 --> 00:03:33,280 On this slice, it's going to be another constant, actually 62 00:03:33,280 --> 00:03:34,270 a bigger one. 63 00:03:34,270 --> 00:03:36,870 On that slice, an even bigger constant. 64 00:03:36,870 --> 00:03:41,030 And actually, this constant is bigger and bigger and goes to 65 00:03:41,030 --> 00:03:44,980 infinity as we approach 0. 66 00:03:44,980 --> 00:03:49,640 Of course, the fact that the slice is constant is just a 67 00:03:49,640 --> 00:03:54,320 reflection of the fact that the conditional PDF is 68 00:03:54,320 --> 00:03:57,550 constant over the range of values that the random 69 00:03:57,550 --> 00:03:59,115 variable can take. 70 00:03:59,115 --> 00:04:03,360 Let us now continue with some calculations. 71 00:04:03,360 --> 00:04:08,120 Let us find the marginal PDF of Y. How do we do it? 72 00:04:08,120 --> 00:04:12,310 Since we have in our hands the joint PDF, we can find the 73 00:04:12,310 --> 00:04:15,450 marginal by integrating the joint. 74 00:04:19,610 --> 00:04:25,280 And in our case, the joint is equal to 1 over lx. 75 00:04:25,280 --> 00:04:28,350 And we integrate over all x's. 76 00:04:28,350 --> 00:04:31,110 Now, what is the range of the integration? 77 00:04:31,110 --> 00:04:37,970 If we fix a certain value of y, the joint PDF is actually 0 78 00:04:37,970 --> 00:04:40,290 in this region and in that region. 79 00:04:40,290 --> 00:04:44,700 So we should only integrate over x's that correspond to 80 00:04:44,700 --> 00:04:46,240 this interval. 81 00:04:46,240 --> 00:04:48,330 What is that interval? 82 00:04:48,330 --> 00:04:51,430 It's the interval that ends at l. 83 00:04:51,430 --> 00:04:56,570 And because this is a line of slope 1, this value 84 00:04:56,570 --> 00:04:58,280 here is also y. 85 00:04:58,280 --> 00:05:01,240 So we integrate over an interval where x 86 00:05:01,240 --> 00:05:04,010 ranges from y to l. 87 00:05:04,010 --> 00:05:08,350 In fact, this is just the range of x's that are possible 88 00:05:08,350 --> 00:05:10,340 for a given value of y. 89 00:05:10,340 --> 00:05:14,400 x must always be larger than or equal to y. 90 00:05:14,400 --> 00:05:18,290 Now, the integral of 1 over x is a logarithm. 91 00:05:18,290 --> 00:05:21,260 And using this fact, we can evaluate this integral. 92 00:05:21,260 --> 00:05:28,870 And it's 1 over l times the logarithm of l over y. 93 00:05:28,870 --> 00:05:33,170 For what y's is this a correct expression? 94 00:05:33,170 --> 00:05:36,970 Well, it makes sense only for those y's that are possible in 95 00:05:36,970 --> 00:05:39,650 this experiment. 96 00:05:39,650 --> 00:05:44,564 And that's the range from 0 to l. 97 00:05:44,564 --> 00:05:48,180 When y is equal to l, we have the logarithm of 1, which is 98 00:05:48,180 --> 00:05:49,120 equal to 0. 99 00:05:49,120 --> 00:05:51,870 So the value of the PDF is 0 here. 100 00:05:51,870 --> 00:05:55,480 As y decreases, this ratio 101 00:05:55,480 --> 00:05:58,370 increases and goes to infinity. 102 00:05:58,370 --> 00:06:01,830 So the log of that also blows up to infinity. 103 00:06:01,830 --> 00:06:06,100 And we get a shape of this form, where the function that 104 00:06:06,100 --> 00:06:10,270 we're dealing with goes to infinity as we approach 0. 105 00:06:10,270 --> 00:06:14,530 Is this a problem having a PDF that blows up to infinity? 106 00:06:14,530 --> 00:06:15,460 Not really. 107 00:06:15,460 --> 00:06:20,480 As long as the area under this PDF is equal to 1, it's still 108 00:06:20,480 --> 00:06:22,280 a legitimate PDF. 109 00:06:22,280 --> 00:06:26,670 And blowing up to infinity is not an issue. 110 00:06:26,670 --> 00:06:30,530 Let us now calculate the expected value of Y. One way 111 00:06:30,530 --> 00:06:34,780 of doing this is by using the definition of the expectation. 112 00:06:34,780 --> 00:06:39,570 It's the integral of y times the density of y, which is 1 113 00:06:39,570 --> 00:06:45,750 over l times the log of l over y. 114 00:06:45,750 --> 00:06:49,320 And the range of integration has to be those values for 115 00:06:49,320 --> 00:06:51,740 which we have a non-zero density. 116 00:06:51,740 --> 00:06:55,170 So we integrate from 0 to l, which are the possible values 117 00:06:55,170 --> 00:06:58,320 of the random variable Y. This is an integral 118 00:06:58,320 --> 00:07:00,330 that's pretty messy. 119 00:07:00,330 --> 00:07:04,050 One can actually integrate it using integration by parts. 120 00:07:04,050 --> 00:07:06,300 But the calculation is a bit tedious. 121 00:07:06,300 --> 00:07:08,490 So let us look for an alternative 122 00:07:08,490 --> 00:07:10,100 and more clever approach. 123 00:07:10,100 --> 00:07:13,720 The idea is to divide and conquer. 124 00:07:13,720 --> 00:07:16,900 We're going to use the total expectation theorem, where 125 00:07:16,900 --> 00:07:21,810 we're going to condition on X. The total expectation theorem 126 00:07:21,810 --> 00:07:26,510 tells us that the expected value of Y is the integral 127 00:07:26,510 --> 00:07:30,250 over all possible values of the random variable X, which 128 00:07:30,250 --> 00:07:33,220 is from 0 to l. 129 00:07:33,220 --> 00:07:41,350 The density of X, which is 1 over l, times the conditional 130 00:07:41,350 --> 00:07:47,190 expectation of Y given that X is equal to some little x. 131 00:07:47,190 --> 00:07:50,940 And we integrate over all x's. 132 00:07:50,940 --> 00:07:52,480 Why is this simpler? 133 00:07:52,480 --> 00:07:57,230 When we condition on X taking a specific value, Y has a 134 00:07:57,230 --> 00:08:00,620 uniform distribution between 0 and x. 135 00:08:00,620 --> 00:08:03,430 And therefore, this conditional expectation is the 136 00:08:03,430 --> 00:08:07,130 expectation of a uniform, which is 1/2 the 137 00:08:07,130 --> 00:08:09,010 range of that uniform. 138 00:08:09,010 --> 00:08:12,240 So we obtain the integral from 0 to l. 139 00:08:12,240 --> 00:08:16,470 1 over l times x over 2, dx. 140 00:08:19,910 --> 00:08:22,760 And finally, that's an integral that we 141 00:08:22,760 --> 00:08:24,310 can evaluate easily. 142 00:08:24,310 --> 00:08:28,700 Or we can think even in a simpler way. 143 00:08:28,700 --> 00:08:33,095 This expression here is the density of x. 144 00:08:35,780 --> 00:08:37,520 This is x itself. 145 00:08:37,520 --> 00:08:41,820 So the integral of this times x gives us the expected value 146 00:08:41,820 --> 00:08:44,860 of X. And there's only a factor of 1/2 147 00:08:44,860 --> 00:08:46,160 that's left out there. 148 00:08:46,160 --> 00:08:52,920 So we obtain 1/2 the expected value of X. But now, X itself 149 00:08:52,920 --> 00:08:57,020 is uniform on an interval that has length l. 150 00:08:57,020 --> 00:09:01,030 And therefore, the expected value of x is l over 2. 151 00:09:01,030 --> 00:09:05,890 And so we get the final answer, which is 1/2 times l 152 00:09:05,890 --> 00:09:10,280 over 2, which is l over four. 153 00:09:10,280 --> 00:09:12,630 This answer makes intuitive sense. 154 00:09:12,630 --> 00:09:17,040 If we break a stick once, the expected value or what we're 155 00:09:17,040 --> 00:09:21,160 left with is half of what we started with. 156 00:09:21,160 --> 00:09:25,330 But if we break it once more, then we expect it on the 157 00:09:25,330 --> 00:09:29,750 average to be cut by a factor again of 1/2. 158 00:09:29,750 --> 00:09:33,300 And so we expect to be left with a stick that has length 159 00:09:33,300 --> 00:09:35,890 1/4 of what we started with. 160 00:09:39,580 --> 00:09:43,280 So this example is a particularly nice one, because 161 00:09:43,280 --> 00:09:46,740 we used all of the concepts that we have introduced-- 162 00:09:46,740 --> 00:09:50,510 marginal PDFs, joint PDFs, conditional PDFs, and the 163 00:09:50,510 --> 00:09:54,780 relations between them, as well as expectations, 164 00:09:54,780 --> 00:09:58,720 calculations of expectations, and conditional expectations, 165 00:09:58,720 --> 00:10:00,760 as well as the total probability theorem.