# While simulating the value of a double integral , why do we need to draw different samples everytime?

Suppose I want to simulate the value of the integral $$\int_{0}^{1} \int_{2}^{3} 2xy \ dx dy$$ using Monte Carlo methods.

So, now, I draw a random sample from $$U_1,U_2,...,U_n$$ from $$U(0,1)$$ and for each $$i \in [1,n]$$, I take $$X_i =U_i+2$$. So, now, I get a random sample of $$X_i$$'s from $$U(2,3)$$.

Again I take another sample $$Y_1,Y_2,...,Y_n$$ from $$U(0,1)$$.

So, by WLLN, I calculate the mean of $$2X_iY_i$$ defined over the space $$[0,1] \times [2,3]$$ to get the estimate.

My question is do we always need to draw another sample for $$Y_1,Y_2,..,Y_n$$?

That is, if I had taken $$Y_i=U_i$$ , i.e. the initial drawn sample what would go wrong?

I get it that if I don't draw a fresh sample, then $$X_i, Y_i$$'s are not independent. But do we at all require independence of $$X_i,Y_i$$ here?

First, let me point out [somewhat pedantly!] that one does not simulate the value of the integral since this is a fixed number.

Second, if using the same $$U_i$$'s for simulating $$X_i$$ and $$Y_i$$, as e.g. $$Y_i=U_i$$ and $$X_i=U_i+1$$, the functional dependence between these two rvs modifies the value of the integral $$\int_0^1\int_2^3 2xy\text{d}x\text{d}y=x^2|_0^1 y^2/2|_2^3=5/2$$ versus $$\int_0^1 2x(x+2)\text{d}x=2x^2/3+2x^2|^1_0=5/2=8/3$$ as can be checked by simulation

  > y=runif(1e7)
> x=y+2
> print(mean(2*x*y))
[1] 2.667504 #8/3
> x=runif(1e7)
> print(mean(2*x*y))
[1] 2.500612 #5/2


The simulation of the points $$(X_i,Y_i)$$'s in $$(0,1)\times(2,3)$$ need mimick a Uniform generation over the unit square. They may be dependent in $$i$$ but not between $$X_i$$ and $$Y_i$$ since this modifies the joint distribution. An alternative is to simulate directly $$2X_iY_i$$.