Read an extract

Can crime be predicted by an algorithm?

Can police use an algorithm to catch criminals, or even predict where a crime will occur? Mathematician and author of Hello World, Hannah Fry, looks at the possible uses of algorithms in law enforcement.


It was a warm July day in 1995 when a 22-year-old university student packed up her books, left the Leeds library and headed back to her car. She’d spent the day putting the finishing touches to her dissertation and now she was free to enjoy the rest of her summer. But, as she sat in the front seat of her car getting ready to leave, she heard the sound of someone running through the multi-storey car park towards her. Before she had a chance to react, a man leaned in through the open window and held a knife to her throat. He forced her on to the back seat, tied her up, super-glued her eye­lids together, took the wheel of the car and drove away.

After a terrifying drive, he pulled up at a grassy embankment. She heard a clunk as he dropped his seat down and then a shuffling as he started undoing his clothes. She knew he was intending to rape her. Fighting blind, she pulled her knees up to her chest and pushed outwards with all her might, forcing him backwards. As she kicked and struggled, the knife in his hand cut into his fingers and his blood dripped on to the seats. He hit her twice in the face, but then, to her immense relief, got out of the car and left. Two hours after her ordeal had begun, the student was found wander­ing down Globe Road in Leeds, distraught and dishevelled, her shirt torn, her face red from where he’d struck her and her eyelids sealed with glue.

pre-order the book


Sexual attacks on strangers like this one are incredibly rare, but when they do occur they tend to form part of a series. And sure enough, this wasn’t the first time the same man had struck. When police analysed blood from the car they found its DNA matched a sample from a rape carried out in another multi-storey car park two years earlier. That attack had taken place some 100 kilometres further south, in Nottingham. And, after an appeal on the BBC Crimewatch programme, police also managed to link the case to three other incidents a decade before in Bradford, Leeds and Leicester.

But tracking down this particular serial rapist was not going to be easy. Together, these crimes spanned an area of 7,046 square kilometres – an enormous stretch of the country. They also presented the police with a staggering number of potential suspects – 33,628 in total – each one of whom would have to be eliminated from their enquiries or investigated.

An enormous search would have to be made, and not for the first time. The attacks ten years earlier had led to a massive man-hunt; but despite knocking on 14,153 front doors, and collecting numerous swabs, hair samples and all sorts of other evidence, the police investigation had eventually led nowhere. There was a seri­ous risk that the latest search would follow the same path, until a Canadian ex-cop, Kim Rossmo, and his newly developed algorithm were brought in to help.

Rossmo had a bold idea. Rather than taking into account the vast amount of evidence already collected, his algorithm would ignore virtually everything. Instead, it would focus its attention exclusively on a single factor: geography.

Rather than taking into account the vast amount of evidence already collected, his algorithm would ignore virtually everything. Instead, it would focus its attention exclusively on a single factor: geography.

Perhaps, said Rossmo, a perpetrator doesn’t randomly choose where they target their victims. Perhaps their choice of location isn’t an entirely free or conscious decision. Even though these at­tacks had taken place up and down the country, Rossmo wondered if there could be an unintended pattern hiding in the geography of the crimes – a pattern simple enough to be exploited. There was a chance, he believed, that the locations at which crimes took place could betray where the criminal actually came from. The case of the serial rapist was a chance to put his theory to the test.

Operation Lynx and the lawn sprinkler

Rossmo wasn’t the first person to suggest that criminals unwitting­ly create geographical patterns. His ideas have a lineage that dates back to the 1820s, when André-Michel Guerry, a lawyer-turned-statistician who worked for the French Ministry of Justice, started collecting records of the rapes, murders and robberies that occurred in the various regions of France.

Although collecting these kinds of numbers seems a fairly stand­ard thing to do now, at the time maths and statistics had only ever been applied to the hard sciences, where equations are used to ele­gantly describe the physical laws of the universe: tracing the path of a planet across a sky, calculating the forces within a steam engine – that sort of thing. No one had bothered to collect crime data before. No one had any idea what to count, how to count or how often they should count it. And anyway – people thought at the time – what was the point? Man was strong, independent in nature and wan­dering around acting according to his own free will. His behaviour couldn’t possibly be captured by the paltry practice of statistics.

