Probability density functions | Probability and Statistics | Khan Academy


In the last video, I introduced
you to the notion of– well, really we started with
the random variable. And then we moved on to the two
types of random variables. You had discrete, that took on
a finite number of values. And the these, I was going
to say that they tend to be integers, but they don’t
always have to be integers. You have discrete, so finite
meaning you can’t have an infinite number of values for
a discrete random variable. And then we have the
continuous, which can take on an infinite number. And the example I gave
for continuous is, let’s say 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 have the random
variable capital Y. They do tend to be
capital letters. Is equal to the exact
amount of rain tomorrow. And I say rain because I’m
in northern California. It’s actually raining
quite hard right now. We’re short right now,
so that’s a positive. We’ve been having a drought,
so that’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 we’ll interpret it. Just so you can kind of think
about how you can think about continuous random variables. So let me draw a probability
distribution, or they call it its probability
density function. And we draw like this. And let’s say that there is–
it looks something like this. Like that. All right, and then I don’t
know what this height is. So 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 it peaks out
here at, I don’t know, let’s say this 0.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 that Y– because that’s our random variable–
that Y is exactly equal to 2 inches? That Y is exactly
equal to two inches. 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. 2 inches, that’s the case
we care about right now. Let me go up here. You’d say it looks
like it’s about 0.5. And you’d say, I don’t
know, is it a 0.5 chance? And I would say no, it
is not a 0.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 2 inches of rain? Not 2.01 inches of rain,
not 1.99 inches of rain. Not 1.99999 inches of rain,
not 2.000001 inches of rain. Exactly 2 inches of rain. I mean, there’s not a single
extra atom, water molecule above the 2 inch mark. And not as single water
molecule below the 2 inch mark. It’s essentially 0, right? It might not be obvious to you,
because you’ve probably heard, oh, we had 2 inches
of rain last night. But think about it,
exactly 2 inches, right? Normally if it’s 2.01
people will say that’s 2. But we’re saying no,
this does not count. It can’t be 2 inches. We want exactly 2. 1.99 does not count. Normally our measurements, we
don’t even have tools that can tell us whether it
is exactly 2 inches. No ruler you can even say
is exactly 2 inches long. At some point, 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 infinite decimal point is actually 0. The way you would think about a
continuous random variable, you could say what is the
probability that Y is almost 2? So if we said that the absolute
value of Y minus is 2 is less than some tolerance? Is less than 0.1. And if that doesn’t make sense
to you, this is essentially just saying what is the
probability that Y is 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 of sense. Now we have an interval here. So we want all Y’s
between 1.9 and 2.1. So we are now talking
about this whole area. And 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’ll call it f of x. I could call it p
of x or something. The probability of this
happening would be equal to the integral, for those of you
who’ve studied calculus, from 1.9 to 2.1 of f of x dx. Assuming this is the x-axis. So it’s a very important
thing to realize. Because when a random variable
can take on an infinite number of values, or it can take on
any value between an interval, to get an exact value, to
get exactly 1.999, the probability is actually 0. It’s like asking you what
is the area under a curve on just this line. Or even more specifically,
it’s like asking you what’s the area of a line? An area of a line, if you
were to just draw a line, you’d say well, area
is height times base. Well the height has some
dimension, but the base, what’s the width the a line? As far as the way we’ve defined
a line, a line has no with, and therefore no area. And it should make
intuitive sense. That the probability of a very
super-exact thing happening is pretty much 0. That you really have to say,
OK what’s the probably that we’ll get close to 2? And then you can
define an area. And if you said oh, what’s
the probability that we get someplace between 1 and 3
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. You could also say what’s
the probability we have less than 0.1 of rain? Then you would go here and
if this was 0.1, you would calculate this area. And you could say what’s the
probability that we have more than 4 inches of rain tomorrow? Then you would start here and
you’d 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 there’s only a
10% chance that you have more than 4 inches tomorrow. And all of this should
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 the events combined–
there’s a probability of 1 that one of these events will occur. So essentially, the whole
area under this curve has to be equal to 1. So if we took the integral of f
of x from 0 to infinity, this thing, at least as I’ve drawn
it, dx should be equal to 1. For those of you who’ve
studied calculus. For those of you who haven’t,
an integral is just the area under a 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 1. And that example with the
dice– or let’s say, since it’s faster to draw, the coin– the
two probabilities have to be equal to 1. So this is 1, 0, where x is
equal to 1 if we’re heads or 0 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 would have to be 0.4. They have to add to 1. If one of these was– 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 120% probability of either of the outcomes
happening, which makes no sense at all. So it’s important to realize
that a probability distribution function, in this case for a
discrete random variable, they all have to add up to 1. So 0.5 plus 0.5. And in this case the area
under the probability density function also
has to be equal to 1. Anyway, I’m all
the time for now. In the next video I’ll
introduce you to the idea of an expected value. See you soon.

