[Math] Monte Carlo integration, expected value of the sample mean and expected value of f(x)

monte carloprobability

I am still progressing in my learning of probability and monte carlo method. I understand a basic MC estimator can be written as:

$$\bar x = { 1 \over N } \sum_{i=1}^N f(x_i) \approx E[f(x)]$$

I understand this can be seen as an approximation of $E[f(x)]$. Where it assumes that $x$ and $x_i$ are distributed according to the same probability distribution function $p$. I understand these things so far. Now what I don't understand in the book I am reading is the following thing: it computes the expected value of $\bar x$ and I am not sure how to interpret that? This is confusing because $\bar x$ is already an approximation of the mean $E[f(x)]$. So I am not too sure what the "mean of the approximation of the mean $E[f(x)]$" means. It's written in the book that:

$$E[\bar x] = E[f(x)]$$

The way I interpret this is the following and I'd like to know if this is accurate. The sample mean $\bar x$ is just an approximation. Thus if we compute the mean of this approximation (which comes back to say that you compute an infinity of these sample mean and take the average value), then the result is actually identical to the mean $E[f(x)]$. Wouldn't that be the same though than computing the sample mean $\bar x$ where the number of samples N goes to infinity?

Where I am also confused is that in the book it says that:

$$E[\bar x] = {1 \over N} \sum_{j=1}^N E[f(x_j)]$$

I just don't get where the $E[f(x_j)]$ on the right inside comes from. Why would computing the mean of $\bar x$ implies a sum of mean $E[f(x_j)]$? It's probably simple but I can't make sense of what's going on really.

Thank you.

Best Answer

It is true that if $Y_i$ have finite means, then $E[\sum a_iY_i] = \sum a_i E[Y_i]$. This is known as linearity of expectation. In your case, the author took the definition of $\overline{x}$ $$ \overline{x} = \frac{1}{N}\sum_{i=1}^N f(x_i) $$ and took the expectation of both sides, so $$ E[\overline{x}] = E[\frac{1}{N}\sum_{i=1}^N f(x_i)] = \frac{1}{N}\sum_{i=1}^N E[f(x_i)]. $$

The reason the author does this is because, although $\overline{x} \approx E[f(x)]$ is intuitively clear, this statement has no mathematical meaning. However, the formula for $E[\overline{x}]$ above provides useful information on how good the approximation is.

Related Question