Andy Murray’s unexpectedly strong start against Roger Federer in the Wimbledon 2012 final put the Daily Telegraph columnist Matthew Norman in a science-fiction mood. ‘It seemed we’d been transported to one of those parallel universes into which Doctor Who likes to slip with insouciant ease,’ he commented. A year later, that alternative world became reality, as Murray took the title, leaving journalists to apply the same familiar image to others. Contrasting Murray with the doubles champion Jonny Marray — who still rents a flat and drives a Ford Fiesta, despite holding a Grand Slam title — the Daily Mail opined: ‘The stark reality is that the two champions, who share a passion for tennis, live and work in a parallel universe.’

Where did this idea of parallel universes come from? Science fiction is an obvious source: in the 1960s, Captain Kirk met his ‘other self’ in a Star Trek episode called ‘Mirror, Mirror’, while Philip K Dick’s novel The Man in the High Castle (1963) imagined an alternate world in which the US was a Nazi puppet state. Since then, the idea has become mainstream, providing the image of forking paths in the romantic comedy Sliding Doors (1998), and the spine-chilling ‘What if?’ in Philip Roth’s novel The Plot Against America (2004), which envisaged the anti-Semitic aviator Charles Lindbergh defeating Roosevelt in 1940. But there’s also science fact. In 1935, Erwin Schrödinger proposed his famous thought experiment involving a cat in a box whose life or death is connected to a quantum event, and in 1957 the American physicist Hugh Everett developed his ‘many worlds’ theory, which proposed that the act of opening Schrödinger’s box entailed a splitting of universes: one where the cat is alive, and another where it is dead.

Recently, physicists have been boldly endorsing a ‘multiverse’ of possible worlds. Richard Feynman, for example, said that when light goes from A to B it takes every possible path, but the one we see is the quickest because all the others cancel out. In The Universe in a Nutshell (2001), Stephen Hawking went with a sporting multiverse, declaring it ‘scientific fact’ that there exists a parallel universe in which Belize won every gold medal at the Olympic Games. For Hawking, the universe is a kind of ‘cosmic casino’ whose dice rolls lead to widely divergent paths: we see one, but all are real.

Borges never considered how many millions of light years any poor soul would need to travel in order to find so much as a page worth reading

Surprisingly, however, the idea of parallel universes is far older than any of these references, cropping up in philosophy and literature since ancient times. Even the word ‘multiverse’ has vintage. In a journal paper dating from 1895, William James referred to a ‘multiverse of experience’, while in his English Roses collection of 1899, the poet Frederick Orde Ward gave the term a spiritual cast: ‘Within, without, nowhere and everywhere;/Now bedrock of the mighty Multiverse…’

At the far reaches of this hidden history is Democritus, who believed the universe to be made of atoms moving in an infinite void. Over time, they would combine and recombine in every possible way: the world we see around us is just one arrangement among many that are all certain to appear. For Epicurus, who thought that atoms sometimes undergo a sudden random movement (‘swerve’) the whole future is not mapped out by mechanical principles, as it is for Democritus. Its paths are multiple. Epicureanism was the doctrine that survived into Roman times — as a philosophy of life in general, not just a physical theory. It was celebrated by Lucretius’s poem De Rerum Natura, and by Cicero in a passage of the Academica:

Would you believe that there exist innumerable worlds… and that just as we are at this moment close to Bauli and are looking towards Puteoli, so there are countless persons in exactly similar spots with our names, our honours, our achievements, our minds, our shapes, our ages, discussing the very same subject?

For Epicurean atomists, history was a succession of accidental collisions. Human affairs were subject to the laws of matter, or pure chance, not the will of gods, and everywhere and always the outcomes of events might have been otherwise. Thus Livy (not an atomist, though a believer in chance) speculated on what might have transpired if Alexander the Great had invaded Italy. Such ‘What if?’ scenarios were shunned by later Christian historians, who saw divine providence as the principle guiding the grand course of human affairs. As Shakespeare’s Hamlet put it: ‘There’s a divinity that shapes our ends,/Rough-hew them how we will.’

In the 17th century, the mathematician and philosopher Gottfried von Leibniz introduced a new kind of multiverse. He was intrigued by the way that so many natural processes appear ‘optimised’— soap bubbles minimise surface area by being spherical; light beams take the quickest route through space. Detecting the work of a divine hand, Leibniz proposed that the universe is optimised in every detail by God. Thus was born ‘optimism’, the idea (ruthlessly parodied by Voltaire in Candide) that we live in the best of all possible worlds. Applying the theory to the problem of why evil exists, Leibniz gave it graphic form, as a pyramid, infinite and many-roomed, in each of which is a possible world. At the pyramid’s peak is the one true world we inhabit. Leibniz modelled the various possible lives of the notorious Sextus Tarquinius, speculating that in most rooms Sextus leads a virtuous life, but in the highest he rapes Lucretia and is banished. Why is that the best of possible worlds? Because his banishment leads to the founding of the Roman Republic: an evil act produces a greater good. Or, as optimists say nowadays when trying to come to terms with disaster, everything happens for a reason.

Unlike Democritus (who was an atheist), Leibniz insisted that the possible worlds exist purely in the mind of God, who selects one of them for true existence. Like a hologram, his universe is projected by God into every mind and made consistent by a ‘principle of harmony’. What makes it authentic is God’s benevolence: he wouldn’t play the nasty trick of making us believe in the reality of a false world. That scenario would be left for much later writers to contemplate, in darkly sinister films such as The Truman Show (1998) and The Matrix (1999).

Alexander Pope’s poem ‘An Essay on Man’ (1734) helped to sustain a Leibnizian optimism (‘Whatever is, is right’), and only in the 19th century do we see a significant re-emergence of the idea that the world might be shaped by chance after all. The British scholar Isaac D’Israeli, father of the future prime minister Benjamin, speculated in 1823 that ‘often on a single event revolve the fortunes of men and of nations’. In the essay ‘Of a History of Events Which Have Not Happened’ (1830), he paid tribute to Livy’s ancient example by exploring historical ‘What ifs?’ that imagined Cromwell forming an alliance with Spain, or a Muslim Britain under Saracen domination, where ‘we should have worn turbans, combed our beards instead of shaving them, [and] have beheld a more magnificent architecture than the Grecian’.

D’Israeli’s essay is one of the first examples of the ‘alternate history’ genre that Philip K Dick and so many others would take up, often as a subversive reaction against the ruling elite’s assumption that they were entitled to power. Before then, the upheavals of French politics proved fertile territory for such revisionist speculation. Napoléon et la conquête du monde (1812), by Louis Geoffroy, brought the victorious emperor to Britain, while in 1854 he made it to India in Joseph Méry’s Histoire de ce qui n’est pas arrive (‘History of What Never Happened’). Charles Renouvier’s Uchronie (1876) offered a complete rewriting of European history. Most interesting of all, Louis-Auguste Blanqui’s L’éternité par les astres (1872) offered an updated version of the Democritean multiverse which used 19th-century atomic theory to argue that there exist physically real planets where Napoleon won the battle of Waterloo.

Blanqui, a lifelong revolutionary agitator, was imprisoned by every regime under which he lived. The Paris Communards demanded his release so that he could be their president, and Karl Marx said that, had their wish been granted, the Commune might not have fallen. But Blanqui was too left-wing even for Marx and his collaborator Friedrich Engels, who denounced him as an anarchist.

Like Engels, Blanqui dabbled in scientific speculation. He’d picked up enough contemporary science to appreciate the probabilistic nature of two great theories of the time: thermodynamics and natural selection. He also appreciated the intimate connection between political ideology and scientific interpretation. It was Marx who said that the theory of natural selection was essentially a description of capitalism without the concept of class conflict, but Blanqui would surely have appreciated the observation.

In a village you don’t bump into the stranger who changes your life; in a city you might

Marx, in fact, had studied Democritean atomism for his PhD in philosophy, and his own theory of history was similarly mechanistic: the ultimate rise of the proletariat was as inevitable as the fall of an apple. History is progress, and can only go one way, propelled by the class struggle. For Blanqui, atomism implied a different universe, for as well as planets where revolution succeeds, there are also ones where it has failed, or is failing right now. Every moment is effectively an eternity in space, repeated in different places in every possible variation. Historical progress is therefore illusory — a local phenomenon without meaning in the greater multiverse.

Blanqui’s bleak but supposedly rational vision could be seen as a pseudoscientific counterpart to other 19th-century nightmares of the educated mind: the heat-death of the universe or the extinction of species. It was a vision that later gripped the German literary critic and philosopher Walter Benjamin.

