Evaluate the area of a circle of radius $1= \pi$ using Monte Carlo method . Hence we can generate pairs of random numbers $(x_i,y_i) \in [-1,1]$.
Thus :
$$ \pi= \frac {Number Of Samples Inside The Circle}{Total Number Of Samples} X 4 $$
Consider a unit circle inscribed in a square, each of the small circles drawn on this figure represents a random point that was generated in the square, the red and blue circles represent points inside and outside the unit circle respectively (I got the figure from google) . If we choose a point uniformaly at random within the square, then the probability that the point lies in the unit circle is
$$ \pi= \frac {Number Of Samples Inside The Circle}{Total Number Of Samples} $$
We know that the area of the circumscribed square is $4$, if we knew $p$, then we could compute the area of the unit circle:
Area of the unit circle = $p$ x area of the circumscribed square = $4p$
How to Estimate $\pi$ using the Monte Carlo Method in MATLAB, then what's the error a quarter of a circle ?

