<p>I don't have that book to check the context of this, but from the equations you posted, yes, it looks like you're right. The $1/N$ factor should be applied to both terms. That agrees with the formula for variance from statistics, which is $E[X^2] - E[X]^2$.</p>

CC BY-SA 3.0
2017-06-10T21:43:46.077Z
2017-06-10T21:43:46.077Z
Nathan Reed
<p>I was wondering about the variance for Monte Carlo.
The book (Advanced Global Illumination 2ed, p.60) writes the equation as follows:</p>

<p>$\sigma^2 = \frac{1}{N} \int(\frac{f(x)}{p(x)} - I)^2p(x)dx$</p>

<p>$\space\space\space\space=\color{red}{\frac{1}{N} \int(\frac{f(x)}{p(x)})^2p(x)dx  -I^2}$</p>

<p>$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)}dx  -I^2$</p>

<p>However, the equation appears incorrect. I think the red area is wrong and the equation should be changed as follows:</p>

<p>$\sigma^2 = \frac{1}{N} \int(\frac{f(x)}{p(x)} - I)^2p(x)dx$</p>

<p>$\space\space\space\space=\color{red}{\frac{1}{N} \int((\frac{f(x)}{p(x)})^2 -2\frac{f(x)}{p(x)}I + I^2)p(x)dx}$</p>

<p>$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)} - 2f(x)I + I^2p(x)dx$</p>

<p>$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)} - 2f(x)I dx \space + \frac{1}{N}I^2$</p>

<p>$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)} dx - \frac{2}{N}I^2 \space + \frac{1}{N}I^2$</p>

<p>$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)} dx - \frac{1}{N}I^2$</p>

<p>Is it right?</p>

<global-illumination><monte-carlo><mathematics>
The variance for the Monte Carlo estimator
shashack
# The variance for the Monte Carlo estimator

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

I was wondering about the variance for Monte Carlo.
The book (Advanced Global Illumination 2ed, p.60) writes the equation as follows:

$\sigma^2 = \frac{1}{N} \int(\frac{f(x)}{p(x)} - I)^2p(x)dx$

$\space\space\space\space=\color{red}{\frac{1}{N} \int(\frac{f(x)}{p(x)})^2p(x)dx -I^2}$

$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)}dx -I^2$

However, the equation appears incorrect. I think the red area is wrong and the equation should be changed as follows:

$\sigma^2 = \frac{1}{N} \int(\frac{f(x)}{p(x)} - I)^2p(x)dx$

$\space\space\space\space=\color{red}{\frac{1}{N} \int((\frac{f(x)}{p(x)})^2 -2\frac{f(x)}{p(x)}I + I^2)p(x)dx}$

$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)} - 2f(x)I + I^2p(x)dx$

$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)} - 2f(x)I dx \space + \frac{1}{N}I^2$

$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)} dx - \frac{2}{N}I^2 \space + \frac{1}{N}I^2$

$\space\space\space\space=\frac{1}{N} \int\frac{f(x)^2}{p(x)} dx - \frac{1}{N}I^2$

Is it right?

**Tags:** global-illumination, monte-carlo, mathematics


---

## 1 answers

### Answer by username_1 on 2017-06-10. Score: 4 | Accepted answer

I don't have that book to check the context of this, but from the equations you posted, yes, it looks like you're right. The $1/N$ factor should be applied to both terms. That agrees with the formula for variance from statistics, which is $E[X^2] - E[X]^2$.


---

