**Finding the average distance in an equilateral triangle**

In the previous post I looked at the average distance between 2 points in a rectangle. In this post I will investigate the average distance between 2 randomly chosen points in an equilateral triangle.

**Drawing a sketch.**

The first step is to start with an equilateral triangle with sides 1. This is shown above. I sketched this using Geogebra – and used some basic Pythagoras to work out the coordinates of point C.

I can then draw a square of sides 1 around this triangle as shown above. I’m then going to run a Python program to randomly select points and then work out the distance between them – but I need to make sure that the 2 points chosen are both inside this triangle. For this I need to work out the equation of the line AC and CB.

Using basic coordinate geometry we can see that the line AC has equation y = √3x. We want the inequality y < √3x so that we are on the correct side of this line.

The line BC has equation y = -√3x + √3. Therefore the triangle must also satisfy the inequality y < -√3x + √3.

I can then run the following code on Python, with finds the average distance between points (a,c) and (b,d) both within the unit square but also subject to the 2 inequality constraints above.

When this is run it performs 999,999 trials and then finds the average distance. This returns the following value:

So we can see that the average distance is just over a third of a unit.

**Finding the average distance of an equilateral triangle of length n.**

We can then draw the sketch above to find the equation of lines AC and CB for an equilateral triangle with lengths n. This leads to the following inequalities:

y < √3x

y < -√3x + √3n

So we can then modify the code as follows:

This then returns the average distances for equilateral triangles of sizes 1 to 10.

And when we plot this on Desmos we can see that there is a linear relationship:

The regression line has gradient 0.36 (2sf) so we can hypothesise that for an equilateral triangle of size *n*, the average distance between 2 points is approximately 0.36*n*.

**Checking the maths**

I then checked the actual equation for the average distance between 2 points in an equilateral triangle of sides n:

This gives us:

So we can see that we were accurate to 2 significant figures. So this is a nice mixture of geometry, graphing and computational power to provide a result which would be otherwise extremely difficult to calculate.

### Like this:

Like Loading...

*Related*

## Leave a comment

Comments feed for this article