<p>In Monte Carlo integration, the samples $x_1, x_2, \ldots x_N$ are <a href="https://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables" rel="nofollow noreferrer">independent, identically-distributed</a> random variables. This implies they all have the same expectation value. The derived quantities $f(x_i)/p(x_i)$ also all have the same expectation value. So the expectation of a sum of $N$ of these is the same as $N$ times the expectation of any one of them:
$$E\left[ \sum_{i=1}^N \frac{f(x_i)}{p(x_i)} \right] = N \cdot E\left[\frac{f(x_1)}{p(x_1)}\right]$$
(I picked $x_1$ arbitrarily.)</p>

<p>Then, the expectation value of a continuous random variable is found by integrating over its probability measure:
$$E\left[\frac{f(x_1)}{p(x_1)}\right] = \int_{\text{domain of }p(x)} \frac{f(x)}{p(x)} \, p(x) \, dx$$</p>

CC BY-SA 3.0
2017-06-29T23:35:56.760Z
2017-06-29T23:35:56.760Z
Nathan Reed
<p>Let $I$ = the value of integration and $p$ = probability distribution.</p>

<p>The estimator is denoted as $\left\langle I \right &gt;$ and is
$$\left\langle I \right &gt;=\frac{1}{N}\sum_{i=1}^{N}\frac{f(x_i)}{p(x_i)}$$</p>

<p>The expected value of this estimator is computed as follows:</p>

<p>$$E[\left\langle I \right &gt;] = E[\frac{1}{N}\sum_{i=1}^{N}\frac{f(x_i)}{p(x_i)}]$$</p>

<p>$$\qquad \qquad  \space \space \space \space = \frac{1}{N}E[\sum_{i=1}^{N}\frac{f(x_i)}{p(x_i)}]\cdots(1)$$</p>

<p>$$ \qquad \qquad\qquad\quad= \frac{1}{N}N\int\frac{f(x)}{p(x)}p(x)dx\cdots(2)$$</p>

<p>$$ = \int f(x)dx \space \space$$
$$ = I\qquad\qquad \space$$</p>

<p>I wonder why the two equation, $(1)$ and $(2)$, are equal??</p>

<mathematics><physically-based><pbr><monte-carlo>
Monte Carlo Integration
shashack
# Monte Carlo Integration

(Asked by: username_0 on 2017-06-29)

Let $I$ = the value of integration and $p$ = probability distribution.

The estimator is denoted as $\left\langle I \right >$ and is
$$\left\langle I \right >=\frac{1}{N}\sum\_{i=1}^{N}\frac{f(x\_i)}{p(x\_i)}$$

The expected value of this estimator is computed as follows:

$$E[\left\langle I \right >] = E[\frac{1}{N}\sum\_{i=1}^{N}\frac{f(x\_i)}{p(x\_i)}]$$

$$\qquad \qquad \space \space \space \space = \frac{1}{N}E[\sum\_{i=1}^{N}\frac{f(x\_i)}{p(x\_i)}]\cdots(1)$$

$$ \qquad \qquad\qquad\quad= \frac{1}{N}N\int\frac{f(x)}{p(x)}p(x)dx\cdots(2)$$

$$ = \int f(x)dx \space \space$$
$$ = I\qquad\qquad \space$$

I wonder why the two equation, $(1)$ and $(2)$, are equal??

**Tags:** mathematics, physically-based, pbr, monte-carlo


---

## 1 answers

### Answer by username_1 on 2017-06-29. Score: 3 | Accepted answer

In Monte Carlo integration, the samples $x\_1, x\_2, \ldots x\_N$ are [independent, identically-distributed](https://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables) random variables. This implies they all have the same expectation value. The derived quantities $f(x\_i)/p(x\_i)$ also all have the same expectation value. So the expectation of a sum of $N$ of these is the same as $N$ times the expectation of any one of them:
$$E\left[ \sum\_{i=1}^N \frac{f(x\_i)}{p(x\_i)} \right] = N \cdot E\left[\frac{f(x\_1)}{p(x\_1)}\right]$$
(I picked $x\_1$ arbitrarily.)

Then, the expectation value of a continuous random variable is found by integrating over its probability measure:
$$E\left[\frac{f(x\_1)}{p(x\_1)}\right] = \int\_{\text{domain of }p(x)} \frac{f(x)}{p(x)} \, p(x) \, dx$$


---

