Segments and Circles within a Circle


Problem 1 animation.                          Problem 2 animation.


Objective: To illustrate the technique of the Monte Carlo simulation approach to estimate probabilities for two geometrically oriented problems involving line segments and another circles within the unit circle.

Level: Algebra, precalculus, discrete math, courses involving elementary probability, or introductory programming courses.

Prerequisites: Familiarity circles, radius, distance between points, and midpoint of a line segment; elementary probability ideas; if used in a programming course, commands for random numbers, square roots, conditional statements, and loops; if graphics are included, parametric representation of a circle.

Platform: The animations included can be viewed with a variety of software. We also include Excel and MATLAB routines that illustrate geometric aspects of the two problems and provide Monte Carlo simulations for estimating probabilities.

Instructor's Notes:

We first state two problems in terms of the probability of making valid choices for points in a circle of radius 1 centered at the origin (often called a unit circle). Next we discuss how to use these problems with groups of students.

Assumption: Let A and B be two points within the unit circle.

Problem 1. Estimate the probability that the length of the segment from A to B is less than 1,
                     the radius of the unit circle.

Problem 2. Estimate the probability that a circle centered at the midpoint of the segment from
                     A to B with radius 1/2 the length of segment from A to B lies entirely within the unit

The two problems are independent of one another; that is, in Problem 2 it is not assumed that the length of the segment from A to B is less than 1.

With students we can should emphasize the algebraic and geometric concepts needed by anyone trying to solve either of the problems. This gives a real situation in which concepts play a roll for determination of a more complicated mathematical problem. The students can feel that they are participating in the solution process using mathematics to contribute to a team effort. Some of the tasks required to develop techniques to solve these problems are listed next.

(a) How do we check that a pair of points lie in the unit circle?

(b) How do we compute the length of the segment between two points?

(c) How do we find the midpoint of a line segment?

(d) How do we determine if a circle with radius 1/2 the length of segment from A to B lies entirely within the
      unit circle? 

Techniques for answering (a) and (b) are used in Problem 1, while solutions for (a) - (d) are required for Problem 2.


  • For (a): On the board or in a handout draw several unit circles with different choices for points A and B. (Specify the coordinates.) Choose some with both points inside the unit circle and others with 1 inside and the other outside, or both outside. Let the class experiment. Guide the class to get a well formulated criteria, then have them check things.
  • Tasks (b) and (c) are just are straight forward use of formulas that should be familiar or easily looked up.
  • For (d): Here is where some pictures will help, like those in Figures 1 and 2. Let students approximate the midpoint of the segments from A to B and then sketch a circle of radius 1/2 the distance from A to B centered at the midpoint. See Figures 3 and 4.

Figure 1.

Figure 2.

Figure 3.

Figure 4.

In diagrams like Figures 3 and 4 have students draw radii of the circles through points A and B. This may give them a feel for the idea discussed below. To see animations for drawing radii similar to situations depicted in Figures 3 and 4 click on the following:

                    Animation for Figure 3.     Animation for Figure 4.

Now we need a way to determine from measurements if all the points along the circumference of the circle through points A and B are entirely within the unit circle. Recall that all such points must be a distance less than 1 from the origin. It is not practical to check the distance from the origin to each point on the circle from A to B, there are just too many. Our focus is on the distance from the origin so an alternative is to imagine that we have a rod extending the origin to the midpoint of the segment from A to B (see the black segment in Figure 5) and a radius of the circle through A and B that pivot around the end of the rod. As the radius pivots about the end of the rod the circle through A and B is traced. Since all the points on the circle through A and B are a distance of 1/2 times the length of segment through A and B from the midpoint we can observe the following:

If the distance from the origin to the midpoint of the segment from A to B (namely the length of the rod) + the radius of the circle through A and B is less than 1, then entire circle through A and B is within the unit circle.

This is illustrated in Figure 5. Have students construct an algebraic test to determine if the circle through A and B lies within the unit circle.

Figure 5.