In the 1920s, Benjamin embarked on a study of 19th-century Paris that would become The Arcades Project, a mass of quotation and commentary that remained in a fragmentary and disordered state when he died in 1940. One offshoot was the essay ‘On Some Motifs in Baudelaire’, in which Benjamin comments on the rise of gambling and speculation, the way that each throw of the dice represents a new start, a new world. He compares this to the factory conveyor belt, where each component is brand-new yet identical to the one before. The machine operator spends a day endlessly repeating some simple physical gesture, then finds amusement in doing the same thing at a slot machine. The mechanised world, like capitalism itself, is an apparent offer of constantly renewed hope, when really the one thing it must produce in order to perpetuate itself is a sense of constantly increased need.

For Benjamin, what was crucially new in the 19th-century world view was the crowd – that is, the statistical mass. He didn’t cite thermodynamics or natural selection, but instead two stories, ‘The Cousin’s Corner Window’ (1822) by E T A Hoffmann and ‘The Man of the Crowd’ (1840) by Edgar Allan Poe, which dramatised this new way of seeing the collective rather than the individual. With it came the rise of chance as a factor in people’s lives. In a village you don’t bump into the stranger who changes your life; in a city you might.

In the course of his studies, Benjamin discovered Baudelaire’s particular fascination with Blanqui, and this is perhaps how, in the late 1930s, Benjamin came to read L’éternité par les astres, writing excitedly to his fellow philosopher Max Horkheimer about it. According to Benjamin, Blanqui’s theory represents a tragic capitulation to everything the old revolutionaries fought against — a vision of bourgeois existence remodelled as cosmology, with replicated worlds like mass-produced consumer goods, inspiring passivity and boredom.

Around the same time, and quite independently, Blanqui’s book was read in Argentina by Jorge Luis Borges, who shared it with his friend and fellow writer Adolfo Bioy Casares. Casares was inspired to write a short story called ‘La trama celeste’ (1948) — ‘The Celestial Plot’ — in which an airman crashes and finds himself in a parallel world; the plot hinges on copies of Blanqui’s book that are differently paginated in the different universes.

Borges himself refers to Blanqui in his 1936 essay ‘A History of Eternity’. For Borges, Blanqui’s vision is heavenly — like the archive he describes in his short story ‘The Library of Babel’ (1941), a building that contains every possible book among its randomly generated texts. What Borges never considered in his story is how many millions of light years any poor soul would need to travel in order to find as much as a page worth reading. To any real inhabitant, the library would be indistinguishable from chaos, and it is only from the lofty vantage point of literary contemplation that the place assumes order. For Benjamin, however, the multiverse is not an intellectual parlour game, but a damning reflection of the society that produces it.

In a proposed introduction to The Arcades Project, Benjamin compares Blanqui’s multiverse to Baudelaire’s poem ‘Les sept vieillards’ (‘The Seven Old Men’, 1857), which takes a succession of identical old men and imagines them as a single man multiplied in some ‘infamous plot’. This, says Benjamin, is an image of modernity itself. An eventual consequence of such dehumanisation was the rise of fascism. In one of his last essays on the philosophy of history, Benjamin says that to understand fascism we need to appreciate how in an oppressive regime every day is presented as a new emergency.

Given that war is the archetypal splitting point for alternative history, perhaps the threat of fascism accounts for the rise in popularity of parallel-world stories in the 1940s, sometimes as wish-fulfilling escapism, as in the film It’s a Wonderful Life (1946), or else as warnings of alternatives that could so easily happen. In Borges’s short story ‘Tlön, Uqbar, Orbis Tertius’ (1940), for example, an invented world causes reality itself to cave in. A year later, Borges again worked the theme of branching realities, in a wartime spy story called ‘The Garden of Forking Paths’. When the American physicist Seth Lloyd met Borges at a Cambridge reception in 1983, he asked him if he was aware that this story eerily prefigured Hugh Everett’s concept of many worlds. Borges had never heard of it, but said that it didn’t surprise him that physics sometimes followed literature. After all, physicists are readers, too (of literature, and of history).

The theories of Everett, Feynman and others are highly technical, but physicists looking to explain them in ordinary language draw on the same common stock of image and metaphor as everyone else, and that stock has been around for a very long time. Feynman’s idea about light taking every possible path is essentially Leibniz’s, only without the need for God. That said, modern-day optimism is no longer a belief that all things were created for the best; it’s the belief that in the cosmic lottery, anyone can be a winner, whether you’re Andy Murray or just buying a lottery ticket.

After training as a theoretical physicist, I took up the harmless occupation of writing novels while many of my contemporaries went into finance. And look where they got us. Optimism is all very well, but sometimes scientists need to be reminded that ‘fact’ is a word to be handled with care.

Corrections, 10/09/2013: This essay previously stated that the passage of the Academica quoted was by Livy; its author was Cicero. This has been corrected.