First Illustration of the Use of Monte-Carlo Methods, variance in integration

In addition to the average value \( \langle f \rangle \) the other important quantity in a Monte-Carlo calculation is the variance \( \sigma^2 \) and the standard deviation \( \sigma \). We define first the variance of the integral with \( f \) for a uniform distribution in the interval \( x \in [0,1] \) to be $$ \begin{equation*} \sigma^2_f=\sum_{i=1}^N(f(x_i)-\langle f\rangle)^2p(x_i), \end{equation*} $$ and inserting the uniform distribution this yields $$ \begin{equation*} \sigma^2_f=\frac{1}{N}\sum_{i=1}^Nf(x_i)^2- \left(\frac{1}{N}\sum_{i=1}^Nf(x_i)\right)^2, \end{equation*} $$ or $$ \begin{equation*} \sigma^2_f=\left(\langle f^2\rangle - \langle f \rangle^2\right). \end{equation*} $$