The level of experience of students can be used by an instructor to gage how much the instructor has to contribute to obtain algebraic expressions to answer (a) - (d). Before any programs can be constructed to estimate the probability of a success for either Problem 1 or Problem 2 the foundations indicated above must be established. With the appropriate algebraic ideas developed from the geometry models, beginning students in a programming course who have had some practice in constructing programs with loops should be able to generate code to estimate the probabilities involved. If graphics to illustrate the geometry of the two problems is to included, then a discussion of how to easily draw a circle should be included. For the unit circle, plotting the points (cos(t), sin(t)) as t goes from 0 to 2p will give the unit circle. To obtain a circle of radius R centered at (x,y), plot the points (x+Rcos(t), y+Rsin(t)) as t goes from 0 to 2p.

Software Available:

We have developed software that illustrates the geometry involved with each problem and implements the Monte Carlo technique to estimate the probabilities of a success for each problem in both Excel and MATLAB. Figures 6 and 7 show thumbnails of the screens for the Excel programs that illustrate geometry involved. Click on these figures to see the full screen. You can click on the figure label to either run or download the corresponding Excel files. Figure 6 corresponds to Problem 1 and Figure 7 corresponds to Problem 2.


Figure 6.                              Figure 7.

Figures 8 and 9 show thumbnails of Excel programs that estimate the probability of a success for Problems 1 and 2 respectively. In both routines the estimates for a variety of a number valid trials are displayed. You can click on the figure label to either run or download the corresponding Excel files.


Figure 8.                             Figure 9.

Each of the problems discussed in this demo can be used to illustrate the use of some basic mathematical topics that play a fundamental role in the estimation of the solution of problems that require advanced mathematics to "solve" exactly. Determination of the exact probabilities for these problem use techniques from probability that are beyond the intended scope of this demo. For information on the theoretical probability of a success for the two problems see the Auxiliary Resources below.

To download the MATLAB routines, which merge the graphics and estimation of t he probabilities of a success click here for a zipped file.

Auxiliary Resources:

1. A collection of other probability demos that use Monte Carlo simulation is available at . (This demo is part of the collection.) The other problems addressed in this collection are fairly simple to state, but the simulations are more complicated to construct. They accompanying software is visually appealing and can be used at a variety of levels.

2. Another demo which focuses on area estimation using Monte Carlo simulation is available at . The mathematical concepts that are modeled are more sophisticated than ideas in this demo.

3. The basic ideas for the two problems discussed in this demo appeared as problems in mathematics journals.

For Problem 1, see Problem 178 (proposed by Roger L. Creech) in The Two-Year College Mathematics Journal, 1980, vol. 11 No. 5, p.336; a solution appeared in The Two-Year College Mathematics Journal, 1982, vol. 13 No. 2, p.151.

For Problem 2, see the following related material; Problem 1092 (proposed by Roger L. Creech) in The Mathematics Magazine, 1980, vol. 53 No. 1, p.49; a solution appeared in Mathematics Magazine, 1981, vol. 54 No. 2, p.87.

A resource that discusses both of these problems and includes an analytic proof of probabilities of a success appears in an article by Joseph E. Chance and Pearl W. Brazier, "Two Problems That Illustrate the Techniques of Computer Simulation", Mathematics Teacher, 1986, Vol. 79, No. 9, pp.726 - 731. The exact answer for problem 1 is (1 - 3(3)1/2)/(4p) which is about 0.58650 and the exact answer for Problem 2 is 2/3.

4. A variation of Problem 2 is to require that the two points in the unit circle also be chosen so that the distance between them is less than 1. The Excel program or MATLAB program can be easily modified to estimate the probability of a success. A good question for students is, will the probability of a success in this case be larger or smaller than that for Problem 2?

5. For a brief history of the Monte Carlo method go to .


Credits:  This demo was developed by 

David R. Hill
Department of  Mathematics
Temple University

and is included in Demos with Positive Impact with his permission.


DRH 2/4/2006

Visitors since 2/4/2006