Monte Carlo Integration - determining if a random x,y coordinate falls within the circle or square My textbook says you can take any random (x,y )coordinate between -1 and 1  like (-.3, .5) or (.4, -.7) and determine if the given coordinate falls within the circle if you calculate $\sqrt(x^2+y^2)$ < 1.   
The part I don't understand is why are you testing the (x,y) coordinate against 1? What is the rationale behind squaring x and y and seeing if it is less than 1? How do you arrive at 1?
Also do you typically only use -1 and 1 when you're dealing with Monte Carlo integration or can you use -5 and 5 or -10 or 10 or any other numbers? 
 A: To use Monte Carlo to evaluate $I=\int_{[0,1]^n} f(x) dx_1...d x_n$ you take a sequence of independent random variables $x_k$ distributed uniformly on $[0,1]^n$ and compute $I_m = \frac{1}{m} (f(x_1)+\cdots + f(x_m))$. Under appropriate integrability assumptions we have $I_m \to I$ is some prescribed sense.
This is easily extended to deal with integrals of the form $I = \int_{[-M,M]^n} f(x) dx_1...d x_n$, in which case the relevant formula is easily shown to be $I_m = (2M)^n\frac{1}{m} (f(x_1)+\cdots + f(x_m))$, where the $x_k$ are independent random variables distributed uniformly on $[-M,M]^n$.
It is straightforward to generate uniform samples in $[-M,M]^n$.
Now suppose you want to evaluate $I=\int_A f(x) dx_1...d x_n$, where the set $A$ lies in some 'box', that is, $A \subset [-M,M]^n$. Note that $I = \int_{[-M,M]^n} f(x)1_A(x) dx_1...d x_n$, where $1_A$ is the indicator function for the set $A$. So you can use the above technique for integrating over a 'box', and modify the function you are integrating by multiplying by the indicator function of the set $A$.
I am guessing that you are trying to use Monte Carlo to evaluate something like $\int_C f(x) dx dy$, where $C=\{(x,y) | x^2+y^2 < 1 \}$. In this case, we take the box $[-1,1]^2$, generate points $x_k$ randomly in the box, and compute $f(x_k) 1_C (x_k)$, and sum the values appropriately to estimate the integral. The formula for $1_C$ is just $1_C(x) = \begin{cases} 1, & x^2+y^2 < 1 \\ 0, & \text{otherwise} \end{cases}$, which is what gives rise to the '1' above.
Note that you could have generated points in the box $[-10,10]^n$ instead, and applied the appropriate formula, the disadvantage is that it will more samples to get an equivalently accurate result.
A: The equation $\sqrt{x^2+y^2}<1$ is just the equation of a circle of radius one, and the box between $\pm 1$, is just a convenient bounding box who's area is known. This can be extended arbitrarily, for instance, to calculate the area of between the function $\sin x$ and the $x$ axis between $0$ and $\pi/2$, you can use a Monte Carlo method and generate points with $x \in [0,\pi/2]$ and $y \in [0,1]$. 
