While mobile phones have all but eradicated the fine art of getting lost, there are still times where they may prove useless. With the summer music festival season upon us, you may find yourself in such a situation before too long. Consider the following scenario: you’re at Glastonbury with a group of friends. You’re all enjoying a performance by Beck or PJ Harvey, but then you feel the call of nature, or a pang of hunger. You head off to the toilets, or go grab a burger and a beer, trusting that your friends will be in the same spot when you get back.

On your return, however, you discover that maybe your friends aren’t as patient as you had hoped, or perhaps you’ve had one too many beers and your memory of where they were isn’t quite as good as you previously thought. The bottom line: you’re lost. You reach for your phone but, two days in, it’s out of battery. What do you do? Stripped of technological support, you settle for what you deem to be the next best strategy: you wander aimlessly around, in the hope that you and your friends will, by chance, find each other. That is until a worrying thought crosses your mind: “What if we’re just chasing each other’s tails? Maybe I’d be better off staying put, keeping an eye out, and they’ll find me before too long.” So, which strategy should you adopt if you’re going to find your friends as quickly as possible?

My preferred method of verifying this would be with real-life experiments, attending festival after festival, gathering data until a winner emerged. Unfortunately, life as a poor PhD student has ruled out that possibility so instead I’ve settled for comparing the strategies through computer simulations. This will involve some simplifications, laid out below:

• The festival you are attending is being held in grounds that are square, sized according to the number of steps it would take to walk the length (or width) of the area. (I see no reason why a rectangle should alter the problem, but other shapes may present alternative strategies which I don’t wish to consider.) Of course, festival grounds come in all shapes and sizes – especially if you factor in multiple stages and camping areas – so this might seem somewhat unrealistic. But each stage area at a festival tends to be bordered by beer tents, food trucks and merchandise stalls, creating a reasonably square-like shape.
• You and your friends (simulated, for simplicity, as a single friend) are free to move anywhere within the boundary of the festival grounds; there are no obstacles.
• You don’t know where your friend is; your friend doesn’t know where you are: any spot within the grounds is as likely as any other. As such, the only strategies are ‘move’ or ‘stand still’, not ‘wait by the burger van’.
• You, once moving, will continue moving until you and your friend are reunited. Your friend always moves. This eliminates a major flaw in the ‘stay put’ strategy wherein if your friend also stays put, then you will never find each other. In real life, though, depending on how concerned you believe your friend is with finding you, this may be an important consideration.

Within these confines I then set up some code in R (a statistical programming language) to simulate these situations as follows:

• You and your friend begin at random points within the grounds of the festival, each facing a random direction.
• You each move in your given direction at the same constant speed.
• On average you each change direction approximately five per cent of the time (more on this later), unless you meet a boundary, at which point you will change direction.
• You each change direction independently of each other.
• If you and your friend come within 15 steps of each other you have found each other, regardless of the direction you are facing; you can’t rule out walking around shouting each other’s names.
• The simulation stops when your friend has “found” both you and your original starting point, corresponding to the ‘stay put’ strategy.
• The number of steps taken for each of these events is recorded.

I ran this simulation 100,000 times each for different festival grounds. For the sake of getting results in a reasonable timeframe, I restricted the number of steps you and your friend would take in finding each other to 100,000. Assuming you each take one step every second, 100,000 steps is roughly equivalent to spending 27 hours trying to find your friend, and walking over 130 km at an average walking pace of 5 km/h – an unreasonable amount of time and effort to expend in finding someone, least of all at a weekend-long music festival. Nevertheless, in my simulation, at larger festival grounds there are cases where you and your friend unfortunately fail to reunite within the allotted time (typically affecting under 1% of cases). Therefore, to prevent the results from being unduly influenced by these cases, I considered the median time to reunion as measured by number of steps taken (at the aforementioned rate of one step per second). The results are presented in Figure 1. It’s clear that in all cases you would be better served by moving rather than standing still. In the largest of the festival grounds the difference means you could be waiting 50% longer to be reunited with your friends by adopting the ‘stay put’ strategy.

