# Needle, thread and pi

This post will help you get out of a rather delicate situation. Let's say you are locked in a room, you have a skein of thread and a needle, and you are urged to calculate the approximate value of the

In order not to spoil the intrigue, let's start with the experiment. So, we have many needles of length

Throw 100 needles on this field.

Perhaps not enough. Add 900 more and mark the needles that cross the threads in red.

Suppose we threw not all the needles at once, but one at a time, and recorded at each step the ratio of the number of needles that fell on the threads to the total number of thrown needles, thereby obtaining a larger and larger approximation of the probability that the needle would fall and cross the thread .

If you drop 10,000 needles, the picture will be more accurate.

And now we will do the following transformation: divide the deuce by each number of the resulting series.

For 10,000 needles already more accurate.

If we find the average of the last five thousand members of the series, we get

In general, it is no secret to anyone that the last row converges to

We will consider the needle and the line closest to it to the right. The distance from the left end of the needle is denoted by

Obviously, the length of the opposite leg from the angle

Let's draw a graph: If we count

Thus, the probability that the needle crosses the thread will be equal to the ratio of the area of the figure under the graph to the area of the rectangle, that is,

From this the desired approximation of the

**Pi**number using only these objects, well, anything can happen, you know. So, today, listening to a course on the matan of the University of Pennsylvania on a cursor , I suddenly found out how to do this. That’s what I couldn’t guess, because the**Pi**number is hiding here. It turned out that the roots of this issue date back to the 18th century, when Georges-Louis Leclerc de Buffon set himself the following task: “Suppose the floor is made of wooden strips of two colors, they alternate; what is the likelihood that the thrown needle will fall so that it crosses the line of joining of two strips? ”Simulation of this process and the answer to the question can be found under the cut.#### Simulation

In order not to spoil the intrigue, let's start with the experiment. So, we have many needles of length

**L**and a skein of green thread. We apply to the surface a number of parallel segments of the same length at a distance**L**from each other.Throw 100 needles on this field.

Perhaps not enough. Add 900 more and mark the needles that cross the threads in red.

Suppose we threw not all the needles at once, but one at a time, and recorded at each step the ratio of the number of needles that fell on the threads to the total number of thrown needles, thereby obtaining a larger and larger approximation of the probability that the needle would fall and cross the thread .

If you drop 10,000 needles, the picture will be more accurate.

And now we will do the following transformation: divide the deuce by each number of the resulting series.

For 10,000 needles already more accurate.

If we find the average of the last five thousand members of the series, we get

**3.141685**, while the number pi is**3.141593**.In general, it is no secret to anyone that the last row converges to

**Pi**. But how could this happen? I learned about this at the age of 28 from the aforementioned course. We will plunge into matan.#### Theory

We will consider the needle and the line closest to it to the right. The distance from the left end of the needle is denoted by

**h**, the angle of deviation from the line is**a**.Obviously, the length of the opposite leg from the angle

**a**will be equal to the sine of the angle times the length of the hypotenuse. Then we can say that if**h is**less than or equal to the leg opposite the angle**a**, then the needle crosses the thread.Let's draw a graph: If we count

**h**and**a**for each thrown needle and mark these points on the previous graph, then the picture will be as follows:Thus, the probability that the needle crosses the thread will be equal to the ratio of the area of the figure under the graph to the area of the rectangle, that is,

**Pi**times the length of the needle.From this the desired approximation of the

**Pi**number is obtained , which was shown by the experiment in the first part.