

Applied calculus online chapter: calculus applied to probability and statistics 
Section 2. Probability Density Functions and the Uniform Distribution 
We have seen that a histogram is a convenient way to picture the probability distribution associated with a continuous random variable X and that if we use subdivisions of 1 unit, the probability P(c \leq X \leq d) is given by the area under the histogram between X = c and X = d. But we have also seen that it is difficult to calculate probabilities for ranges of X that are not a whole number of subdivisions. To motivate the solution to this problem, let us look at the following example, based on Example 2 in Section 1:
A survey finds the following probability distribution for the age of a rented car.
Age (Years)  
Probability 
The histogram of this distribution is shown on the left of the figure below, and it suggests a curve something like the one given on the right. (There are many similarly shaped curves suggested by the bar graph. The question of finding the most appropriate curve is one we shall be considering below.)
Suppose now that as in the previous section, we wanted to calculate the probability that a rented car is between 0 and 4 years old. Referring to the table,
Referring to the lefthand graph of the following figure, notice that we can obtain the same result by adding the areas of the corresponding bars, since each bar has a width of 1 unit.
P(0 \leq x \leq 4) = Shaded Area  P(0 \leq x \leq 4) = \int_0^4f(x)\ dx 
Now what happens if we want to find P(2 \leq X \leq 3.5)? In Section 1 we estimated this by using half of the rectangle between 3 and 4 (see the next figure).
P(2 \leq x \leq 3.5) = Shaded Area  P(2 \leq x \leq 3.5) = \int_2^{3.5} f(x)\ dx 
Instead, we could use the definite integral
Before we go on... Although we haven't given you a formula for f(x), we would like f(x) to behave as described above. Here is something else we would like: Since a car has probability 1 of having an age between 0 and \infty, we want
Example 1 motivates the following:
Probability Density Function
A probability density function is a function f defined on an interval (a, b) and having the following properties.
(b) \displaystyle \int_a^b f(x)\ dx = 1 We allow a, b, or both to be infinite, as in the above example. This would make the integral in (b) an improper one. 
Using a Probability Density Function to Compute Probability
A continuous random variable X admits a probability density function f if, for every c and d,
Example Let f(x) = \frac{2}{x^2} on the interval [a, b] = [1, 2]. Then property (a) holds, since \frac{2}{x^2} is positive on the interval [1, 2]. For property (b),
\int_a^b f(x)\ dx = \int_1^2\frac{2}{x^2}\ dx = \Bigl[\frac{2}{x}\Bigr]_1^2 = 1 + 2 = 1
If X admits this probability density function, then 
Note If X admits a probability density function f, then
showing that there is a zero probability that X will assume any specified value.
For what constant k is f(x) = ke^{x} a probability density function on [0,1]?
Solution We need to choose a k that makes requirements (a) and (b) of the definition true. Since e^{x} > 0 for all x, all we need for (a) is to make sure that we choose k > 0. For (b), we calculate
Since this must equal 1, we get
Therefore, the function
is a probability density function on [0,1].
Before we go on... If f is any nonnegative function with domain some interval (a, b), then the process of choosing a suitable constant k to make \int_a^b {kf(x) \ dx} = 1 is called normalizing the function f.
A uniform density function f is a density function that is constant, making it the simplest kind of density function. Since we require f(x) = k for some constant k, requirement (b) in the definition of a probability density function tells us that
Thus we must have
In other words, a uniform density function must have the following form.
Uniform Density Function
The uniform density function on the interval \pmb{[a, b]} is the constant function defined by
f(x) = \frac{1}{ba}.
Its graph is a horizontal line: If a random variable X admits a uniform density function, we say that X is uniformly distributed, or that X has the uniform distribution. Calculating Probability with a Uniform Density Function Because probability is given by area, it is not hard to compute probabilities based on a uniform distribution:
Let X be a random real number between 0 and 5. Then X has a uniform distribution given by
f(x) = \frac{1}{50} = \frac{1}{5}

Suppose that you spin the dial shown in the figure so that it comes to rest at a random position. Model this with a suitable probability density function, and use it to find the probability that the dial will land somewhere between 5° and 300°.
Solution
We take X to be the angle at which the pointer comes to rest, so we use the interval [0, 360] as its range. Since all angles are equally likely, the probability density function should not depend on x and therefore should be constant. That is, we take f to be uniform.
Thus,
Before we go on... Check the following probabilities. Why are these the answers you expect?