I have a figure like so :enter image description here

Now the question asks to

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.


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?

3) the question asks later,

  • 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.


Since this is homework you should also include the "self study" tag.

Your approach 2 is correct, approach 1 is not correct.

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$.

  • $\begingroup$ yes, I did this. And then I notice that with increasing trials, the estimated value of pi converges to a number close to 3.14 .Helps to get ideas validated. Thank you. Also, a question. why would the approach 1 be wrong ? Any elucidation? $\endgroup$ – Raaj Feb 20 '14 at 4:53
  • $\begingroup$ @Raaj, for approach 1 consider the point (0.71,0.71), is it in the quarter circle? what does approach 1 say? $\endgroup$ – Greg Snow Feb 20 '14 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.