According to Wikipedia, the expected value of a continuous random variable is

$$E[X] = \int_{-\infty}^{\infty} xf(x) \mathrm{d}x.$$

Suppose $f$ is a function such as $f:\mathbb{R}\rightarrow (a,b)$. Is the expected value then undefined, since $f$ does not exist for $x < a$ or $x > b$?

  • $\begingroup$ You seem to be confused about the difference between the expected value of a random variable and the expected value of a function of a random variable. If $X$ is a random variable with probability density function $f$ (which must be defined on $-\infty < x < \infty$, then $E[g(X)]=\int_{-\infty}^{\infty} g(x)f(x)dx$. $\endgroup$ Aug 15, 2015 at 18:13
  • $\begingroup$ The $f$ in the statement is the probability density of the random variable $X$. So long as that's true, it doesn't really matter what $f$ looks like. $\endgroup$
    – KOE
    Aug 15, 2015 at 18:14
  • $\begingroup$ If the random variable is restricted to (a,b) then the density, $f$, outside that range will be defined to be 0. So there's no difficulty; $f$ is defined outside the range of possible values for the variable -- it is 0 everywhere else. $\endgroup$
    – Glen_b
    Aug 16, 2015 at 0:18

1 Answer 1


If you define the function the way you did, $f(x)$ does exist for $x < a$ and $x>b$. Perhaps you mean a function $g:(a,b) \to \mathbb{R}$, where the domain is a bounded interval. In that case, $g(x)$ is assumed to equal $0$ for all $x \notin (a,b)$. An example is the Beta distribution, which is defined by a probability density function on the interval $(0,1)$ and $0$ elsewhere. The Beta distribution has an expected value, so the fact that the pdf is not defined for all elements of $\mathbb{R}$ does not imply the function does not have an expected value.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.