Sometimes we all just want to take a day off, be it from work or school. In the classic 1980s movie “Ferris Bueller’s Day Off”, which is celebrating its 30th anniversary, the title character spent his day off gallivanting around Chicago, seeing the sights and even hijacking a parade. Unlike the super-confident Ferris, most of us would probably worry about getting caught if we skived off like that. But is that fear really justified?

We can use a neat mathematical tool known as the “random walk” to answer this question by modelling a day off in a city. This simple but extremely powerful technique is a way of simulating the path of someone or something to see where they end up. As the name suggests, a random walk involves moving in an entirely random direction to a new location and repeating this process once you arrive (and so on).

It is used in all manner of fields. Physicists use it to describe diffusion, the random spreading out of highly concentrated molecules in liquids and gases. But it can also be used in the financial forecasting of stock prices. It’s even how Twitter suggests who you should follow.

In the film, Ferris has four people who could ruin his day of fun and even possibly stop him graduating from High School – his mum, dad, sister and the school dean, Mr Rooney. We can describe the path of each of these characters as a random walk and model how likely is it that Ferris will bump into any of them during the day.

We can work out how long it takes on average for two random walks to land on the same spot, as long as we know where everyone started. To do this, we multiply the time it takes to walk one block by the square of the number of blocks the two characters were separated by to begin with.

What are the chances?

To give you the best chance possible, you’d want to start on opposite corners of the city. In the case of Chicago, which is arranged in a regular grid of 31×41 blocks, this puts you 72 blocks away with each block taking just under two minutes to walk. Since Ferris has four people to avoid, we need to divide our answer by four, giving us an average time of 43 hours 12 minutes before he is caught by one of his pursuers.

Does this mean Ferris would always get off scot-free, and so that you could bunk off work or school without any worries? Not quite. While the average time to get busted is large, each particular random walk will take a different route and so it may take more or less time before being caught.

To get a clearer picture, I ran a random walk computer simulation modelling Ferris’s day off 10,000 times. The maximum chance of Ferris getting caught during was a mere 20% and that’s only when his foils are randomly placed across the city at the start, otherwise the probability is much smaller.

But there’s a neat little mathematical proof telling us that if you as the quarry know where the hunters at each time, then you could strategically avoid them in a city the size of Chicago for up to 1,165 years. With friend-tracker apps on phones these days, that’s not such a ludicrous concept.

In a large enough city, the chances of you getting caught taking a day off are pretty slim. The one thing you really do need to be is a good liar. Luckily for Ferris, he was the master.