But Guerry’s analysis of his national census of criminals sug­gested otherwise. No matter where you were in France, he found, recognizable patterns appeared in what crimes were committed, how – and by whom. Young people committed more crimes than old, men more than women, poor more than rich. Intriguingly, it soon became clear that these patterns didn’t change over time. Each region had its own set of crime statistics that would barely change year on year. With an almost terrifying exactitude, the numbers of robberies, rapes and murders would repeat themselves from one year to the next. And even the methods used by the murderers were predictable. This meant that Guerry and his colleagues could pick an area and tell you in advance exactly how many murders by knife, sword, stone, strangulation or drowning you could expect in a given year.

So maybe it wasn’t a question of the criminal’s free will after all. Crime is not random; people are predictable. And it was precisely that predictability that, almost two centuries after Guerry’s discov­ery, Kim Rossmo wanted to exploit.

Crime is not random; people are predictable. 

Guerry’s work focused on the patterns found at the country and regional levels, but even at the individual level, it turns out that people committing crime still create reliable geographical patterns. Just like the rest of us, criminals tend to stick to areas they are familiar with. They operate locally. That means that even the most serious of crimes will probably be carried out close to where the offender lives. And, as you move further and further away from the scene of the crime, the chance of finding your perpetrator’s home slowly drops away, an effect known to criminologists as ‘distance decay’.

On the other hand, serial offenders are unlikely to target vic­tims who live very close by, to avoid unnecessary police attention on their doorsteps or being recognized by neighbours. The result is known as a ‘buffer zone’ which encircles the offender’s home, a region in which there’ll be a very low chance of their committing a crime. These two key patterns – distance decay and the buffer zone – hid­den among the geography of the most serious crimes, were at the heart of Rossmo’s algorithm. Starting with a crime scene pinned on to a map, Rossmo realized he could mathematically balance these two factors and sketch out a picture of where the perpetrator might live.

That picture isn’t especially helpful when only one crime has been committed. Without enough information to go on, the so-called geoprofiling algorithm won’t tell you much more than good old-fashioned common sense. But, as more crimes are added, the picture starts to sharpen, slowly bringing into focus a map of the city that highlights areas in which you’re most likely to catch your culprit.

It’s as if the serial offender is a rotating lawn sprinkler. Just as it would be difficult to predict where the very next drop of water is going to fall, you can’t foresee where your criminal will attack next. But once the water has been spraying for a while and many drops have fallen, it’s relatively easy to observe from the pattern of the drops where the lawn sprinkler is likely to be situated.

And so it was with Rossmo’s algorithm for Operation Lynx – the hunt for the serial rapist. The team now had the locations of five separate crimes, plus several places where a stolen credit card had been used by the attacker to buy alcohol, cigarettes and a video game. On the basis of just those locations, the algorithm highlight­ed two key areas in which it believed the perpetrator was likely to live: Millgarth and Killingbeck, both in the suburbs of Leeds.

Back in the incident room, police had one other key piece of evi­dence to go on: a partial fingerprint left by the attacker at the scene of an earlier crime. It was too small a sample for an automatic finger­print recognition system to be able to whizz through a database of convicted criminals’ prints looking for a match, so any comparisons would need to be made meticulously by an expert with a magnify­ing glass, painstakingly examining one suspect at a time. By now the operation was almost three years old and – despite the best efforts of 180 different officers from five different forces – it was beginning to run out of steam. Every lead resulted in just another dead end.

