The warmth on your face, the scenic view outside – such delights are delivered to you by countless photons from the sun. But believe it or not, these photons move in much the same way as an inebriated person wandering home from the pub, or the initial whiff of coffee as you open a bag of beans.

Let me explain.

Travelling at the fastest speed known to physics, these photons crossed from the sun to the Earth in a mere nine minutes. In contrast, the first 0.05% of the journey – just from the sun's core up to its surface – lasted almost ten thousand million times as long, taking an average of 170,000 years to complete.

Why? Unlike the freedom of (almost) empty space, the interior of the sun is a crowded place indeed; so crowded that a photon at the speed of light can only cross about a millimetre of space before bumping into one of the sun's atoms, where it is absorbed and then ejected again after a moment's delay.

The photon struggles toward the surface as it is absorbed by atom after atom and spat out in a random direction each time, drifting along an aimless path until it finally manages to burst free of the sun.

Our knowledge of this extraordinary journey owes much to the modern mathematical theory of random walks, which allows us to extract predictable behaviours out of such random physical processes.

**Discrete random walks**

The simplest type of random motion is a discrete one-dimensional random walk, in which the walker only moves back and forth along one particular direction (with the same-sized steps). If we keep track of our progress of eight such walks over the course of 100 steps, we might end up with the following graphs:

It's tempting to think that we ought to hover around our starting point, since at every step we're just as likely to move north as we are south. However, most of the random walks above have actually drifted a little bit away from the origin. In these cases, would we keep on drifting if we went further still?

The mathematics of random walks contains an interesting insight known as the level-crossing phenomena (also known as the gambler's ruin, due to its implications). It turns out that if it's allowed to go on forever, a simple random walk will cross every point infinitely many times. So yes, we are guaranteed to return to our starting point – eventually.

Apart from their established role as models of stock prices, one dimensional random walks are also familiar to tennis fans. Whenever a score of deuce (40-40) occurs, one of the players is required to score two consecutive points before the game is awarded.

Thus we enter a situation similar to a random walk, where the advantage moves back and forth between the players until it manages to get two steps away from deuce. Likewise for the fifth set at a Grand Slam tournament.

**Non-discrete drunken walks**

Two-dimensional random walks are often illustrated by considering the walk of a tipsy pub patron on their way home.

Perhaps they are more than a little tipsy; they might take two steps forward and then abruptly lurch to the right, before stepping left and stumbling onwards in a discrete two-dimensional random walk (the steps are still the same size, but now the walker can move randomly on a two-dimensional grid).

These types of random walks (and their higher-dimensional counterparts) are the basis on which nearly all random activity is modelled – from the wanderings of foraging animals to the twists and turns of chemical polymers.

French mathematician Louis Bachelier, who laid the foundations for a coherent mathematical theory of random walks in his 1900 PhD thesis, first noticed a striking feature of these random walks known as the Markov property: if you want to predict the future behaviour of the random walker, you only need know where they are right now. Knowing where they have been in the past adds no helpful insight whatsoever!

Remarkably, mathematics allows us to predict a great many properties of these paths accurately – even if we cannot know the details of the otherwise random walks in advance (a situation echoed in Chaos Theory).

For instance, we can calculate the probability that the walker will eventually return to their starting point, given a long enough time. For a festive friend walking on a two-dimensional surface, mathematics is on their side – they are almost certainly guaranteed to return to their starting point (if you wait long enough).

On the other hand, for three-dimensional random walks – like those taken by inebriated birds, or solar photons – there is only about a one-in-three chance of returning to the point of origin. Thus do photons eventually, inevitably, drift free of the sun after a predictable period of time.

**Continuous random walks**

As the Roman philosopher Lucretius observed around 60 BCE, beams of sunlight can also shed light on an unexpected (and ubiquitous) natural phenomenon – the mysterious jittery motions of tiny particles.

At the turn of the 20th century the greatest minds in physics had also turned their attention to this phenomenon, dubbed Brownian motion. The explanation of its origins would provide the first definitive proof for the existence of atoms.

The namesake of Brownian motion was the Scottish botanist and cleric Robert Brown, who in 1827 was examining grains of pollen suspended in water under a microscope.

The microscopic pieces of pollen threw off some still tinier bits, and their jittery motion caught Brown's eye. At first thinking that the movement may have some biological origin, the mystery grew deeper after Brown observed the same mysterious motion in similarly small particles of inorganic material.

The mystery was finally cracked by none other than Albert Einstein during his Annus Mirabilis (miracle year) of 1905. Einstein provided a detailed explanation for why Brownian motion occurred – the particles were so small that they were actually being buffeted to and fro by collisions with surrounding atoms and molecules, like a miniature plane in a never-ending storm of molecular turbulence.

By modelling Brownian motion as a random walk with tiny, random step sizes, driven by molecular collisions, Einstein's mathematics enabled the very first estimates of the size of individual molecules.

Einstein's equations were experimentally verified by French physicist Jean Perrin four years later, finally providing the first conclusive proof for the long-suspected existence of atoms.

Brownian motion is closely related to diffusion. Any time you open a perfume bottle, a fresh bag of coffee or any other aromatic container, the pleasant scent that you experience is due to the fragrant molecules being carried along fractal paths all the way from the container to your nose, through Brownian-like collisions with the gas molecules in the atmosphere.

**Walking on π (and other nifty numbers)**

The mathematics of random walks has recently found a very novel application in the analysis of walks on numbers, first described in a 2013 paper by Francisco J. Aragón Artacho, David H. Bailey, Jonathan M. Borwein and Peter B. Borwein.

To take a two-dimensional walk on a particular number, we use the same ideas as for discrete two-dimension random walks – except, rather than choosing the step directions at random, we use the digits in the number's base-b expansion (binary or decimal, say) as a set of instructions on where to go next.

A number like 1/3 (which has decimal expansion 0.333333…) is not particularly interesting – the walk will keep going in the same direction forever. A walk on the famous circle constant pi (π) whose digits begin 3.141592…, is far more fascinating, especially if it is taken on the first 100 billion digits of π:

As you can see, this long walk on π bears a striking similarity to a random walk. This is almost certainly not a coincidence – in fact, new pictures such as these may help us resolve a long-standing mathematical question regarding the "randomness" of the digits of π.

Any time random motion is present – be it drifting molecules, fluctuating stock prices or escaping sunlight – the mathematics of random walk theory allows us to extract predictable features from the otherwise unpredictable.

At the current frontiers of mathematical research it is allowing us to see familiar numbers in a whole new light.

**Explore further:**
Researchers find boomerang shaped colloid does not conform to Brownian motion