100 Replies to “Probability density functions | Probability and Statistics | Khan Academy”

  1. I am confused about one thing. Is it the fact that we choose to define an infinitesimal interval to model physical phenomena more realistically or is there a more fundamental mathematical reasoning behind it? Because the probability being 0 at an exact value is just a definition and can be easily changed (or is that also wrong?).

  2. Why do we need to find the area under the curve? Intuitively I feel that just by averaging out the numbers on the curve (the probabilities) we should get the probability in a range?

  3. Hi.. have a question and I may be wrong… but the chance of having 2 inches of rain should ideally not be zero cos it falls inside ur curve.. i.e. within ur 100%… so there has to be some probability..wether it is 1 or 0.00000001% but it has to be. the chance of something happening should be zero when it is outside your curve. Please guide me

  4. hi.. to add to my comment below… at 8:14 u mentioned that there is a probability that one of these events will occur… which means that probability of having exact 2 inches of rain cant be zero. please guide me. thank u

  5. Great video as always. Thanks. But the intuition for the magnitude of the y axis is left dangling. Do we work backwards from a total probability (area) of 1?

  6. the probability of something being super-exact is zero..that's the kind of explanation i wanted to hear when i decided to watch this vid

  7. I hate when people complain about free shit. If you don't like these videos then go to your local county college and pay $1000 for a course. Otherwise stop complaining and let him do what he likes.

  8. thank you so much, i didn't have a clue how or what these things even were and i have a stats 2 exam in like a month, this video saved my life

  9. You Tube always help me,I am retired and this is a cotinuity of University,I am designigaClass J 12mR, geometry of midship cross sectional imersed ,has been helpfull,Thankyou,Johann,Ramjets fine,scramjets,wasit for materials high melting point,Regards Johann Wegmann.Suggestion years professor ,FEA,avoid handwritten whiteboards, a class deserves PC printed,and images,from suitable printers,I learnt write in DIN rules,students inspiredinmy art partial derivatives,Tensors, and Einstein Index Notation,More than a decade,best is PC word,Matlab,excell, eliminate handwritten,it can help,very much,Good Bye.Thanks again,

  10. Those who don't understand it, I suggest you to watch the Discrete and continues video. Then you easily get it.

  11. Sal says the probability of exactly 2 inches of rain is "essentially" or "pretty much" 0. Then at another point he says it is actually zero. Which is it then? By my logic, why can't it be very close to zero rather than zero. When we have exactly the right amount of atoms and atmospheric pressure.

  12. as to continuous random variable, it should be probablity density function. however, he just ignore explaining it, it will cause chaos of concept between discret and continuous random variable.

  13. Wouln´t the correct definition about random discrete variables a, lets say, be a infinite enumerable field of random variables? It should also apply!

  14. how is the probability of 2" actually 0? wouldnt it hav to be a non0 number? over infinite trials sometimes there would be exactly 2"

  15. Still it's not very clear how a certain probability can be exactly zero, that seems wrong. Let's say it was raining today, and some amount of rain dropped from the sky. Now, it's a certain, finite, EXACT amount of rain water that fell on our heads today, not one atom more, not one atom less. It was some exact amount; don't say that we cannot measure it because we shouldn't, it does not concern us how much water fell down, what does concern us is that the amount of it was finite and exact. What was the predicted probability of exactly this amount of rain falling today? – exactly zero. So it was impossible ,yet it happened. How so?

  16. The 40% of students failed an end of semester exam. The mean for the test was 110 and the standard deviation was 22. What was the passing score? please solve this

  17. I really never understand your way of teaching. Very confusing choices of words I don't know I don't know… Then why you made this video? I don't know this concept despite watching your videos should I make a video ?

  18. Lol, the way he discusses some of these things fall more into the philosophy realm of things lol. Btw I reject mathematical infinitism.

  19. If there is a chance that every event under the graph can happen, then why can't 2.000000000000? Whats the deal of either 2.00000001 or 1.99999999?

  20. Yeah I had my doubts thanks to some of the comments but wow, this was heckin useful thanks man!! I finally understand what that integral is for lol

    To anyone who says they're wasting 10 minutes, just watch it at a faster speed and skip portions you're already confident in.

  21. rant much? lol ten minutes and didn't even work trough a probability function wont be able to get that time back!

  22. very useful video…people who think this is slow, can increase video speed to 1.25x and it works like a charm

  23. Just wanna say that if you had exactly 2 inches of water, ~99.999999999% of them would be below the 2 inch mark

  24. can't I calculate the exact probability of an event by taking the derivative of the function ???

  25. I am sorry, but in most of the videos you have a habit of saying " I don't know " its very putting off, specially when we are learning from you. please lose that habit and i hope you take no offence, it is just an observation 🙂

  26. @5:16 the equation confuses me. Any number that is smaller than 2 minus two will get a negative number, which is smaller than 0.1 how does he get 1.9 as the lowest tolerance? Sorry if what i said was confusing

  27. Sum of all probability in a distribution is one always but in your example we cant say there is100 percent chance of rain tomorow so why 1 i am stuck 🙄

  28. What’s the probability of exactly 0 amount of rain tomorrow. Some days It doesn’t rain and you mentioned there was a drought so is it possible to have 0 rain.

  29. P(X=2) is not equal to zero!

    It's just very close to zero, or that it's limit tends to zero, but it can't be zero.
    I mean , think about it, you can try and use your logic to derive the probability of P(X=k) for any real number k and you will still conclude that it's equal to zero.

    But this will not make any sense, because if you add all the P(X=k) up for all real numbers of k , you should be getting 1, right? But from your inference of the probabilities it would have been equal to zero instead .

    Following from first principles, that the definition of PDF is the derivative of CDF , we should not take the tiny nudge dx to be equal to zero when we want to calculate the probability of a number by minimizing the region of the neighborhood around that number and calculate the limit as that length of that region goes to zero.

    Essentially, P(X=2) approaches zero, but it is not equal to zero.

    PDs or probability densities can be thought as probabilities of P(X=k) measured relative to each other, since in real practice for a continuous variable the probability of P(X=k) tends to zero for any K , hence the values are too small to work with. It's kinda like how chemists use a log scale when they work around with spectroscopy graphs. In this case, by dividing P(x=k) ( or the limit of P(k<x<k+dx) as dx approaches zero)by a very small number dx, we can see how different P(x=k) is relative to each other.

Leave a Reply

Your email address will not be published. Required fields are marked *