Officers decided to manually check all the fingerprints record­ed in the two places the algorithm had highlighted. First up was Millgarth: but a search through the prints stored in the local police database returned nothing. Then came Killingbeck – and after 940 hours of sifting through the records here, the police finally came up with a name: Clive Barwell. Barwell was a 42-year-old married man and father of four, who had been in jail for armed robbery during the hiatus in the attacks. He now worked as a lorry driver and would regularly make long trips up and down the country in the course of his job; but he lived in Killingbeck and would often visit his mother in Millgarth, the two areas highlighted by the algorithm. The partial print on its own hadn’t been enough to identify him conclusively, but a sub­sequent DNA test proved that it was he who had committed these horrendous crimes. The police had their man. Barwell pleaded guilty in court in October 1999. The judge sentenced him to eight back-to-back life sentences.

Once it was all over, Rossmo had the chance to take stock of how well the algorithm had performed. It had never actually pinpointed Barwell by name, but it did highlight on a map the areas where the police should focus their attention. If the police had used the algo­rithm to prioritize their list of suspects on the basis of where each of them lived – checking the fingerprints and taking DNA swabs of each one in turn – there would have been no need to trouble any­where near as many innocent people. They would have found Clive Barwell after searching only 3 per cent of the area.

This algorithm had certainly been proved effective. And it brought other positives, too. As it only prioritizes your existing list of suspects, it doesn’t suffer from bias of the kind we meet in the ‘Jus­tice’ section. Also, it can’t override good detective work, only make an investigation more efficient; so there’s little chance of people put­ting too much trust in it.

It is also incredibly flexible. Since Operation Lynx, it has been used by more than 350 crime-fighting agencies around the world, including the US Federal Bureau of Investigation and the Royal Ca­nadian Mounted Police. And the insights it offers extend beyond crime: the algorithm has been used to identify stagnant water pools that mosquitoes use as breeding grounds, based on the locations of cases of malaria in Egypt. A PhD student of mine at Univer­sity College London is currently using the algorithm in an attempt to predict the sites of bomb factories on the basis of the locations where improvised explosive devices are used. And one group of mathematicians in London have even used it to try to track down Banksy, the reclusive street artist, on the basis of where his paint­ings have been found.

The kinds of crimes for which geoprofiling works best – serial rapes, murders and violent attacks – are, fortunately, rare. In reality the vast majority of infractions don’t warrant the kind of man-hunt that the Clive Barwell case demanded. If algorithms were to make a difference in tackling crime beyond these extreme cases, they’d need a different geographical pattern to go on. One that could be applied to a city as a whole. One that could capture the patterns and rhythms of a street or a corner that every beat officer knows instinc­tively. Thankfully, Jack Maple had just the thing.

From crime to art, from justice to medicine, from cars to data, algorithms play a pivotal role in how society functions. But how do we know when to trust the machine and when to follow our own instincts? Hannah Fry lifts the lid on the world of algorithms and shows how we can stay human in the age of the machine, in her book Hello World.

More about the book

Hello World

Hannah Fry

Shortlisted for the 2018 Royal Society Investment Science Book Prize

'Wise, sharp and witty, the definitive guide to living in the age of social media, algorithms and automation.' Adam Rutherford

You are accused of a crime. Who would you rather determined your fate – a human or an algorithm?
An algorithm is more consistent and less prone to error of judgement. Yet a human can look you in the eye before passing sentence.
You need a liver transplant to save your life. Who would you want in charge of organ allocation?
An algorithm can match organ donors with patients, potentially saving many more lives. But it may send you to the back of the queue.
You’re buying a (driverless) car. One vehicle is programmed to save as many lives as possible in a collision. Another promises to prioritize the lives of its passengers. Which do you choose?
Welcome to the age of the algorithm, the story of a not-too-distant future where machines rule supreme, making important decisions – in healthcare, transport, finance, security, what we watch, where we go even who we send to prison. So how much should we rely on them? What kind of future do we want?

Hannah Fry takes us on a tour of the good, the bad and the downright ugly of the algorithms that surround us. In Hello World she lifts the lid on their inner workings, demonstrates their power, exposes their limitations, and examines whether they really are an improvement on the humans they are replacing.

Related features