1 00:00:00,860 --> 00:00:03,540 Let's say you're some type of traffic engineer and what 2 00:00:03,540 --> 00:00:06,810 you're trying to figure out is, how many cars pass by a certain 3 00:00:06,810 --> 00:00:08,320 point on the street at any given point in time? 4 00:00:08,320 --> 00:00:10,210 And you want to figure out the probabilities that a 5 00:00:10,210 --> 00:00:14,010 hundred cars pass or 5 cars pass in a given hour. 6 00:00:14,010 --> 00:00:15,810 So a good place to start is just to define a random 7 00:00:15,810 --> 00:00:20,530 variable that essentially represents what you care about. 8 00:00:20,530 --> 00:00:27,350 So let's say the number of cars that pass in some amount of 9 00:00:27,350 --> 00:00:30,407 time, let's say, in an hour. 10 00:00:31,710 --> 00:00:34,510 And your goal is to figure out the probability distribution of 11 00:00:34,510 --> 00:00:37,050 this random variable and then once you know the probability 12 00:00:37,050 --> 00:00:39,450 distribution then you can figure out what's the 13 00:00:39,450 --> 00:00:41,790 probability that 100 cars pass in an hour or the probability 14 00:00:41,790 --> 00:00:45,890 that no cars pass in an hour and you'd be unstoppable. 15 00:00:45,890 --> 00:00:48,290 And just a little aside, just to move forward with this 16 00:00:48,290 --> 00:00:50,540 video, there's two assumptions we need to make because 17 00:00:50,540 --> 00:00:52,235 we're going to study the Poisson distribution. 18 00:00:52,235 --> 00:00:54,110 And in order to study it's there's two assumptions 19 00:00:54,110 --> 00:00:54,630 we have to make: 20 00:00:54,630 --> 00:00:58,770 That any hour at this point on the street is no different 21 00:00:58,770 --> 00:00:59,650 than any other hour. 22 00:00:59,650 --> 00:01:01,340 And we know that that's probably false. 23 00:01:01,340 --> 00:01:03,750 During rush hour in a real situation you probably 24 00:01:03,750 --> 00:01:06,640 would have more cars than at another rush hour. 25 00:01:06,640 --> 00:01:08,640 And you know, if you wanted to be more realistic maybe we do 26 00:01:08,640 --> 00:01:12,370 it in the day because in a day any period of time-- 27 00:01:12,370 --> 00:01:12,750 actually, no. 28 00:01:12,750 --> 00:01:14,120 I shouldn't do a day. 29 00:01:14,120 --> 00:01:17,750 We have to assume that every hour is completely just like 30 00:01:17,750 --> 00:01:19,650 any other hour and actually, even within the hour there's 31 00:01:19,650 --> 00:01:22,990 really no differentiation from one second to the other in 32 00:01:22,990 --> 00:01:25,820 terms of the probabilities that a car arrives. 33 00:01:25,820 --> 00:01:27,950 That's a little bit of a simplifying assumption that 34 00:01:27,950 --> 00:01:29,950 might not truly apply to traffic, but I think we 35 00:01:29,950 --> 00:01:32,270 can make that assumption. 36 00:01:32,270 --> 00:01:34,160 And then the other assumption we need to make is that if a 37 00:01:34,160 --> 00:01:36,690 bunch of cars pass in one hour that doesn't mean that fewer 38 00:01:36,690 --> 00:01:37,820 cars will pass in the next. 39 00:01:37,820 --> 00:01:40,630 That in no way does the number of cars that pass in one period 40 00:01:40,630 --> 00:01:44,860 affect or correlate or somehow influence the number of cars 41 00:01:44,860 --> 00:01:45,380 that pass in the next. 42 00:01:45,380 --> 00:01:47,370 That they're really independent. 43 00:01:47,370 --> 00:01:50,670 Given that, we can then at least try using the skills 44 00:01:50,670 --> 00:01:53,480 we have to model out some type of a distribution. 45 00:01:53,480 --> 00:01:55,770 The first thing you do and I'd recommend doing this for any 46 00:01:55,770 --> 00:01:59,090 distribution is maybe we can estimate the mean. 47 00:01:59,090 --> 00:02:03,040 Let's sit out on that curb and measure what this variable is 48 00:02:03,040 --> 00:02:05,170 over a bunch of hours and then average it up, and that's going 49 00:02:05,170 --> 00:02:08,890 to be a pretty good estimator for the actual mean 50 00:02:08,890 --> 00:02:09,880 of our population. 51 00:02:09,880 --> 00:02:12,270 Or, since it's a random variable, the expected value 52 00:02:12,270 --> 00:02:13,010 of this random variable. 53 00:02:13,010 --> 00:02:16,660 Let's say you do that and you get your best estimate of the 54 00:02:16,660 --> 00:02:22,270 expected value of this random variable is-- I'll use 55 00:02:22,270 --> 00:02:24,850 the letter lambda. 56 00:02:24,850 --> 00:02:27,380 You know, this could be 9 cars per hour. 57 00:02:27,380 --> 00:02:30,190 You sat out there-- it could be 9.3 cars per hour. 58 00:02:30,190 --> 00:02:32,670 You sat out there over hundreds of hours and you just counted 59 00:02:32,670 --> 00:02:34,590 the number of cars each hour and you averaged them all up. 60 00:02:34,590 --> 00:02:37,250 You said, on average, there are 9.3 cars per hour and you feel 61 00:02:37,250 --> 00:02:38,680 that's a pretty good estimate. 62 00:02:38,680 --> 00:02:40,080 So that's what you have there. 63 00:02:40,080 --> 00:02:42,000 And let's see what we could do. 64 00:02:42,000 --> 00:02:45,560 We know the binomial distribution. 65 00:02:45,560 --> 00:02:50,650 The binomial distribution tells us that the expected value of a 66 00:02:50,650 --> 00:02:55,220 random variable is equal to the number of trials that that 67 00:02:55,220 --> 00:02:57,460 random variable's kind of composed of, right? 68 00:02:57,460 --> 00:02:59,490 Before, in the previous videos we were counting the number 69 00:02:59,490 --> 00:03:00,500 of heads in a coin toss. 70 00:03:00,500 --> 00:03:03,070 So this would be the number of coin tosses, times the 71 00:03:03,070 --> 00:03:07,290 probability of success over each toss. 72 00:03:07,290 --> 00:03:09,000 This is what we did with the binomial distribution. 73 00:03:09,000 --> 00:03:11,670 So maybe we can model our traffic situation 74 00:03:11,670 --> 00:03:12,780 something similar. 75 00:03:12,780 --> 00:03:15,400 This is the number of cars that pass in an hour. 76 00:03:15,400 --> 00:03:22,800 So maybe we could say lambda cars per hour is equal 77 00:03:22,800 --> 00:03:24,330 to-- I don't know. 78 00:03:26,850 --> 00:03:29,880 Let's make each experiment or each toss of the coin equal to 79 00:03:29,880 --> 00:03:31,780 whether a car passes in a given minute. 80 00:03:31,780 --> 00:03:37,980 So there are 60 minutes per hour, so there 81 00:03:37,980 --> 00:03:40,870 would be 60 trials. 82 00:03:40,870 --> 00:03:43,190 And then, the probability that we have success in each of 83 00:03:43,190 --> 00:03:46,990 those trials, if we modeled this as a binomial distribution 84 00:03:46,990 --> 00:03:54,450 would be lambda over 60 cars per minute. 85 00:03:54,450 --> 00:03:55,660 And this would be a probability. 86 00:03:55,660 --> 00:03:58,640 This would be n, and this would be the probability, if we said 87 00:03:58,640 --> 00:04:00,270 that this is a binomial distribution. 88 00:04:00,270 --> 00:04:04,030 And this probably wouldn't be that bad of an approximation. 89 00:04:04,030 --> 00:04:06,130 If you actually then said, oh, this is a binomial 90 00:04:06,130 --> 00:04:10,380 distribution, so the probability that our random 91 00:04:10,380 --> 00:04:12,940 variable equals some given value, k. 92 00:04:12,940 --> 00:04:16,170 You know, the probability that 3 cars, exactly 3 cars pass in 93 00:04:16,170 --> 00:04:19,750 an given hour, we would then be equal to n. 94 00:04:19,750 --> 00:04:21,890 So n would be 60. 95 00:04:21,890 --> 00:04:26,010 Choose k, and you know, I have 3 cars times the 96 00:04:26,010 --> 00:04:27,190 probability of success. 97 00:04:27,190 --> 00:04:29,570 So the probability that a car passes in any minute. 98 00:04:29,570 --> 00:04:34,770 So it'd be lambda over 60 to the number of 99 00:04:34,770 --> 00:04:35,980 successes we need. 100 00:04:35,980 --> 00:04:41,660 So to the kth power, times the probability of no success or 101 00:04:41,660 --> 00:04:46,560 that no cars pass, to the n minus k. 102 00:04:46,560 --> 00:04:50,230 If we have k successes we have to have 60 minus k failures. 103 00:04:50,230 --> 00:04:52,950 There are 60 minus k minutes where no car passed. 104 00:04:52,950 --> 00:04:55,270 This actually wouldn't be that bad of an approximation where 105 00:04:55,270 --> 00:04:57,250 you have 60 intervals and you say this is a binomial 106 00:04:57,250 --> 00:04:58,560 distribution. 107 00:04:58,560 --> 00:05:00,310 And you'd probably get reasonable results. 108 00:05:00,310 --> 00:05:02,600 But there's a core issue here. 109 00:05:02,600 --> 00:05:06,580 In this model where we model it as a binomial distribution, 110 00:05:06,580 --> 00:05:09,980 what happens if more than one car passes in an hour? 111 00:05:09,980 --> 00:05:11,630 Or more than one car passes in a minute? 112 00:05:11,630 --> 00:05:14,270 The way we have it right now we call it a success if one 113 00:05:14,270 --> 00:05:15,320 car passes in a minute. 114 00:05:15,320 --> 00:05:18,790 And if you're kind of counting it counts as one success, even 115 00:05:18,790 --> 00:05:21,190 if 5 cars pass in that minute. 116 00:05:21,190 --> 00:05:23,390 So you say, oh, OK Sal, I know the solution there. 117 00:05:23,390 --> 00:05:26,040 I just have to get more granular. 118 00:05:26,040 --> 00:05:28,870 Instead of dividing it into minutes why don't I 119 00:05:28,870 --> 00:05:31,050 divide it into seconds? 120 00:05:31,050 --> 00:05:36,210 So the probability that I have k successes-- instead of 60 121 00:05:36,210 --> 00:05:39,820 intervals I'll do 3,600 intervals. 122 00:05:39,820 --> 00:05:43,170 So the probability of k successful seconds, so a second 123 00:05:43,170 --> 00:05:48,610 where a car is passing at that moment out of 3,600 seconds. 124 00:05:48,610 --> 00:05:52,190 So that's 3,600 choose k, times the probability that a car 125 00:05:52,190 --> 00:05:55,210 passes in any given second. 126 00:05:55,210 --> 00:05:57,930 That's the expected number of cars in an hour divided by 127 00:05:57,930 --> 00:06:00,430 number seconds in an hour. 128 00:06:00,430 --> 00:06:01,403 We're going to have k successes. 129 00:06:03,990 --> 00:06:06,270 And these are the failures, the probability of a failure 130 00:06:06,270 --> 00:06:12,050 and you're going to have 3,600 minus k failures. 131 00:06:12,050 --> 00:06:13,910 And this would be even a better approximation. 132 00:06:13,910 --> 00:06:16,770 This actually would not be so bad, but still, you have this 133 00:06:16,770 --> 00:06:19,100 situation where 2 cars can come within a half a 134 00:06:19,100 --> 00:06:19,980 second of each other. 135 00:06:19,980 --> 00:06:21,910 And you say, oh, OK Sal, I see the pattern here. 136 00:06:21,910 --> 00:06:23,650 We just have to get more and more granular. 137 00:06:23,650 --> 00:06:26,170 We have to just make this number larger and 138 00:06:26,170 --> 00:06:27,400 larger and larger. 139 00:06:27,400 --> 00:06:28,950 And your intuition is correct. 140 00:06:28,950 --> 00:06:31,340 And if you do that you'll end up getting the 141 00:06:31,340 --> 00:06:33,860 Poisson distribution. 142 00:06:33,860 --> 00:06:35,620 And this is really interesting because a lot of times people 143 00:06:35,620 --> 00:06:38,600 give you the formula for the Poisson distribution and you 144 00:06:38,600 --> 00:06:40,420 can kind of just plug in the numbers and use it. 145 00:06:40,420 --> 00:06:43,250 But it's neat to know that it really is just the binomial 146 00:06:43,250 --> 00:06:45,790 distribution and the binomial distribution really did come 147 00:06:45,790 --> 00:06:48,590 from kind of the common sense of flipping coins. 148 00:06:48,590 --> 00:06:50,500 That's where everything is coming from. 149 00:06:50,500 --> 00:06:53,710 But before we kind of prove that if we take the limit 150 00:06:53,710 --> 00:06:55,670 as-- let me change colors. 151 00:06:55,670 --> 00:06:58,470 Before we proved that as we take the limit as this number 152 00:06:58,470 --> 00:07:01,270 right here, the number of intervals approaches infinity 153 00:07:01,270 --> 00:07:04,070 that this becomes the Poisson distribution. 154 00:07:04,070 --> 00:07:07,290 I'm going to make sure we have a couple of mathematical 155 00:07:07,290 --> 00:07:09,150 tools in our belt. 156 00:07:09,150 --> 00:07:12,760 So the first is something that you're probably reasonably 157 00:07:12,760 --> 00:07:15,860 familiar with by now, but I just want to make sure that the 158 00:07:15,860 --> 00:07:25,680 limit as x approaches infinity of 1 plus a/x to the x power is 159 00:07:25,680 --> 00:07:31,020 equal to e to the ax-- no sorry. 160 00:07:31,020 --> 00:07:38,020 Is equal to e to the a and now just to prove this to you, 161 00:07:38,020 --> 00:07:39,260 let's make a little substitution here. 162 00:07:39,260 --> 00:07:43,640 Let's say that n is equal to-- let me say 1 over 163 00:07:43,640 --> 00:07:47,880 n is equal to a over x. 164 00:07:47,880 --> 00:07:52,890 And then what would be x would equal to na. 165 00:07:52,890 --> 00:07:55,290 x times 1 is equal to n times a. 166 00:07:55,290 --> 00:08:00,050 And so the limit as x approaches infinity, 167 00:08:00,050 --> 00:08:02,045 what does a approach? 168 00:08:02,045 --> 00:08:02,885 a is-- sorry. 169 00:08:02,885 --> 00:08:04,920 As x approaches infinity what does n approach? 170 00:08:04,920 --> 00:08:07,350 Well n is x divided by a. 171 00:08:07,350 --> 00:08:08,710 So n would also approach infinity. 172 00:08:08,710 --> 00:08:10,810 So this thing would be the same thing as just making our 173 00:08:10,810 --> 00:08:16,460 substitution the limit as n approaches infinity of 1 174 00:08:16,460 --> 00:08:21,390 plus-- a/x, I made the substitution as 1/n. 175 00:08:21,390 --> 00:08:26,720 And x is, by this substitution, n times a. 176 00:08:26,720 --> 00:08:30,500 And this is going to be the same thing as the limit as n 177 00:08:30,500 --> 00:08:36,090 approaches infinity of 1 plus 1/n to the n, all 178 00:08:36,090 --> 00:08:39,390 of that to the a. 179 00:08:39,390 --> 00:08:41,760 And since there's no n out here we could just take the limit 180 00:08:41,760 --> 00:08:43,450 of this and then take that to the a power. 181 00:08:43,450 --> 00:08:47,690 So that's going to be equal to the limit as n approaches 182 00:08:47,690 --> 00:08:52,600 infinity of 1 plus 1/n to the nth power, all of 183 00:08:52,600 --> 00:08:53,780 that to the a. 184 00:08:53,780 --> 00:08:58,040 And this is our definition, or one of the ways to get to e if 185 00:08:58,040 --> 00:09:00,820 you'd watch the videos on compound interest and all that. 186 00:09:00,820 --> 00:09:01,880 This is how we got to e. 187 00:09:01,880 --> 00:09:03,460 And if you tried it out on your calculator, just try larger 188 00:09:03,460 --> 00:09:07,260 and larger n's here and you'll get e. 189 00:09:07,260 --> 00:09:12,010 This inner part is equal to e, and we raised it to the a 190 00:09:12,010 --> 00:09:14,060 power, so it's equal to e to the a. 191 00:09:14,060 --> 00:09:16,240 So hopefully you pretty satisfied that this limit 192 00:09:16,240 --> 00:09:17,860 is equal to e to the a. 193 00:09:17,860 --> 00:09:19,860 And then one other tool kit I want in our belt, and I'll 194 00:09:19,860 --> 00:09:22,340 probably actually do the proof in the next video. 195 00:09:22,340 --> 00:09:32,950 The other tool kit is to recognize that x factorial over 196 00:09:32,950 --> 00:09:42,860 x minus k factorial is equal to x times x minus 1 times x 197 00:09:42,860 --> 00:09:50,030 minus 2, all the way down to times x minus k plus 1. 198 00:09:50,030 --> 00:09:51,880 And we've done this a lot of times, but this is the most 199 00:09:51,880 --> 00:09:53,060 abstract we've ever written it. 200 00:09:53,060 --> 00:09:55,580 I can give you a couple of-- and just so you know, they'll 201 00:09:55,580 --> 00:09:57,330 be exactly k terms here. 202 00:09:57,330 --> 00:10:01,700 1, 2, 3-- So first term, second term, third term, all the 203 00:10:01,700 --> 00:10:04,310 way, and this the kth term. 204 00:10:04,310 --> 00:10:07,210 And this is important to our derivation of the 205 00:10:07,210 --> 00:10:09,160 Poisson distribution. 206 00:10:09,160 --> 00:10:13,870 But just to make this in real numbers, if I had 7 factorial 207 00:10:13,870 --> 00:10:20,110 over 7 minus 2 factorial, that's equal to 7 times 6 208 00:10:20,110 --> 00:10:24,070 times 5 times 4 times 3 times 3 times 1. 209 00:10:24,070 --> 00:10:27,360 Over 2 times-- no sorry. 210 00:10:27,360 --> 00:10:28,940 7 minus 2, this is 5. 211 00:10:28,940 --> 00:10:33,500 So it's over 5 times 4 times 3 times 2 times 1. 212 00:10:33,500 --> 00:10:37,190 These cancel out and you just have 7 times 6. 213 00:10:37,190 --> 00:10:40,990 And so it's 7 and then the last term is 7 minus 214 00:10:40,990 --> 00:10:43,045 2 plus 1, which is 6. 215 00:10:47,560 --> 00:10:51,290 In this example, k was 2 and you had exactly 2 terms. 216 00:10:51,290 --> 00:10:53,230 So once we know those two things we're now ready 217 00:10:53,230 --> 00:10:55,710 to derive the Poisson distribution and I'll do 218 00:10:55,710 --> 00:10:58,415 that in the next video. 219 00:10:58,415 --> 00:10:59,980 See you soon.