I am studying engineering and I am learning about the Monte Carlo integration which I find a bit hard to grasp the maths. I have watched a few videos and read some other notes and I feel I understand how it works but I stack to the maths.
In my notes $p(x)$ is defined as:
$p(x) = =\frac{w(x)}{ \int_{}^{} w(x) \,dx }$, where $w(x)$ is a weighting function.
Also, initially we assume uniform distribution over 'volume' V, $p(x) = \frac{1}{V}$
Up to this point is fine. What I understand is that since $x$ is a vector thus we are considering multidimensional spaces, then this makes up the volume and now equivalently as in 1D, the uniform distribution is $\frac{1}{V}$
Now in this step we try to calculate/approximate the integral of interest and I am lost a bit in the approximations done as well as where does $N$ come from and how both terms $p(x)$ disappear (see below)
$ \int_{}^{} h(x) \,dx = \int_{}^{} \frac{h(x)}{p(x)}p(x) \,dx \approx \frac{1}{N}\sum_{i=1}^{N} \frac{h(x^{(i)})}{p(x^{(i)})} = \frac{V}{N}\sum_{i=1}^{N} h(x^{(i)})$
My questions:
1)When approximating from integral to sum why one of the p(x) disappear and 1/N appears
Basically that's it because I can see why V appears after the second p(x) disappears.\
Sorry for the lengthy text for probably a simple thing but I cannot see what I am missing. Thank you!