Figure 1. Median number of steps taken to find your friend for different boundary sizes. Number of steps is equivalent to number of seconds, and boundary size is measured by the number of steps it would take to walk the length of the festival grounds

Figure 2 shows the distribution of the steps taken to find each other for a boundary size of 200 steps. A log transformation is taken here to mitigate the effect of the positive skew in the data. The first peak relates to cases where you and your friend start the search within 15 steps of each other – which is the threshold for finding each other. Overall, it can be seen that the ‘stay put’ strategy tends to result in a greater number of steps to find your friend.

Figure 2. Distribution of the log number of steps taken to find your friend under the two strategies

I’ve set up a tool that allows you to look at this simulation for yourself. You can alter the variables: the size of the festival grounds; how close you need to be to your friend before you find each other; and the probability of each of you changing directions. The tool will then simulate the paths of you and your friend and report the time it takes you to find each other under the ‘stay’ and ‘move’ strategies. In this tool the maximum number of steps which can be taken is 2,000 – a limit imposed arbitrarily so that (a) the simulation doesn’t take too long to run; and (b) it doesn’t run up against any memory allocation limits in the app platform.

Based on this simulation, we know you’re better off moving and trying to find your friend, but we have no control over the strategy your friend decides to follow (unless you agree a strategy in advance). If your friend decides to stay put rather than move about in search of you, is there anything you can do to help decrease the time you spend looking for each other?

You’ll recall that in setting up the simulation I mentioned an assumption that you and your friend would each change direction approximately five per cent of the time? I describe this as a reasonably composed search, in the sense that neither party is frantically changing directions. I wanted to see how a change in this measure of ‘composure’ would affect your chances of finding your friend. Again, I ran the simulation 100,000 times, this time for a fixed festival ground size (100 steps), while varying how frequently you change directions. I assume that you always move, but your friend may or may not. In the event that they do move, however, they maintain the cool head they did previously, changing their direction on average five per cent of the time. I examined the impact of conducting a composed search of the festival grounds, with the probability of changing direction set to 0. Under this scenario, you would only change direction when you reach a boundary, and the direction change at the boundary would be random. I then compared this to a totally erratic search, where the probability of changing direction is 1 – meaning you change direction every step – and looked at the median time to reunion, as shown in Figure 3.

Figure 3. Median number of steps taken to find your friend as your probability of changing direction changes, in the case where your friend moves and stays. Number of steps is equivalent to number of seconds

The benefit of keeping your composure in the search for your friend is clear. In the case where you both decide to move, the totally erratic search takes 50% longer to reunite you as compared to the composed search. However, this difference pales into insignificance when we see what happens if your friend decides not to move. With a median time to reunion of 3,284 steps, moving erratically will cause you to spend more than 10 times as long searching for your friend than you would had you maintained your composure (257 steps). Again assuming you walk approximately one step per second, this could be the difference between spending five minutes looking for each other or wasting almost an hour. This difference makes intuitive sense: if you’re changing directions every step then you’re likely to spend much more time treading over the same ground, and if your friend decides not to move at all then, effectively, you have two people trying to find each other by standing still.

In conclusion, if you’re lucky enough to be at a music festival this summer, and unlucky enough to find yourself stranded like this, you can do yourself a favour by keeping a cool head and actively trying to find your friends. You can improve your odds even further by ensuring your friends know how best to find you too.

• Nathan Cunningham is a PhD student from Ireland, currently studying in the Oxford-Warwick statistics programme (OxWaSP). Previously he studied Economics & Finance at University College Dublin (UCD), graduating in 2011, before completing a Master’s degree in Statistics at UCD in 2012. Before starting his PhD he worked as a data analyst with the Economic and Social Research Institute in Dublin. He was a finalist in the 2014 Young Statisticians Writing Competition, jointly organised by Significance and the Young Statisticians Section of the Royal Statistical Society.

Significance Magazine