st101 » week-2 »

11A.  Probability Distributions

These are draft notes extracted from subtitles. Feel free to improve them. Contributions are most welcome. Thank you!
Please check the wiki guide for some tips on wiki editing.


01 Landing Probability

So today I want to talk about a little bit more of probability distributions and specifically talk about what's called continuous distribution is because there is some caveats that you should be aware of as you look forward in this class.So here's a new prop. It's a NERF gun.They actually shoot like this and we have a lot of those at Udacity and I want to know doing experiment in which I shoot it projectile and some way hits the ground, say somewhere between this location (a) and this location (b). I just don't know.

The question I would like to arise is a tricky one: consider any location x and assume the angle of gun is somehow random and so is the pressure behind the projectile. What is the probability, that any of the specific x is the correct one?


02 Landing Probability Solution

And the answer is zero, nothing else butzero.  Because any specific value over here is just really, really unlikely – so unlikely we can give it a probability.

03 Spinning Probability

This is a more common example; it’s called the wheel of fortune.  We’re twisting an object like a bottle, or like a pen and then it arrives at a specific angle. We all know that angles go between zero and 360 degree. So let’s take a specific angle. What is the probability that our object has the very precise angle 180 degrees?

unnamed (1).jpg

04 Spinning Probability Solution

And the answer is zero. It’s zero for any other number. 179.99, 179.98 and so on, each angle has probability zero. That’s because getting that exact angle right with exact the right decibels, you just won’t be able to get there.

05 Stops Nowhere

So now here is the conundrum. Does this mean that the object stops nowhere, yes or no? Say, yes, if you believe it stops nowhere.

unnamed (2).jpg

06 Stops Nowhere Solution

And of course it stops. So, no, is the right answer. But the bizarre thing is, it’s going to have an angle, like this one over here,this might be 101.374819 and so on. And this number truly has probability zero. So whatever the outcome is, that specific outcome will be unlikely, so unlikely as probability zero. And this is one of the bizarre things about probability when you go to continue spaces. In continuous distributions, every outcome has probability zero. And that might sound entirely counter intuitive and it is, but it is important to understand.

07 Range Probability

So let’s now redefine how to treat continuous distributions, here is our circle again and here is the bottle that we are spinning.Let’s call the outcome X, that’s the final angle at which the bottle arrives. Tell me what’s the probability that X is between zero and 180 degrees? Put your answer here.

unnamed (3).jpg

08 Range Probability Solution

And you guys correctly, it’s half. There is a 50% chance of being between zero and 180 and the 50% chance of between 180 and 360.

09 Range Probability 2

How about the interval 260 degree all the way to 290 degrees, what’s the probability?

unnamed (4).jpg

10 Range Probability 2 Solution

That’s actually one twelfth: 0.0833 and so on.

11 Range Probability 3

Okay, let’s make this interval really, really small. Let’s say we go from 179 degrees to 180 degrees. So, it’s specific up to a single degree but is still an ever so slight range in the spectrum over here. What’s the probability?

unnamed (5).jpg

12 Range Probability 3 Solution

It’s 0.002777 which is the same as 1 over360. So, obviously, the probability for any interval, defined by A and B, is the size of the interval divided by 360. And, if you got those right, you understand all this.

13 Density

So, I’m now going to teach you a concept that is very deep, called the density of a probability. And it’s kind of like a probability for continuous spaces but not exactly. It’s just a good motivator to think of a density as a – of a probability for continuous spaces. Let’s take the bottle example. We know that the outcome of turning the bottle lies between 0 and 360 degrees.So, given what we learnt, you want to assign 0 to anything outside that range but inside this range, we’d love to give a value and say,look, there is a function here that renders every outcome in this interval equally likely.So, you’re going to construct this function for So, you’re going to construct this function for c number one, each outcome in the range of 0 to 360 has an equal value, and, constraint number two, the area under this function sums up or integrates to 1 which means this area over here is just 1. So, tell me what is this function for X’s that are between 0 and 360 degrees. There is a single numerical value that goes in here and you have to guess it.

unnamed (6).jpg

14 Density Solution

And, the answer is, again, 0.002777 and so on,which is the same as 1 over 360. And, the wayto see this is that the width of this interval over here is 360. We didn’t know the height which is what I asked you to guess. But, if we multiply 360 by 1 over 360 then the area of this rectangle over here becomes 1. So, let’s do this again.

15 Birth Time Density

Suppose, you look at the date and time you were born, and then specifically look not at the date, not even the time, but just the seconds of the time. So, it could be that we were born exactly as the minute began, in which case, it was zero; or exactly at second 59.282, I don’t know.Let’s assume it’s completely uniform. There is no preference to be born early in the minute or late in the minute. I’m going to ask you two questions now. For any such thing, X, where X is the seconds of the time stamp, what’s the probability of that specific X? And, what’s the density of that specific X?It might mean that these are actually different questions.

unnamed (7).jpg

16 Birth Time Density Solution

And, the correct answer here is 0. Any specific continuous thing, 0.  For uniform distribution,we find that the interval we’re talking about skates between 0 and 60 so the correct answer is 1 over 60 and that is 0.01666.

17 Changing Density

