If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

# Probability density functions

## Video transcript

in the last video I introduced you to the notion of a probability rule really we started with the random variable and then we moved on to the two types of random variables you had discrete discrete that took on a finite number of values and they these well I was going to say that they tend to be integers but they don't always have to be integers you have discrete random and so you know finite meaning you can't have an infinite number of values for a discrete random variable then we have the continuous which can take on continuous continuous an infinite number and the example I gave for continuous is let's say a random variable X and people do tend to use let me change it a little bit just so you can see it can be something other than an X let's say I have the random variable Capital y they do tend to be capital capital letters is equal to the I don't know exact exact exact amount of rain amount of rain tomorrow and I say rain because I'm in Northern California it's actually raining quite hard right now which we're short right now so that's a that's a positive we have we've been having a drought so it's a good thing but the exact amount of rain tomorrow and let's say I don't know what the actual probability distribution function for this is but I'll draw one and then will interpret it just so you can kind of think about how you can how you can how you can well think about continuous random variable so let me draw its probability distribution or they call its probability density function and we draw it like this and let's say that there is let me think there's let's say it looks something like this like that alright and then I don't know what this height is so this the x-axis here is the amount of rain where this is 0 inches this is 1 inch this is 2 inches this is 3 inches 4 inches and then this is some height let's say let's say it Peaks out here at I don't know let's say this is let's say this is point 5 point 5 so the way to think about it if you were to look at this and I were to ask you what is the probability the probability what is the probability that Y because that's our random variable now that Y is exactly equal to 2 inches that it Y is exactly equal to 2 inches right what's the probability of that happening well based on how we thought about the probability distribution functions for the discrete random variable you'd say ok let's see two inches that's the case we care about right now let me go up here say okay it looks like it's about 0.5 and you say well I don't know is that 0.5 chance and I would say no it is not a point 5 chance and before we even think about how we would interpret it visually let's just think about it logically what is the probability that tomorrow we have exactly two inches of rain not 2.01 inches of rain not 1.99 inches of rain not one point nine nine nine nine nine inches of rain not 2.000 one inches of rain exactly two inches of rain no I mean like you know there's not a single extra atom water molecule above the two inch mark and not a single water molecule below the two inch mark and there you know you could have it's essentially zero right it might not be obvious to you because you've probably heard oh you know we have two inches of rain last night but think about the exactly two inches right normally if it's like 2.01 people will say that's two but we're saying no that this does not count it can't be two inches we want exactly two 1.99 does count normally I mean our measurements we don't even have tools that can tell us whether it is exactly 2 inches right no matter no ruler you can even say is exactly 2 inches long at some point you know just the way we manufacture things there's going to be an extra atom on it here or there so the odds of actually anything being exactly a certain measurement to the exact you know infinite decimal point is actually zero the way you would think about a continuous random variable you could say what is the probability what is the probability that you know Y is almost 2 so if we said that the absolute value of Y minus 2 is less than some tolerance is less than I don't know point 1 right and if that doesn't make sense to you this is essentially just saying that what is the probability that Y is greater than 1.9 so greater than one point greater than 1.9 and less than 2.1 these two statements are equivalent I'll let you think about it a little bit but now this starts to make a little bit sense now we have an interval here so we want all lies between 1.9 and 2.1 so we are now talking about this whole area an area is key so if you want to know the probability of this occurring you actually want the area under this curve from this point to this point and for those of you who have studied your calculus that would essentially be the definite integral of this probability density function from this point to this point so from let me see I've run out of space down here so let's say if this graph let me draw it in a different color if this line was defined by I don't know I'll call it f of X I mean I could call it P of X or something the probability of this happening the probability of this happening would be equal to the integral for those of you have studied calculus from one point nine to two point one of f of X DX assuming you know this is the x-axis right so it's a very kind of important thing to realize because when you when you win it when a random variable can take on an infinite number of values or it can take on it any value between an interval to get an exact value to get it you know exactly 1.999 the probability is actually zero it's like asking you what is the area under a curve on just this line or it's even more specifically it's like asking you what's the area of a line right an area of a line if you were to if you were to just draw a line you say well area is height times base well the height has some dimension but the base what's the width of a line right there's bar as you know the way we've defined a line a line has no width and therefore no area and it should make intuitive sense that you cannot the probability of a very super exact thing happening is pretty much zero that you really have to say okay what's the probability that we get close to two and then you can define an area and if you said oh what's the probability that we get someplace between one and three inches of rain then of course the probability is much higher the probability is much higher it would be all of this kind of stuff right you could also say you know what's the probability we have less than 0.1 inches of rain then you would go here and you would calculate you know this was 0.1 you would calculate this area and you could say you know what's the probability that we have more than four inches of rain tomorrow then you would start here and you would calculate the area in the curve all the way to infinity if the curve has area all the way to infinity and hopefully that's not an infinite number right then your probability won't make any sense but hopefully if you take this sum it comes to some number and we'll say oh there's only a 10% chance that you have a you know that you have more than four inches tomorrow and all of this should kind of immediately lead to one light bulb in your head is that the probability of all of the events that might occur can't be more than 100% right all of the events combined can't you know there's there's a probability of one that one of these events will occur so essentially the whole area under this curve has to be equal to one so if we took the integral of f of X from zero to infinity this thing at least has I've drawn it DX should be equal to one for those of you have studied calculus for those of you haven't an integral is just the area under curve and you can watch the calculus videos if you want to learn a little bit more about how to do them and this also applies to the discrete probability distributions let me draw one the sum of all of the probabilities have to be equal to one and that example with the dice or or let's say the since it's faster to draw the coin the two probabilities have to be equal to one so if this is you know one zero where X is equal to one if we're heads or zero if we're tails each of these have to be 0.5 or they don't have to be 0.5 but if one was 0.6 the other one would have to be 0.4 they have to add to one if one of these was that you can't have a 60% probability of getting a heads and then a 60% probability of getting a tails as well because then you would have essentially a 120 percent probability of either of the outcomes happening which makes no sense at all so it's important to realize that a probability distribution function or probability distribution function in this case it for a discrete random variable they all have to add up to 1.5 plus 0.5 and in this case the area under the probability density function also has to be equal to one anyway I'm all out of time from now in the next video I'll introduce you to the idea of an expected value see you soon