Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Considering the problem of numerical evaluation of the integral of a 'good' function $f(x)$ over a unit interval

$I = \int_0^1f(x)dx$

Why can we say $I = E[f(U)]$, where $U\sim Uniformly[0, 1]$?

share|cite|improve this question
You pick the function in such a way that $I = \mathbb{E}[f(U)]$, and then use Monte-Carlo, for example, to compute the expected value... – gt6989b May 3 '13 at 12:53
I understand the method of how to evaluate it. My question is more why is it true. That is why $I = \int_0^tf(x)dx=E[f(U)]$ – Kane Blackburn May 3 '13 at 12:56
I got the question. That is the definition of expected value of a function. – gt6989b May 3 '13 at 12:58
up vote 1 down vote accepted

This is the law of the unconscious statistician stating that if $X$ is a random variable with density $g_X$, then $$ {\rm E}[f(X)]=\int_\mathbb{R} f(x)g_X(x)\,\mathrm dx $$ for any "nice" function $f$. Since $U\sim U(0,1)$ is a random variable with density $g_U=1_{(0,1)}$ it immediately follows that $$ {\rm E}[f(U)]=\int_0^1f(x)\,\mathrm dx $$ for any "nice" function $f$. Here "nice" is an assumption that ensures that the integrals are well-defined.

share|cite|improve this answer

The expected value of a random variable $X$ with pdf $p(x)$ is defined as

$$\mathbb{E}[X] = \int_\mathbb{R} x p(x) dx$$

and more generally, if we want to have $Y=f(X)$ then

$$\mathbb{E}[Y] = \mathbb{E}[f(X)]= \int_\mathbb{R} f(x) p(x) dx,$$

now if $X \sim U(0,1)$ then $p(x) = 1$ for $0 < x < 1$ (and 0 otherwise) so the integral becomes

$$\mathbb{E}[f(U)]= \int_0^1 f(u) dx.$$

share|cite|improve this answer
You can't say that the expected value of random variable is defined in that way. I'm perfectly aware that in many introductory probability courses this is the definition of the expected value of a random variable that admits af pdf, but this might not be the case for the OP. – Stefan Hansen May 3 '13 at 13:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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