The probability density function or PDF of a continuous random variable gives the relative likelihood of any outcome in a continuum occurring. Unlike the case of discrete random variables, for a continuous random variable any single outcome has probability zero of occurring. The probability density function gives the probability that any value in a continuous set of values might occur. Its magnitude therefore encodes the likelihood of finding a continuous random variable near a certain point.
Heuristically, the probability density function is just the distribution from which a continuous random variable is drawn, like the normal distribution, which is the PDF of a normally-distributed continuous random variable.
The probability that a random variable takes a value in the (open or closed) interval is given by the integral of a function called the probability density function :
If the random variable can be any real number, the probability density function is normalized so that:
This is because the probability that takes some value between and is one: X does take a value!
These formulas may make more sense in comparison to the discrete case, where the function giving the probabilities of events occurring is called the probability mass function . In the discrete case, the probability of outcome occurring is just itself. The probability is given in the discrete case by:
and the probability mass function is normalized to one so that:
where the sum is taken over all possible values of . One can see that the analogous formulas for continuous random variables are identical with the sums promoted to integrals.
The non-normalized probability density function of a certain continuous random variable is:
Find the probability that is greater than one, .
First, the probability density function must be normalized. This is done by multiplying by a constant to make the total integral one. Computing the integral:
So the normalized PDF is:
Computing the probability that is greater than one,
It should be noted that the probability density function of a continuous random variable need not be continuous itself.
In contrast to the case of discrete random variables, the probability density function of a continuous random variable need not satisfy the condition . A uniformly distributed continuous random variable on the interval has constant probability density function on . Another example is the unbounded probability density function of a continuous random variable taking values in .
Recall that in the discrete case the mean or expected value of a discrete random variable was the weighted average of the possible values of the random variable:
This formula makes intuitive sense. Suppose that there were outcomes, equally likely with probability each. The the expected value is just the arithmetic mean, . In the cases where some outcomes are more likely than others, these outcomes should contribute more to the expected value.
In the continuous case, the generalization is again found just by replacing the sum with the integral and with the PDF:
assuming the possible values are the entire real line. If is constrained instead to or some other continuous interval, the integral limits should be changed accordingly.
The variance is defined identically to the discrete case:
Computing only requires inserting an instead of an in the above formulae:
The mean and the variance of a continuous random variable need not necessarily be finite or exist. Cauchy distributed continuous random variable is an example of a continuous random variable having both mean and variance undefined.
Show that the exponential random variable given by the normalized PDF:
has mean and variance .
Note that the exponential random variable is defined for in the range (if not obvious why, consider that the PDF is only normalized for this range). Computing the expected values that define the mean and variance respectively using integration by parts:
So the mean is therefore indeed .
So the variance is: