CS(4) Hit or Miss Method

The Bounding Rectangle

Carla Martins
4 min readNov 13, 2024

The Hit or Miss Method is another approach for estimating the area under a curve using Monte Carlo simulation. It generates random points within a bounding rectangle that encloses the area of interest. Then, we count how many points fall below the curve versus how many fall outside. The proportion of points that hit below the curve can be used to estimate the area.

This approach is particularly visual, as it involves ‘throwing’ points at a region and seeing how many fall under the curve (hits) or outside (misses).

Steps of the Hit or Miss Method

  1. Define a rectangle that bounds the curve (e.g. over the interval [a,b] and up to a maximum height).
  2. Generate random points uniformly within this rectangle.
  3. Count the number of points that fall below the curve.
  4. Use the proportion of points below the curve to estimate the area.

If we want to estimate the area under

from x=0 to x=1, we first define a bounding rectangle that spans from x=0 to x=1 and from y=0 to y=1 (since the function is equal or less than 1 in this interval). The area of the bounding rectangle is simply the width times height, which is 1x1=1.

--

--

Carla Martins
Carla Martins

Written by Carla Martins

Compulsive learner. Passionate about technology. Speaks C, R, Python, SQL, Haskell, Java and LaTeX. Interested in creating solutions.

No responses yet