# sampling for estimation - using random numbers - homework help

I have a figure like so :

1) generate 100 samples of iid - 2D uniform random variables in the unit-square. 2) count how many samples generated fall within the quarter unit-circle centered at the origin.

What I've done so far:

approach 1 generate two vectors of random samples using runif in R.

samples_x(100)
samples_y(100)


and then I'm finding out if the area of the rectangle (samples_x * samples_y) is less than the area of the quarter circle

approach 2 generate two vectors of random samples using runif in R and then samples_x ^ 2 + samples_y ^ 2 is less than or equal to radius square (1).

Is either train of thought correct?

• use these samples generated to estimate the area of the inscribed quarter circle.
• use the estimated area to estimate the value of pi.

Which I have no idea as to how to solve. I've been looking at estimation of population but it's mostly count the samples in a small area and divide by the total area.

By that method, would that mean I should estimate using samples falling within the circle and divide by 100 to estimate area?

any pointers, help ,suggestions, opinions? much appreciated.

Some hints for the rest. The proportion of points that are in the square (all the random points you generate) than are also in the circle is equal to the ratio of their areas (since the area of the square is 1, this is simple) so you should see $p = \pi/4$ where $p$ is the proportion of your points falling in the circle. You can check to see if you are approximately correct using a known approximation of $\pi$. What the question wants you to do now is pretend you don't know $\pi$ and use your proportion, the formula above, and a little bit of algebra to estimate the value of $\pi$.