How is the expected value of a continuous random variable calculated using an integral?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

In probability theory, the expected value (or mean) of a continuous random variable X is a weighted average of the values the variable may assume, where the weights are provided by the probability density function f(x).1

To calculate the expected value E(X) for a continuous random variable, you compute the integral of the product of the variable x and its probability density function f(x) over all possible values of the variable. This is expressed by the following formula:21

E(X)=∫xf(x)dx

In this context, the integral is taken over the entire range of the random variable. This calculation serves as the continuous counterpart to the summation used for discrete random variables, where the expected value is the sum of each possible value multiplied by its probability.213