Hi and welcome back in this video, we're going to continue to look at continuous random variables. We'll study the exponential random variable in just a minute, but before we do that, we're going to go, take a step back and look at a discrete random variable called the Poisson random variable. The number of customers who arrived for service and they're waiting times are described by the Poisson random variable and the exponential random variable, respectively. So the number of customers who are arriving for service, that's the Poisson random variable, and that's what we're going to begin with. A parson random variable is a discrete random variable that describes the total number of events that happen in a certain time period. For example, the number of vehicles crossing a bridge in one day, maybe the number of gamma rays hitting a satellite per hour, or the number of cookies sold at a bake sale in an hour or maybe the number of customers arriving at a bank in a week. Those are all examples of what could be modeled by a Poisson random variable. Now you'll remember from our work with discrete random variables that in order to define the discrete random variable, I have to give you the probability mass function. So a discrete random variable X has paused on distribution with parameter lambda and land is always positive. If the probability mass function, the PMF is given by the probability that X equals K and that's going to be equal to land it to the K over K factorial times E to the minus lambda, and that's going to be for K equals 012 and so on out to infinity. And remember the Poisson random variable is modeling the number of events that happened in a certain time period. So it could be zero if nothing happens in that period of time. To verify that this is a true probability mass function. We should, some from K equals zero to infinity. The probability that X equals K and that should be equal to one. And let's see that it is. So we get the some from K equals 0 to infinity. Land it to the K over K factorial, E to the minus lambda. We can factor out the E to the minus lambda. And we get some from K equals 02 infinity. Land it to the K over K factorial. And this is just the expansion for E to the lambda. So this gives us E to the minus lambda times E to the lambda, Which is indeed one. Now we'd like to have some shorthand notation for this and it's really not that shorthand we're going to use X is Poisson with parameter lambda. A couple other things we'd like to know, we'd like to know the expected value of X And that would be the sum from K equals 0 to infinity K times the probability that X equals K. That will be the sum from K equals 02 infinity K lind to the K over K, factorial times E to the minus lambda. We can sum that using information from calculus to or some series, knowledge that you might have, the easiest way to do that is to recognize, you can pull out the lambda and I can notice when K equals 0. This whole thing contributes nothing. There's no contribution to the expected value. So I can just start from K equals one. Go up to infinity, I can cancel one of the K's from the factorial. And so we would get λ to the K -1 over K -1 factorial. And I still have that either the minus λ and I'll just leave that alone. This part in here is either the lambda again. And so we do end up after simplification, we get are expected value as equaling lambda. Now, the second moment to calculate the variance, we need the second moment K equals 02 infinity K squared probability that X equals K. There's some serious manipulation again, I think I'll skip that part if you're interested. It's not that hard, you can try it yourself. We're going to get slammed into the K over K factorial. E to the minus lambda. And this turns out to be lambda Times λ + 1. And finally, we can calculate the variance and that will be e the expected value of the second moment minus the expected value of the first moment squared. So that's going to be lambda tons, lambda plus one minus lambda squared. And that is equal to land again. So the expected value is lambda. So let's think about how we might use this if you're measuring some arrivals and if over a long period of time you find that you get a certain number of arrivals per time period, then maybe you're going to model that by a person and the average the expected number of arrivals. That is your parameter lambda. So once you know the expected value, once you know that lambda the entire probability mass function. Let's do an example, Suppose the number of mosquitoes captured in a trap during a given period of time is modeled by a Poisson random variable and Orlando is 4.5. What is the probability that the trap contains exactly five mosquitoes? What about five or fewer? Well, well, let X equal the number of mosquitoes X we're told is pasin And were given that λ is 4.5. So the probability the x equals 5 will be lambda. That's the 4.5 To the 5th power, divided by five factorial Times, E to the -4.5- Lambda. That's going to be approximately 1.708. The probability that we get five or fewer mosquitoes is going to be x less than or equal to 5. And for this, we actually need to sum this from 0 to 5. The probability that x = k, that's going to be the sum k = 0 to 5, we'll get 4.5 to the k over k factorial e to the -4.5. And that's approximately 0.7029. Here's another example. A factory makes parts for a medical device company. On average, the rate of defective parts per day is 10. You are responsible for monitoring the number of defective parts on a particular day. What would be an appropriate random variable? Give the values that the random variable can take on. Find the probability that the random variable equals 2. And what assumptions are you making? Let's let x equal the number of defective parts In the day that you are responsible for. And we're going to model x as a poisson. And we know that the long term average rate of defective parts is 10. And we know that the expected value of a poisson is lambda. So, we know that lambda has to equal 10. The values that that random variable can take on x, because it's poisson, It can take on values from 0 to infinity. Now let's think about that. I don't know any medical device company in the world that can make an infinite number of parts. So really there's an assumption that we are making. And the assumption is x as a poisson Can take on an infinite Number of values. But we're not making, We can't make an infinite number of parts. So, the assumption that we're making is that for the number of parts that we are making, we can model it in that range by the poisson. So, for example, suppose we're making 1000 parts per day or 10,000 parts per day. If on average, were making 10 defective parts per day and we're tossing those, then the poisson random variable is a reasonably good model. Because the probability that we're going to have more than 20 or 30 defective parts is very, very small. The probability that we have more than 100 defective parts in a single day is vanishingly small, still none zero, but so small as to be inconsequential. So that is the assumption that we're making when we're using the poisson to model a finite number of things. And then the probability that X = 2, that's going to be e to the minus lambda lambda squared over 2 factorial and e to the -10, 10²/2 factorial, and that's approximately 0.0023. Now, let's talk about the exponential random variable. The family of exponential distributions provides probability models that are widely used in engineering and science disciplines, and they use them to model or describe time to event data. An exponential random variable is continuous because it's going to measure time. Usually, it can measure other things, but we'll use it a lot to measure time. So for example, time until a birth, time until the light bulb fails. You're waiting time in a queue, the length of service time you might have, time between customer rivals. So all of these examples measure time and we think of time as a continuous quantity. Now, just like for discrete random variables and giving specifying the probability mass function. When we have a continuous random variable, we have to specify the density function. So, x has the exponential distribution with rate parameter lambda. If the density function, the pdf is given by f(x) = lambda e to the minus lambda x for x greater than or equal to 0 and 0 for x is less than 0. We should verify this. We should verify two things, number one, that the density function is positive everywhere. And we see that it is because lambda is greater than 0 and the exponential is always positive as well. So, the density function is always positive or 0. And we're going to verify that it integrates to 1. So we want to integrate from minus infinity to infinity. And we want to show that that's equal to 1. Well, in this case, we only have to go from 0 to infinity because it's 0 when X is negative and this is an improper integral. So, we'll take our limit as t goes to infinity. We've got lambda e to the minus lambda x. We do that integral. Keep the limit while we're doing it. We get lambda over minus lambda e to the minus lambda x. And we evaluate that from 0 to t. And that will equal the limit as t goes to infinity. So we'll get -e to the minus lambda t + 1. And as t goes to infinity, we do indeed get 1. We'd also like to know the expected value. So the expected value of x is going to be the integral 0 to infinity. X times the density that would be lambda e to the minus land, xdx. Now, we've got an integration by parts problem. I will let you try that on your own. So it's integration by parts, and we should get the answer is 1 over lambda. The second moment is going to be the integral 0 to infinity, X squared lambda e to the minus lambda X. Again, it's an integration by parts formula. This time you have to do integration by parts twice. I'll let you try that and you end up with 2 over lambda square. We can put that together, and we get the variants. So that's going to be the expected value of X squared, minus the expected value of X quantity squared. That's our computational formula. So we end up with 2 over lambda squared, minus 1 over lambda squared, so we get 1 over lambda squared as our variants. Notation, we're going to use X has the distribution of an exponential, and variable with parameter lambda. There's two really useful properties of the exponential. First, if the number of events occurring in a unit of time is a Poisson random variable with parameter lambda, the time between events is exponential. Also with parameter lambda the same lambda. Let's think about this in the context of a specific example. Suppose the number of customers arriving for service is modeled by a Poisson random variable with lambda equals 5 here. What does that really mean, it means on average 5 customers arrive per hour. So let's look at an hour here, and we'll put a 0 here and a 1 here. So that's our hour, and maybe there's a customer comes here, here, maybe another one comes here, another one comes here. Maybe in this particular hour, we only got 4 customers. The time between the customers arriving is modeled by an exponential random variable, and that's going to be lambda equals 5, so 1 over lambda is 1/5. So think about that, we've got 5 customers coming per hour. So the time between customers is 1/5 of an hour. So lambda equals 5 customers per hour, so 1 over lambda is going to be 1/5. So that is the expected time between arrivals is 1/5 of an hour. Now, this type of relationship is only between a Poisson and an exponential random variable, but it is a very important relationship that's used heavily in queueing theory and statistical analysis of customer service, especially if you're thinking of customers arriving or customers waiting for service. The second important property, is the memory list property of the exponential. So X has the distribution of an exponential random variable. The claim is that the probability of X greater than or equal to s plus t, given that X is greater than s, is the same as the probability of X greater than t. Let's analyze each side of this equation. So let's do the right hand side first. So we're going to look at the probability that X is greater than t. That's the same as 1 minus the probability that X is less than or equal to t, and that's going to be 1 minus the integral from 0 to t of lambda e to the minus lambda xdx. We do that integral, we end up with 1 minus lambda minus lambda e to the minus lambda X. And this is evaluated from 0 to t. And we get 1 + e to the minus lambda t- 1, and that gives us e to the minus lambda t. So think of X as the amount of time someone is in service at a bank for example. The probability that that service lasts longer than T time units, is either the minus lambda t. Now, let's look at the left hand side. So we have the probability that X is bigger than s + t, given X is greater than s. Well remembering back to our definition of conditional probabilities, this is going to be the probability that X is greater than s + t, intersecting with the event that X is greater than s, divided by the probability that X is bigger than s. Now, let's think about this. Here's a timeline, here is our time s. Our 0 is down here somewhere. Maybe this distance from here is t, and then we have s + t. So if the service lasts longer than s + t, and I intersect that with the event that x the service lasts longer than s, that's going to give us the probability that x is greater than s + t in the numerator. And then we have the probability, that X is greater than s in the denominator. You can calculate each of these probabilities and you end up with e to the minus lambda s + t in the numerator, and e to the minus lambda s in the denominator. Combining those two, we end up with e to the minus lambda t. And look, that's exactly what we had up here as well. So these two are exactly the same. So that tells us these two are the same, which verifies the memory of this property. Intuitively, we have to think about what this means. So if our length of service has the exponential distribution, then if you know that service has gone on for more than as time units, then the probability that it will last to s + t is exactly the same as if we had started at 0 and just said, what's the probability that it would last more than time T. Now many situations are not memory lists. For example, if I think of how long a piece of machinery works. That's not going to be memoryless because there's going to be metal fatigue in that piece of machinery. So if I know that piece of machinery has been working for three months, then the chance that it will last another two months is not the same as if it was working just for two months. So many things are not memoryless. But a lot of things are. And in particular when the arrivals are poison, the time between arrivals are exponential, you can prove that we're not going to in this class, but you can prove it. And if the time is measured in exponential then it is memoryless. We'll see some examples of that in the exercises. Let's conclude with one final example, suppose the service time at a bank with only one teller is modeled by a random variable X that is exponential and lambda equals 1/5. Where I'm thinking of one over lambda equaling 5 minutes, so that expected time that a person needs at the bank in service is 5 minutes. If there is a customer in service when you enter the bank, I want you to find the probability that the customer is still in service 4 minutes later. Now it's natural to ask, don't we need to know when the customer began service or don't we need to know how long the customer has already been being served. The answer is as long as the service is modeled as an exponential random variable, it doesn't matter because of that memoryless property. So if we let X equal the service time. Of the customer, Starting from your entrance. Into the bank, Then X. We're claiming is exponential and Orlando is 1/5. So the probability that, that customer needs at least 4 more minutes of service, it's going to be the integral from 4 to infinity of lambda E to the minus lambda X. And when you do that integral you get E To the -4/5, which is approximately equal 0.449. Now suppose you walk into that bank and you know that that customer started service five minutes ago, then what is the probability that they need at least 4 more minutes in service? So in other words, what's the probability that X is greater than or equal to 9, given that they've already been being served for five minutes? And this is exactly the memory of this property that we looked at on the previous slide. So the probability that X is greater than or equal to 9, intersected with X greater than or equal to 5, divided by the probability that X is greater than or equal to 5. That's going to be the probability that X is bigger than or equal to 9, divided by the probability that X is bigger than or equal to 5. And when you do this calculation, you get E to the minus 9/5 divided by E to the minus 4/5. And that turns out to be E to the minus 4/5, same as we expected. So, in summary, in this video, we've looked at the Poisson random variable which we have described, can model the number of arrivals in a certain time period. And we've looked at the exponential random variable and its two main properties. Number one that it models the time between events of the Poisson random variable and its memoryless. In the next video we'll study the Goshen or normal random variable. That will be really exciting. We'll see you then.