1 00:00:01,680 --> 00:00:03,519 PROFESSOR: The law of total expectation 2 00:00:03,519 --> 00:00:05,560 will give us another important tool for reasoning 3 00:00:05,560 --> 00:00:07,390 about expectations. 4 00:00:07,390 --> 00:00:11,430 And it's basically a rule like the law of total probability, 5 00:00:11,430 --> 00:00:13,870 closely related to it really, for reasoning 6 00:00:13,870 --> 00:00:16,239 by cases about expectation. 7 00:00:16,239 --> 00:00:18,530 So it requires a definition of what's 8 00:00:18,530 --> 00:00:20,800 called conditional expectation. 9 00:00:20,800 --> 00:00:25,140 So the expectation of a random variable R, given event A, 10 00:00:25,140 --> 00:00:28,010 is simply what you get by thinking 11 00:00:28,010 --> 00:00:31,320 of replacing the probability that R equals v 12 00:00:31,320 --> 00:00:33,850 by the probability that R equals v given A. 13 00:00:33,850 --> 00:00:36,330 So it's the sum over all the possible values 14 00:00:36,330 --> 00:00:38,900 that R might take of the probability 15 00:00:38,900 --> 00:00:42,270 that R takes that value, given A. 16 00:00:42,270 --> 00:00:46,060 OK, with that definition, we can state the basic form 17 00:00:46,060 --> 00:00:48,550 of the law of total expectation, which 18 00:00:48,550 --> 00:00:51,050 says if you want to calculate the expectation of R, 19 00:00:51,050 --> 00:00:53,740 you can split it into cases, according to whether 20 00:00:53,740 --> 00:00:55,360 or not A occurs. 21 00:00:55,360 --> 00:00:58,050 It's simply the conditional expectation 22 00:00:58,050 --> 00:01:00,670 of R given A times the probability of A, 23 00:01:00,670 --> 00:01:04,370 plus the conditional expectation of R, given not A times 24 00:01:04,370 --> 00:01:06,260 the probability of not A. So it really 25 00:01:06,260 --> 00:01:08,250 looks [? as ?] the same format as the law 26 00:01:08,250 --> 00:01:10,390 of total probability. 27 00:01:10,390 --> 00:01:12,860 Now, of course it generalizes to many cases. 28 00:01:12,860 --> 00:01:15,430 So the general form would say that I 29 00:01:15,430 --> 00:01:18,120 can calculate the expectation of R 30 00:01:18,120 --> 00:01:21,720 by breaking it up into the case that A 1 holds 31 00:01:21,720 --> 00:01:25,590 times the probability of A 1, the case that A 2 holds 32 00:01:25,590 --> 00:01:28,410 times the probability of A 2, through A n. 33 00:01:28,410 --> 00:01:30,290 And this could very well, and typically is, 34 00:01:30,290 --> 00:01:33,120 an infinite sum, where the [? A i's ?] of course, 35 00:01:33,120 --> 00:01:34,850 are a partition of the sample space-- 36 00:01:34,850 --> 00:01:37,410 so they're all the different cases, either A 1 or A 2 37 00:01:37,410 --> 00:01:38,930 or A 3, they're disjoint. 38 00:01:38,930 --> 00:01:43,680 And altogether, they cover the entire set of possibilities. 39 00:01:43,680 --> 00:01:48,440 Well, let's use this to get a nice different and simpler 40 00:01:48,440 --> 00:01:51,410 way-- more elementary way-- of calculating the expected number 41 00:01:51,410 --> 00:01:52,720 of heads and flips. 42 00:01:52,720 --> 00:01:55,610 So let's let of n be the expected number of heads 43 00:01:55,610 --> 00:01:58,210 and flips-- just shorthand, because the notational 44 00:01:58,210 --> 00:02:00,720 will be easier to work with than writing 45 00:02:00,720 --> 00:02:04,770 capital E brackets of H n. 46 00:02:04,770 --> 00:02:07,990 So what do we know about expectation of n? 47 00:02:07,990 --> 00:02:14,490 Well, I can express it in terms of the expectation 48 00:02:14,490 --> 00:02:16,240 of the remaining flips. 49 00:02:16,240 --> 00:02:20,010 So if I have n flips to perform, they're independent. 50 00:02:20,010 --> 00:02:22,650 Then if I perform the first flip, something happens. 51 00:02:22,650 --> 00:02:24,510 And after that I'm going to do n more 52 00:02:24,510 --> 00:02:26,810 flips, and the expected number of flips 53 00:02:26,810 --> 00:02:29,530 is going to be the expected number on the remaining n 54 00:02:29,530 --> 00:02:32,140 minus 1 plus what happened now. 55 00:02:32,140 --> 00:02:37,290 Well, if I flipped a head first, then I've got a 1 56 00:02:37,290 --> 00:02:40,130 as adding to my total number of heads. 57 00:02:40,130 --> 00:02:42,150 And then I'm going to do n more flips, 58 00:02:42,150 --> 00:02:43,770 so the expected number of flips is 59 00:02:43,770 --> 00:02:45,500 going to be that 1 plus the expected 60 00:02:45,500 --> 00:02:47,250 number on the rest of them. 61 00:02:47,250 --> 00:02:51,270 If the first flip was not a head, it was a tail, 62 00:02:51,270 --> 00:02:53,550 then the total expected number of heads 63 00:02:53,550 --> 00:02:56,980 is simply the expected number of heads on the rest of the flips. 64 00:02:56,980 --> 00:03:00,480 And these are two cases where I can apply total expectation. 65 00:03:00,480 --> 00:03:04,350 So by total expectation, the expected number in n flips 66 00:03:04,350 --> 00:03:10,380 is 1 plus e n minus 1 times the probability of a head, 67 00:03:10,380 --> 00:03:15,256 plus e n minus 1 times the probability of a tail. 68 00:03:15,256 --> 00:03:18,010 Well, now we could do a little algebra multiply through here 69 00:03:18,010 --> 00:03:21,600 by p-- that becomes a p, and this becomes a p times 70 00:03:21,600 --> 00:03:23,770 e n and minus 1. 71 00:03:23,770 --> 00:03:27,440 So I've got e n minus 1 times p, and e n minus 1 times 72 00:03:27,440 --> 00:03:32,540 q-- remembering that p plus q is 1, this simplifies to being 73 00:03:32,540 --> 00:03:35,740 simply e n minus 1 plus p. 74 00:03:35,740 --> 00:03:39,220 Well, this is a very simple kind of recursive definition of e n, 75 00:03:39,220 --> 00:03:41,210 because you can see what's going to happen. 76 00:03:41,210 --> 00:03:44,110 Subtracting 1 from n adds a p. 77 00:03:44,110 --> 00:03:47,520 So if I subtract 2 from n, I add another p-- I get 2 p. 78 00:03:47,520 --> 00:03:49,610 And continuing all the way to the end, 79 00:03:49,610 --> 00:03:53,580 by the time I get to 0, I've gotten n times p. 80 00:03:53,580 --> 00:03:57,710 And I've just figured out what I was familiar with already-- 81 00:03:57,710 --> 00:04:00,200 which we previously derived by differentiating 82 00:04:00,200 --> 00:04:03,270 the binomial theorem-- the expected number of heads 83 00:04:03,270 --> 00:04:06,140 in n flips is n times p. 84 00:04:06,140 --> 00:04:09,700 But this time I got it in a somewhat more elementary way, 85 00:04:09,700 --> 00:04:12,620 by appealing to total expectation.