Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Geometrical Probability | Basic Concepts of Probability Theory
Probability Theory Basics

Geometrical ProbabilityGeometrical Probability

In the previous chapter, we considered the classic rule for counting probabilities. Due to this rule, the probability is calculated as the ratio of the number of outcomes of interest to us to the number of all possible outcomes. But what can we do if the number of outcomes cannot be counted?
For example, assume you are randomly shooting at a target and you want to determine the probability of hitting the center area of this target.

In this case, you can’t just count all the possible outcomes because number of points that you can hit is infinite. As a result, we will have to use geometric probability.
The principle of calculating geometric probabilities is similar to the classical rule - we still assume that all possible elementary outcomes of the experiment are equally probable, but instead of counting the number of outcomes, we consider their geometric measure.

The geometric measure is determined based on the dimension of the space of elementary events:

  • if the space is one-dimensional (line), then the length of the line is used as a measure;
  • if two-dimensional (plane), then the area of the figure on the plane is used as a measure;
  • if three-dimensional (a figure in space), then we use volume as a measure.

Thus, to solve the problem with a target, we can use the ratio of the areas of the area of interest to us and the entire target. Suppose the entire target is a circle with a radius of 2 and the region of interest is a circle in the center with a radius of 1. Then the probability of hitting the central region can be found as follows:

Code Description
  1. Two variables, r_large and r_small, are defined to represent the radii of the larger and smaller circles, respectively.
  2. The areas of the circles are calculated using the formula np.pi * radius**2, where np.pi represents the mathematical constant pi.
  3. The probability is computed by dividing the area of the smaller circle by the area of the larger circle.
  4. Then we are visualizing the results:
    • Two circle patches are created using plt.Circle(), representing the larger and smaller circles. They are added to the axis object using ax.add_artist().
    • The aspect ratio of the plot is set to 'equal' using ax.set_aspect('equal'), ensuring that the circles appear circular.
    • The limits of the x and y axes are adjusted using ax.set_xlim() and ax.set_ylim() to include the circles.
    • Labels for the x and y axes, a title for the plot, and a legend for the circles are set using ax.set_xlabel(), ax.set_ylabel(), ax.set_title(), and plt.legend().
    • Grid lines are enabled using plt.grid(True).
    • The plot is displayed using plt.show().
  5. Finally, the calculated probability is printed with 4 decimal places using f-string formatting.

Everything was clear?

Section 1. Chapter 3
course content

Course Content

Probability Theory Basics

Geometrical ProbabilityGeometrical Probability

In the previous chapter, we considered the classic rule for counting probabilities. Due to this rule, the probability is calculated as the ratio of the number of outcomes of interest to us to the number of all possible outcomes. But what can we do if the number of outcomes cannot be counted?
For example, assume you are randomly shooting at a target and you want to determine the probability of hitting the center area of this target.

In this case, you can’t just count all the possible outcomes because number of points that you can hit is infinite. As a result, we will have to use geometric probability.
The principle of calculating geometric probabilities is similar to the classical rule - we still assume that all possible elementary outcomes of the experiment are equally probable, but instead of counting the number of outcomes, we consider their geometric measure.

The geometric measure is determined based on the dimension of the space of elementary events:

  • if the space is one-dimensional (line), then the length of the line is used as a measure;
  • if two-dimensional (plane), then the area of the figure on the plane is used as a measure;
  • if three-dimensional (a figure in space), then we use volume as a measure.

Thus, to solve the problem with a target, we can use the ratio of the areas of the area of interest to us and the entire target. Suppose the entire target is a circle with a radius of 2 and the region of interest is a circle in the center with a radius of 1. Then the probability of hitting the central region can be found as follows:

Code Description
  1. Two variables, r_large and r_small, are defined to represent the radii of the larger and smaller circles, respectively.
  2. The areas of the circles are calculated using the formula np.pi * radius**2, where np.pi represents the mathematical constant pi.
  3. The probability is computed by dividing the area of the smaller circle by the area of the larger circle.
  4. Then we are visualizing the results:
    • Two circle patches are created using plt.Circle(), representing the larger and smaller circles. They are added to the axis object using ax.add_artist().
    • The aspect ratio of the plot is set to 'equal' using ax.set_aspect('equal'), ensuring that the circles appear circular.
    • The limits of the x and y axes are adjusted using ax.set_xlim() and ax.set_ylim() to include the circles.
    • Labels for the x and y axes, a title for the plot, and a legend for the circles are set using ax.set_xlabel(), ax.set_ylabel(), ax.set_title(), and plt.legend().
    • Grid lines are enabled using plt.grid(True).
    • The plot is displayed using plt.show().
  5. Finally, the calculated probability is printed with 4 decimal places using f-string formatting.

Everything was clear?

Section 1. Chapter 3
some-alt