# Introduction to the Continuous Uniform Distribution

Let’s look at an introduction to the

continuous uniform distribution. There is a discrete version of the

uniform distribution, but this video is about the continuous distribution. For the uniform distribution, the probability density function f(x) is constant over the possible values of x. Here I’m calling c the minimum value X can take on, and d the maximum value X can take on. c and d are allowed to be any finite values. Any intervals of equal length are equally likely to occur, so it is exactly as likely to get a value in an interval down here, close to c, as a value over here, close to d, provided

those two intervals are of equal length. This is a continuous probability distribution, so we know that the area under the

entire curve has to equal one, but for the uniform distribution that area is simply a rectangle, and so that area is the area of a rectangle and we know that that is simply the base times the height. And the base is d-c, and the height here is f(x), and we know that has to equal one. And so between c and d, this implies that f(x) is equal to 1/(d-c). between c and d. So this height here is 1/(d-c). Let’s see that written out a little more formally. Here’s the probability density function

of the uniform distribution. f(x) is equal to 1/(d-c) between c and d, and 0 elsewhere. So the height of the curve is 1/(d-c) here but it drops to zero outside of the interval c to d. Suppose we wanted to find the median of this distribution. Well, the median is simply the value down here, the value of the variable that splits the distribution in half, with half the area to the left, and half the area to the right. Well, [it’s] not too hard to see here for the uniform

distribution that that is simply going to be the midpoint between c and d. And since this is a symmetric distribution,

the mean and median are equal, so the mean and median are both equal to

the midpoint between c and d. The median is the midpoint between c and d,

which simply works out to (c+d)/2 and the mean, which I’m going to call mu here, is also equal to that. The midpoint between c and d, or just the average of c and d. The variance, we have to use a little calculus to find that, so I’m going to let you verify for yourselves that that is simply equal to 1/12 times (d-c)^2. We need to use a little integration to find that. For continuous probability distributions, finding areas under the curve usually requires integration, but for the uniform distribution areas

under the curve are simply rectangles. So we can find that using simple areas of rectangles. We could use integration if we so

desired, but we don’t have to. Suppose X is a random variable that has a uniform distribution with c=200 and d=250. What is f(x)? f(x) is equal to 1/(d-c), which is 1/(250-200), or 1/50. That’s not true everywhere though, that’s only true for values of x that lie between 250 and 200. Outside of that interval of values it’s equal to 0, so we say f(x)=0 otherwise. Visually what’s happening down here is that this height here we just found to be 1/50, and that makes sure the area under the entire curve is 1. Outside of 200 to 250, f(x) drops down to 0. What is the probability the random

variable X takes on a value greater than 230? For continuous random variables.

probabilities are areas under the curve, so we have 230 over here somewhere, and we’re simply looking to find the area under the curve to the right of 230. That’s the probability the random

variable X takes on a value greater than 230. This is simply the area of a rectangle.

This is the probability that the random variable X takes on a value greater than 230. This is simply going to be the base of the rectangle, which is 250-230, times the height, which is 1/50, so times 1/50. And this works out to 20/50 or 0.4. What is the 20th percentile of this distribution? The 20th percentile is the value of the variable that has an area to the left of 20% or 0.20. So we need to find the value of the variable such that the area to the left is 0.2. And I’m going to call that value a.

Now we’re going to solve for a. We know this rectangle has an area of 0.2, but we also know that that rectangle has an area equal to the base times the height, and the base is a-200, and the height is 1/50. And we know that must equal 0.2 in order for a to be the 20th percentile. So if we solve for a by multiplying by 50 and adding 200, we would see that this implies that a is equal to 210, and so the 20th percentile of this distribution is 210. For other continuous probability distributions, it’s not going to be quite so easy to find areas and percentiles. We’re going to have to use calculus and integrate the probability density function to find those areas and percentiles. But for the continuous uniform

distribution it’s fairly straightforward as this reduces to simply areas of rectangles.

## 3 Replies to “Introduction to the Continuous Uniform Distribution”

Thank you for sharing!

Hi I have a question for the discussion at 1:45. I thaught that f(x)=0 if x is greater than or equal to c. and f(x)=1 if x is greater than or equal to d. So I thaught that f(x) can only to equal to 1/d-c if x is greater than c (not equal to) and less than d (not equal to). Have I misunderstood this?

Some sources have the boundaries included, some not. Unless we're getting very technical, it doesn't matter whether we say f(x) = 1/(d-c) for c < x < d, or c < = x < = d. The cumulative distribution function F(x) = P(X <=x ) will be 0 for x < = c in either case, and F(x) = 1 for x greater or equal to d in either case as well. Whether the boundaries are included or not doesn't change anything, other than very technical details that are far beyond my treatment of this topic.