The weighted average of some function under a probability distribution is called the expectation or expected value of and defined by .

For a discrete distribution, this is given by summing over all possible values of in the form

where the average is weighted by the relative probabilities of the different values of .

For continuous distributions, expectations are expressed in terms of integration with respect to the corresponding Probability Density Function:

Approximation from Sample

If we are given a finite number of points drawn from the probability distribution/density, then the expectation can be approximated as a finite sum over these points:

This approximation becomes exact in the limit as .

Multivariate Expectation

For functions of several variables, we can use a subscript to indicate which variable is being averaged over, so that for instance

denotes the average of the function with respect to the distribution of . Note that will be a function of .

Conditional Distribution

We can also consider a conditional expectation with respect to a conditional distribution, so that

which is a function of .

For continuous variables, this conditional expression becomes