With this definition of a random variable and its associated PDF, we attempt now a clarification of the Monte-Carlo strategy by using the evaluation of an integral as our example.
In discussion on numerical integration we went through standard methods for evaluating an integral like $$ \begin{equation*} I=\int_0^1 f(x)dx\approx \sum_{i=1}^N\omega_if(x_i), \end{equation*} $$ where \( \omega_i \) are the weights determined by the specific integration method (like Simpson's method) with \( x_i \) the given mesh points. To give you a feeling of how we are to evaluate the above integral using Monte-Carlo, we employ here the crudest possible approach. Later on we will present slightly more refined approaches. This crude approach consists in setting all weights equal 1, \( \omega_i=1 \). That corresponds to the rectangle method $$ \begin{equation*} I=\int_a^bf(x) dx \approx h\sum_{i=1}^N f(x_{i-1/2}), \end{equation*} $$ where \( f(x_{i-1/2}) \) is the midpoint value of \( f \) for a given value \( x_{i-1/2} \).