WEBVTT 00:00:00.860 --> 00:00:03.540 Let's say you're some type of traffic engineer and what 00:00:03.540 --> 00:00:06.810 you're trying to figure out is, how many cars pass by a certain 00:00:06.810 --> 00:00:08.320 point on the street at any given point in time? 00:00:08.320 --> 00:00:10.210 And you want to figure out the probabilities that a 00:00:10.210 --> 00:00:14.010 hundred cars pass or 5 cars pass in a given hour. 00:00:14.010 --> 00:00:15.810 So a good place to start is just to define a random 00:00:15.810 --> 00:00:20.530 variable that essentially represents what you care about. 00:00:20.530 --> 00:00:27.350 So let's say the number of cars that pass in some amount of 00:00:27.350 --> 00:00:30.407 time, let's say, in an hour. 00:00:31.710 --> 00:00:34.510 And your goal is to figure out the probability distribution of 00:00:34.510 --> 00:00:37.050 this random variable and then once you know the probability 00:00:37.050 --> 00:00:39.450 distribution then you can figure out what's the 00:00:39.450 --> 00:00:41.790 probability that 100 cars pass in an hour or the probability 00:00:41.790 --> 00:00:45.890 that no cars pass in an hour and you'd be unstoppable. 00:00:45.890 --> 00:00:48.290 And just a little aside, just to move forward with this 00:00:48.290 --> 00:00:50.540 video, there's two assumptions we need to make because 00:00:50.540 --> 00:00:52.235 we're going to study the Poisson distribution. 00:00:52.235 --> 00:00:54.110 And in order to study it's there's two assumptions 00:00:54.110 --> 00:00:54.630 we have to make: 00:00:54.630 --> 00:00:58.770 That any hour at this point on the street is no different 00:00:58.770 --> 00:00:59.650 than any other hour. 00:00:59.650 --> 00:01:01.340 And we know that that's probably false. 00:01:01.340 --> 00:01:03.750 During rush hour in a real situation you probably 00:01:03.750 --> 00:01:06.640 would have more cars than at another rush hour. 00:01:06.640 --> 00:01:08.640 And you know, if you wanted to be more realistic maybe we do 00:01:08.640 --> 00:01:12.370 it in the day because in a day any period of time-- 00:01:12.370 --> 00:01:12.750 actually, no. 00:01:12.750 --> 00:01:14.120 I shouldn't do a day. 00:01:14.120 --> 00:01:17.750 We have to assume that every hour is completely just like 00:01:17.750 --> 00:01:19.650 any other hour and actually, even within the hour there's 00:01:19.650 --> 00:01:22.990 really no differentiation from one second to the other in 00:01:22.990 --> 00:01:25.820 terms of the probabilities that a car arrives. 00:01:25.820 --> 00:01:27.950 That's a little bit of a simplifying assumption that 00:01:27.950 --> 00:01:29.950 might not truly apply to traffic, but I think we 00:01:29.950 --> 00:01:32.270 can make that assumption. 00:01:32.270 --> 00:01:34.160 And then the other assumption we need to make is that if a 00:01:34.160 --> 00:01:36.690 bunch of cars pass in one hour that doesn't mean that fewer 00:01:36.690 --> 00:01:37.820 cars will pass in the next. 00:01:37.820 --> 00:01:40.630 That in no way does the number of cars that pass in one period 00:01:40.630 --> 00:01:44.860 affect or correlate or somehow influence the number of cars 00:01:44.860 --> 00:01:45.380 that pass in the next. 00:01:45.380 --> 00:01:47.370 That they're really independent. 00:01:47.370 --> 00:01:50.670 Given that, we can then at least try using the skills 00:01:50.670 --> 00:01:53.480 we have to model out some type of a distribution. 00:01:53.480 --> 00:01:55.770 The first thing you do and I'd recommend doing this for any 00:01:55.770 --> 00:01:59.090 distribution is maybe we can estimate the mean. 00:01:59.090 --> 00:02:03.040 Let's sit out on that curb and measure what this variable is 00:02:03.040 --> 00:02:05.170 over a bunch of hours and then average it up, and that's going 00:02:05.170 --> 00:02:08.890 to be a pretty good estimator for the actual mean 00:02:08.890 --> 00:02:09.880 of our population. 00:02:09.880 --> 00:02:12.270 Or, since it's a random variable, the expected value 00:02:12.270 --> 00:02:13.010 of this random variable. 00:02:13.010 --> 00:02:16.660 Let's say you do that and you get your best estimate of the 00:02:16.660 --> 00:02:22.270 expected value of this random variable is-- I'll use 00:02:22.270 --> 00:02:24.850 the letter lambda. 00:02:24.850 --> 00:02:27.380 You know, this could be 9 cars per hour. 00:02:27.380 --> 00:02:30.190 You sat out there-- it could be 9.3 cars per hour. 00:02:30.190 --> 00:02:32.670 You sat out there over hundreds of hours and you just counted 00:02:32.670 --> 00:02:34.590 the number of cars each hour and you averaged them all up. 00:02:34.590 --> 00:02:37.250 You said, on average, there are 9.3 cars per hour and you feel 00:02:37.250 --> 00:02:38.680 that's a pretty good estimate. 00:02:38.680 --> 00:02:40.080 So that's what you have there. 00:02:40.080 --> 00:02:42.000 And let's see what we could do. 00:02:42.000 --> 00:02:45.560 We know the binomial distribution. 00:02:45.560 --> 00:02:50.650 The binomial distribution tells us that the expected value of a 00:02:50.650 --> 00:02:55.220 random variable is equal to the number of trials that that 00:02:55.220 --> 00:02:57.460 random variable's kind of composed of, right? 00:02:57.460 --> 00:02:59.490 Before, in the previous videos we were counting the number 00:02:59.490 --> 00:03:00.500 of heads in a coin toss. 00:03:00.500 --> 00:03:03.070 So this would be the number of coin tosses, times the 00:03:03.070 --> 00:03:07.290 probability of success over each toss. 00:03:07.290 --> 00:03:09.000 This is what we did with the binomial distribution. 00:03:09.000 --> 00:03:11.670 So maybe we can model our traffic situation 00:03:11.670 --> 00:03:12.780 something similar. 00:03:12.780 --> 00:03:15.400 This is the number of cars that pass in an hour. 00:03:15.400 --> 00:03:22.800 So maybe we could say lambda cars per hour is equal 00:03:22.800 --> 00:03:24.330 to-- I don't know. 00:03:26.850 --> 00:03:29.880 Let's make each experiment or each toss of the coin equal to 00:03:29.880 --> 00:03:31.780 whether a car passes in a given minute. 00:03:31.780 --> 00:03:37.980 So there are 60 minutes per hour, so there 00:03:37.980 --> 00:03:40.870 would be 60 trials. 00:03:40.870 --> 00:03:43.190 And then, the probability that we have success in each of 00:03:43.190 --> 00:03:46.990 those trials, if we modeled this as a binomial distribution 00:03:46.990 --> 00:03:54.450 would be lambda over 60 cars per minute. 00:03:54.450 --> 00:03:55.660 And this would be a probability. 00:03:55.660 --> 00:03:58.640 This would be n, and this would be the probability, if we said 00:03:58.640 --> 00:04:00.270 that this is a binomial distribution. 00:04:00.270 --> 00:04:04.030 And this probably wouldn't be that bad of an approximation. 00:04:04.030 --> 00:04:06.130 If you actually then said, oh, this is a binomial 00:04:06.130 --> 00:04:10.380 distribution, so the probability that our random 00:04:10.380 --> 00:04:12.940 variable equals some given value, k. 00:04:12.940 --> 00:04:16.170 You know, the probability that 3 cars, exactly 3 cars pass in 00:04:16.170 --> 00:04:19.750 an given hour, we would then be equal to n. 00:04:19.750 --> 00:04:21.890 So n would be 60. 00:04:21.890 --> 00:04:26.010 Choose k, and you know, I have 3 cars times the 00:04:26.010 --> 00:04:27.190 probability of success. 00:04:27.190 --> 00:04:29.570 So the probability that a car passes in any minute. 00:04:29.570 --> 00:04:34.770 So it'd be lambda over 60 to the number of 00:04:34.770 --> 00:04:35.980 successes we need. 00:04:35.980 --> 00:04:41.660 So to the kth power, times the probability of no success or 00:04:41.660 --> 00:04:46.560 that no cars pass, to the n minus k. 00:04:46.560 --> 00:04:50.230 If we have k successes we have to have 60 minus k failures. 00:04:50.230 --> 00:04:52.950 There are 60 minus k minutes where no car passed. 00:04:52.950 --> 00:04:55.270 This actually wouldn't be that bad of an approximation where 00:04:55.270 --> 00:04:57.250 you have 60 intervals and you say this is a binomial 00:04:57.250 --> 00:04:58.560 distribution. 00:04:58.560 --> 00:05:00.310 And you'd probably get reasonable results. 00:05:00.310 --> 00:05:02.600 But there's a core issue here. 00:05:02.600 --> 00:05:06.580 In this model where we model it as a binomial distribution, 00:05:06.580 --> 00:05:09.980 what happens if more than one car passes in an hour? 00:05:09.980 --> 00:05:11.630 Or more than one car passes in a minute? 00:05:11.630 --> 00:05:14.270 The way we have it right now we call it a success if one 00:05:14.270 --> 00:05:15.320 car passes in a minute. 00:05:15.320 --> 00:05:18.790 And if you're kind of counting it counts as one success, even 00:05:18.790 --> 00:05:21.190 if 5 cars pass in that minute. 00:05:21.190 --> 00:05:23.390 So you say, oh, OK Sal, I know the solution there. 00:05:23.390 --> 00:05:26.040 I just have to get more granular. 00:05:26.040 --> 00:05:28.870 Instead of dividing it into minutes why don't I 00:05:28.870 --> 00:05:31.050 divide it into seconds? 00:05:31.050 --> 00:05:36.210 So the probability that I have k successes-- instead of 60 00:05:36.210 --> 00:05:39.820 intervals I'll do 3,600 intervals. 00:05:39.820 --> 00:05:43.170 So the probability of k successful seconds, so a second 00:05:43.170 --> 00:05:48.610 where a car is passing at that moment out of 3,600 seconds. 00:05:48.610 --> 00:05:52.190 So that's 3,600 choose k, times the probability that a car 00:05:52.190 --> 00:05:55.210 passes in any given second. 00:05:55.210 --> 00:05:57.930 That's the expected number of cars in an hour divided by 00:05:57.930 --> 00:06:00.430 number seconds in an hour. 00:06:00.430 --> 00:06:01.403 We're going to have k successes. 00:06:03.990 --> 00:06:06.270 And these are the failures, the probability of a failure 00:06:06.270 --> 00:06:12.050 and you're going to have 3,600 minus k failures. 00:06:12.050 --> 00:06:13.910 And this would be even a better approximation. 00:06:13.910 --> 00:06:16.770 This actually would not be so bad, but still, you have this 00:06:16.770 --> 00:06:19.100 situation where 2 cars can come within a half a 00:06:19.100 --> 00:06:19.980 second of each other. 00:06:19.980 --> 00:06:21.910 And you say, oh, OK Sal, I see the pattern here. 00:06:21.910 --> 00:06:23.650 We just have to get more and more granular. 00:06:23.650 --> 00:06:26.170 We have to just make this number larger and 00:06:26.170 --> 00:06:27.400 larger and larger. 00:06:27.400 --> 00:06:28.950 And your intuition is correct. 00:06:28.950 --> 00:06:31.340 And if you do that you'll end up getting the 00:06:31.340 --> 00:06:33.860 Poisson distribution. 00:06:33.860 --> 00:06:35.620 And this is really interesting because a lot of times people 00:06:35.620 --> 00:06:38.600 give you the formula for the Poisson distribution and you 00:06:38.600 --> 00:06:40.420 can kind of just plug in the numbers and use it. 00:06:40.420 --> 00:06:43.250 But it's neat to know that it really is just the binomial 00:06:43.250 --> 00:06:45.790 distribution and the binomial distribution really did come 00:06:45.790 --> 00:06:48.590 from kind of the common sense of flipping coins. 00:06:48.590 --> 00:06:50.500 That's where everything is coming from. 00:06:50.500 --> 00:06:53.710 But before we kind of prove that if we take the limit 00:06:53.710 --> 00:06:55.670 as-- let me change colors. 00:06:55.670 --> 00:06:58.470 Before we proved that as we take the limit as this number 00:06:58.470 --> 00:07:01.270 right here, the number of intervals approaches infinity 00:07:01.270 --> 00:07:04.070 that this becomes the Poisson distribution. 00:07:04.070 --> 00:07:07.290 I'm going to make sure we have a couple of mathematical 00:07:07.290 --> 00:07:09.150 tools in our belt. 00:07:09.150 --> 00:07:12.760 So the first is something that you're probably reasonably 00:07:12.760 --> 00:07:15.860 familiar with by now, but I just want to make sure that the 00:07:15.860 --> 00:07:25.680 limit as x approaches infinity of 1 plus a/x to the x power is 00:07:25.680 --> 00:07:31.020 equal to e to the ax-- no sorry. 00:07:31.020 --> 00:07:38.020 Is equal to e to the a and now just to prove this to you, 00:07:38.020 --> 00:07:39.260 let's make a little substitution here. 00:07:39.260 --> 00:07:43.640 Let's say that n is equal to-- let me say 1 over 00:07:43.640 --> 00:07:47.880 n is equal to a over x. 00:07:47.880 --> 00:07:52.890 And then what would be x would equal to na. 00:07:52.890 --> 00:07:55.290 x times 1 is equal to n times a. 00:07:55.290 --> 00:08:00.050 And so the limit as x approaches infinity, 00:08:00.050 --> 00:08:02.045 what does a approach? 00:08:02.045 --> 00:08:02.885 a is-- sorry. 00:08:02.885 --> 00:08:04.920 As x approaches infinity what does n approach? 00:08:04.920 --> 00:08:07.350 Well n is x divided by a. 00:08:07.350 --> 00:08:08.710 So n would also approach infinity. 00:08:08.710 --> 00:08:10.810 So this thing would be the same thing as just making our 00:08:10.810 --> 00:08:16.460 substitution the limit as n approaches infinity of 1 00:08:16.460 --> 00:08:21.390 plus-- a/x, I made the substitution as 1/n. 00:08:21.390 --> 00:08:26.720 And x is, by this substitution, n times a. 00:08:26.720 --> 00:08:30.500 And this is going to be the same thing as the limit as n 00:08:30.500 --> 00:08:36.090 approaches infinity of 1 plus 1/n to the n, all 00:08:36.090 --> 00:08:39.390 of that to the a. 00:08:39.390 --> 00:08:41.760 And since there's no n out here we could just take the limit 00:08:41.760 --> 00:08:43.450 of this and then take that to the a power. 00:08:43.450 --> 00:08:47.690 So that's going to be equal to the limit as n approaches 00:08:47.690 --> 00:08:52.600 infinity of 1 plus 1/n to the nth power, all of 00:08:52.600 --> 00:08:53.780 that to the a. 00:08:53.780 --> 00:08:58.040 And this is our definition, or one of the ways to get to e if 00:08:58.040 --> 00:09:00.820 you'd watch the videos on compound interest and all that. 00:09:00.820 --> 00:09:01.880 This is how we got to e. 00:09:01.880 --> 00:09:03.460 And if you tried it out on your calculator, just try larger 00:09:03.460 --> 00:09:07.260 and larger n's here and you'll get e. 00:09:07.260 --> 00:09:12.010 This inner part is equal to e, and we raised it to the a 00:09:12.010 --> 00:09:14.060 power, so it's equal to e to the a. 00:09:14.060 --> 00:09:16.240 So hopefully you pretty satisfied that this limit 00:09:16.240 --> 00:09:17.860 is equal to e to the a. 00:09:17.860 --> 00:09:19.860 And then one other tool kit I want in our belt, and I'll 00:09:19.860 --> 00:09:22.340 probably actually do the proof in the next video. 00:09:22.340 --> 00:09:32.950 The other tool kit is to recognize that x factorial over 00:09:32.950 --> 00:09:42.860 x minus k factorial is equal to x times x minus 1 times x 00:09:42.860 --> 00:09:50.030 minus 2, all the way down to times x minus k plus 1. 00:09:50.030 --> 00:09:51.880 And we've done this a lot of times, but this is the most 00:09:51.880 --> 00:09:53.060 abstract we've ever written it. 00:09:53.060 --> 00:09:55.580 I can give you a couple of-- and just so you know, they'll 00:09:55.580 --> 00:09:57.330 be exactly k terms here. 00:09:57.330 --> 00:10:01.700 1, 2, 3-- So first term, second term, third term, all the 00:10:01.700 --> 00:10:04.310 way, and this the kth term. 00:10:04.310 --> 00:10:07.210 And this is important to our derivation of the 00:10:07.210 --> 00:10:09.160 Poisson distribution. 00:10:09.160 --> 00:10:13.870 But just to make this in real numbers, if I had 7 factorial 00:10:13.870 --> 00:10:20.110 over 7 minus 2 factorial, that's equal to 7 times 6 00:10:20.110 --> 00:10:24.070 times 5 times 4 times 3 times 3 times 1. 00:10:24.070 --> 00:10:27.360 Over 2 times-- no sorry. 00:10:27.360 --> 00:10:28.940 7 minus 2, this is 5. 00:10:28.940 --> 00:10:33.500 So it's over 5 times 4 times 3 times 2 times 1. 00:10:33.500 --> 00:10:37.190 These cancel out and you just have 7 times 6. 00:10:37.190 --> 00:10:40.990 And so it's 7 and then the last term is 7 minus 00:10:40.990 --> 00:10:43.045 2 plus 1, which is 6. 00:10:47.560 --> 00:10:51.290 In this example, k was 2 and you had exactly 2 terms. 00:10:51.290 --> 00:10:53.230 So once we know those two things we're now ready 00:10:53.230 --> 00:10:55.710 to derive the Poisson distribution and I'll do 00:10:55.710 --> 00:10:58.415 that in the next video. 00:10:58.415 --> 00:10:59.980 See you soon.