So, here’s a new quiz and in this quiz you’ll be looking into densities that are non-uniform. In particular, I’m looking at the time of day when people are born. And, let’s assume for this exercise that it’s twice as likely to be born before noon than in the afternoon or the evening. So, if you look at the time of day and the density for the time of day,I wonder if the shape is like this. This is zero and this is midnight, right at 24.Perhaps like this or more like that? Pick the one that you think is most plausible.

unnamed (8).jpg

18 Changing Density Solution

This is the one I would pick and the reason,if it’s twice as likely to be born before noon,it means the density in the morning, before noon, should be twice as high as the density in the afternoon. And that’s best depicted by this diagram over here. This one would be uniform so ignoring the fact that it’s twice as likely. And, this is even worse; it emphasizes the afternoon over the morning.

19 Changing Density 2

And, now, comes the hard part. I want you to calculate the actual density. We know that the density for the birth time to be before noon is twice as large as the density for being born after noon. So, here is my density function,time of day X, Nf of X and you’ve already identified the shape. And, there’s now two parameters, A and B. I want you to figure out for me what A is and what B is, assuming that the basic unit here is in hours. Put differently,there is 24 hours horizontally in this interval. As a hint, make sure that the area underneath sums up to 1.


20 Changing Density 2 Solution

And, here’s how I calculate it. These spheres over here are all of the same volume. Since they have to add up to 1, each of those has exactly a third. Now, let’s start with the right one. If this is a third in terms of area and we have to cover 12 hours, then B equals to A third times 12 which is 0.0277. The one on the left is exactly twice the size, 0.0555 which is two-thirds times 12, it’s 1/18th.

You want the total area under the curve from x=0 to x=24 to be equal to 1. The drop from a to b happens exactly in the middle or when x=12 (at noon).

Since f(x \le noon) = 2 \times f(x \gt noon), this means that (2 \times b) = a and that you can break the graph into 3 identical rectangles:

b  |                    |         
b  |                    |                    |
           12                    12

Each one with the following dimensions:

 b   |                    |         

Therefore the area of each triangle is (b \times 12) If the total area of the graph is 1 and each triangle is identical, the area of each rectangle is \frac{1}{3}


b \times 12 = \frac{1}{3}

b = \frac{1}{3} \times \frac{1}{12} = \frac{1}{36} = 0.027777777777777776

a = 2 \times b

a = \frac{1}{18} = 0.05555555555555555

21 Check Density

if we multiply A by 12 because the density over here applies to 12 hours, plus B by times 12, tell me what the resulting number is.

unnamed (10).jpg

22 Check Density

And, I hope you got this right as, of course,1 because the surface area has to add up to 1.This was to cross-check over here, whereby 1/18th times 12 is two-thirds and 1/36 times 12 is one-third, and two-thirds plus one-third sequals 1. So, this was an example of a non-uniform density that you were able to compute. As you can tell, each specific birth time has exactly a probability of zero and this is just a density.

23 Calculate Density

Here’s another quiz. You’re dropping a package out of an aircraft, and the package goes down and we happen to know it takes between 3 and 3.5 minutes to reach the ground. And, let’s say,in between the probability density is uniform.Asking the same question again. There’s something to be learnt here. Here is 3. Here is 3.5. Obviously,the density outside is zero, is uniform, and there’s a value here A. And, I want you to tell me what is A.

unnamed (11).jpg

24 Calculate Density

And in my calculation A is 2. And, the reason is the normalizer over here is a half, from three to three and a half. To multiply a half with 2 gives us the area of 1 which is what we want to have for density. Now, what’s interesting here? A is larger than 1. Probabilities are never larger than 1. They are bound to the above by 1. But, densities can be larger than 1.In fact, if this package were to arrive between 3 minutes and 3 minutes and 1 second, then this would be 60 because there are 60 seconds in a minute. So, it is possible that densities become larger than 1; that’s a bit confusing if you think it was probability. But, you should know that this is the case.

25 Density Properties

Let me ask another trick question and that’s somewhat academic. For function f to qualify as an entity which of the conditions have to be fulfilled: has to be positive, non-negative,continuous, and smaller or equal to 1? Check any or all that apply including the ‘none of above’ if you believe none of those apply.

unnamed (11).jpg

26 Density Properties Solution

And, this is a really tricky question. So, clearly, densities don’t have to be positive everywhere. It suffices to be non-negative and I gave you examples where outside of certain interval density was zero. Zero is not positive. Zero is just non-negative. Now,densities don’t have to be continuous. I gave you an example of a density like this. And,over here where the density jumped, you had a point of discontinuity. So, continuous is not correct. And, if you got this wrong,no big deal. The word continuous might not even mean much to you. But, it’s one of these things to know about densities. Now, smaller or equal to 1, that’s a really tricky one. And, I would submit that’s not correct and here’s why.Suppose you have a density that assigns uniform probability only to values between 0 and 0.1, then the height of this density could be 10; it’s 1 over 0.1. And, as a result, it’s possible that densities can exceed 1. And that is a key point that makes them different from probabilities. Probabilities are always smaller than or equal to 1. Densities can be larger than 1.

27 Summary

So you just learned about the concept of a probability density and that’s very cool. You now know what a uniform density is, you’ve encountered a new type of density that have a step in the middle and later in this class we will see densities that are very funny like this one over here called the Gaussian.We get back to this after we talked about large numbers and something funky called the central limit theorem or CLT.

unnamed (12).jpg