Ask Claude about this
 

Equal Likelihood: The Uniform Distribution

What is it? The "Equal Chance" Distribution

The Continuous Uniform Distribution is used when we have a random variable (let's call it X) that can take on any value within a specific range, say from a starting point 'a' to an ending point 'b'. The key idea is that every value in this range [a, b] has an equal chance of occurring. Think of it like a perfectly balanced spinner that can land anywhere on a circle, or randomly picking a point on a line segment – every tiny spot has the same likelihood.

Because all values are equally likely, the graph of its probability (called the Probability Density Function, or PDF) looks like a flat rectangle between 'a' and 'b'. Outside this range, the probability is zero (X can't be less than 'a' or more than 'b').

The height of this rectangle is important. Since the total probability for any distribution must be 1 (or 100%), the area of this rectangle (height × width) must be 1. The width of the rectangle is (b - a). So, the height must be 1 / (b - a).

 

How to Calculate Probabilities (The Easy Way!)

If X follows a Uniform distribution between 'a' and 'b' (we write this as X ~ Uniform(a, b)), its PDF is:

f(x) = 1 / (b - a) (if a ≤ x ≤ b)
f(x) = 0 (otherwise)

Now, suppose we want to find the probability that X falls into a smaller range, say between 'c' and 'd' (where 'c' and 'd' are themselves within the main range of 'a' to 'b').

Because all values are equally likely, the probability is simply the length of our target interval (d - c) divided by the total length of the possible range (b - a).

So, the formula is super straightforward:

P(c < X < d) = (d - c) / (b - a)

Geometrically, this probability is the area of a smaller rectangle. This smaller rectangle has a height of 1/(b-a) (the same height as the big PDF rectangle) and a width of (d-c). Area = height × width = [1 / (b - a)] × (d - c) = (d - c) / (b - a).

(For those familiar with calculus, this is the same as calculating the integral: cd [1 / (b - a)] dx, which also gives (d-c)/(b-a).)

Uniform Distribution Example

EASY

A random variable X follows a continuous Uniform distribution between 0 and 1, denoted as X ~ Uniform(0,1).

What is the probability P(0.2 < X < 0.5)?

Think About It: If a bus arrives at a stop uniformly between 8:00 AM and 8:10 AM (a 10-minute interval), what is the probability you will wait less than 3 minutes if you arrive exactly at 8:00 AM? How does the PDF f(x) change for this new range?

Nerchuko Academy · Free DS Interview Prep