You are currently browsing the tag archive for the ‘distance between 2 points on a square’ tag.

**Find the average distance between 2 points on a square**

This is another excellent mathematical puzzle from the MindYourDecisions youtube channel. I like to try these without looking at the answer – and then to see how far I get. This one is pretty difficult (and the actual solution exceptionally difficult!) The problem is to take a square and randomly choose 2 points somewhere inside. If you calculate the distance between the 2 points, then do this trial approaching an infinite number of times what will the average distance be? Here is what I did.

**Simplify the situation: 1×1 square**

This is one of the most important strategies in tackling difficult maths problems. You simplify in order to gain an understanding of the underlying problem and possibly either develop strategies or notice patterns. So, I started with a unit square and only considered the vertices. We can then list all the possible lengths:

We can then find the average length by simply doing:

**2×2 square**

We can then follow the same method for a 2×2 square. This gives:

Which gives an average of:

**Back to a 1×1 square**

Now, we can imagine that we have a 1 x 1 square with dots at every 0.5. This is simply a scaled version of the 2×2 square, so we can divide our answer by 2 to give:

**3×3 square**

Following the same method we have:

This gives an average of:

and if we imagine a 1×1 square with dots at every 1/3. This is simply a scaled version of the 3×3 square, so we can divide our answer by 3 to give:

We can then investigate what happens as we consider more and more dots inside our 1×1 square. When we have considered an infinite number then we will have our average distance – so we are looking the limit to infinity. This suggests using a graph. First I calculated a few more terms in the sequence:

Then I plotted this on Desmos. The points looked like they fit either an exponential or a reciprocal function – both which have asymptotes, so I tried both. The reciprocal function fit with an R squared value of 1. This is a perfect fit so I will use that.

This was plotted using the regression line:

And we can find the equation of the horizontal asymptote by seeing what happens when x approaches infinity. This will give a/c. Using the values provided by Desmos’ regression I got 0.515004887. Because I have been using approximate answers throughout I’ll take this as 0.52 (2sf). **Therefore I predict that the average distance between 2 points in a 1×1 square will be approximately 0.52**. And more generally, the average distance in an n x n square will be 0.52(n). This is somewhat surprising as a result – it’s not obvious why it would be a little over half the distance from 0 to 1.

**Brute forcing using Python**

We can also write a quick code to approximate this answer using Python (This is a Monte Carlo method). I generate 4 random numbers to represent the 2 x-coordinates and 2-y coordinates of 2 random points. I then work out the distance between them and repeat this 10 million times, then calculate the average distance. This gives:

**Checking with the actual answer**

Now for the moment of truth – and we watch the video to find out how accurate this is. The correct answer is indeed 0.52 (2sf) – which is great – our method worked! The exact answer is given by:

Our graphical answer is not quite accurate enough to 3 sf – probably because we relied on rounded values to plot our regression line. Our Python method with 10 million trials was accurate to 4 sf. Just to keep my computer on its toes I also calculated this with 100 million trials. This gave 0.5214126210834646 (now accurate to 5 sf).

We can also find the percentage error when using our graphical method. This is only:

Overall this is a decent result! If you are feeling *extremely* brave you might want to look at the video to see how to do this using calculus.

**Extension: The average distance between 2 points in a unit circle**

I modified the Python code slightly to now calculate the average distance between 2 points in a unit circle. This code is:

which returns an answer of 0.9054134561871364. I then looked up what the exact answer is. For the unit circle it is 128/(45 pi). This is approximately 0.9054147874. We can see that our computer method was accurate to 5 sf here. Again, the actual mathematical proof is extremely difficult.

**Reflection**

This is a nice example of important skills and techniques useful in mathematics – simplification of a problem, noticing patterns, graphical methods, computational power and perseverance!

Essential resources for IB students:

Revision Village has been put together to help IB students with topic revision both for during the course and for the end of Year 12 school exams and Year 13 final exams. I would strongly recommend students use this as a resource during the course (not just for final revision in Y13!) There are specific resources for HL and SL students for both Analysis and Applications.

There is a comprehensive Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and then provides a large bank of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to a large number of ready made quizzes, exams and predicted papers. These all have worked solutions and allow you to focus on specific topics or start general revision. This also has some excellent challenging questions for those students aiming for 6s and 7s.

Each course also has a dedicated video tutorial section which provides 5-15 minute tutorial videos on every single syllabus part – handily sorted into topic categories.

2) Exploration Guides and Paper 3 Resources

I’ve put together four comprehensive pdf guides to help students prepare for their exploration coursework and Paper 3 investigations. The exploration guides talk through the marking criteria, common student mistakes, excellent ideas for explorations, technology advice, modeling methods and a variety of statistical techniques with detailed explanations. I’ve also made 17 full investigation questions which are also excellent starting points for explorations. The Exploration Guides can be downloaded here and the Paper 3 Questions can be downloaded here.