How Thanos Won the Endgame: Using a Quantum Computer to Simulate Dr. Strange’s Many Worlds

Who really dominated the multiverse?

Dr. Alexis Kirke demonstrates how an IBM quantum computer can be used to explain the Many World’s interpretation of quantum mechanics, and why this demonstration could mean that Thanos dominated the multiverse and won massively at the end of Avengers: Endgame. (For an audio demonstration of this, including a live running of the IBM Q 14 quantum computer, listen to Episode 4 of ‘My Quantum Computer Wrote a Podcast’ on iTunes, Stitcher etc.)

Oh the humanity! Tony Stark clicked his fingers and sealed his own fate, and the fate of the entire universe. Such courage to win for everyone else, and lose all himself. But did he really win for everyone else? Perhaps not. And perhaps we can use the IBM Q 14 quantum computer to demonstrate why not. Oh the humanity!

In the last act of Avengers: Infinity War, Benedict Cumberbatch said — in his inimitable American accent — that he had seen all 14,000,504 futures and that the Avengers could only win in one of them. He (as in his character Dr. Strange) then handed an Infinity Stone to Thanos thus causing Tony Stark to open his eyes wider than he ever has in any Avengers or Iron Man movie — an incredible achievement in itself.

Goodbye Iron Man, we loved you so well

Then at the end of the next film (Avengers: Endgame) Dr. Strange looks at Iron Man with a glint in his eye during the final battle and raises a finger. Surprisingly Tony Stark does not look up to the sky to see what Cumberbatch is pointing at, nor does he wave back with his finger. He magically recalls that moment in the previous film when Dr. S broke his heart and handed over the stone. And so Iron Man sneaks away the Infinity Stones from Thanos’ glove and does the old clickety cloo — saving the universe and dooming himself.

Let’s just revisit that. Check out the upside-down tree picture below. At the point Dr. Strange had looked at all the possible outcomes and seen the only 1 in 14,000,504 led to the Avengers winning, he was at the top of the diagram with the choices: Give Thanos the stone (and Tony a heart attack) or don’t give Thanos the stone. This leads to at least two possible universes: the one in which Thanos is given the stone and the one in which he is not. (Of course in reality there are more than two possible universes — for example giving Thanos the stone and killing Iron Man at the same time would be a different universe to giving Thanos the stone and letting Iron Man live. But this example will be sufficient to illustrate my point.)

Evolution of the universe into a multiverse

But the diagram does help to illustrate Dr. Strange’s prediction. At the end of all the choices, only one of them results in a world (a universe) where the Avengers win. Interestingly, the above image is a slightly edited version taken from a Wikipedia page on the “Many Worlds” interpretation of quantum mechanics. Quantum mechanics (QM) has many different interpretations, designed to make sense of its anti-intuitive mathematical formalism.

Key elements that need interpreting are that before you can predict a position, velocity, energy, etc of an object in QM, you have to perform an observation. The precise nature of this observation is not understood. It happens in the mathematics. But it seems to parallel much of what we experience in the laboratory. In the normal world, if someone is crossing the street, they have a position and velocity whether they are being observed or not. They have an intrinsic position and velocity. But move down to the subatomic level, and particles don’t seem to have an intrinsic velocity or energy or position when they’re not being observed. If this confusing you, well done: it means you’re normal and sane.

The second element that needs interpretation is: what then is the energy, velocity or position of an object before one of these abstract mathematical “observations”? The mathematics suggests the values are spread across a vast range of possibilities. An electron crossing the street is, when not being observed, at all possible positions across the street. When it is observed, these possibilities collapse to a single value.

There is a school of physics (the Copenhagen Interpretation) which says “Don’t worry, just calculate”. In other words, if the equations are working and predicting correctly, let’s not worry about what they mean. But many physicists like to impose other interpretations. An extremely famous one, that is considered mainstream (i.e. not wild and whacky) is the “many worlds” interpretation. A diagram illustrating it is shown below. Instead of representing Dr Strange’s decision, it represents measuring the spin direction of a particle (spin is a quantity like velocity, energy or position that can be measured on the subatomic level).

Many Worlds representation of an electron’s spin value evolving

Each possible observation point is represented by a purple node. At the first observation point the electron has a chance of being measured as having spin “up” or spin “down” (these are the two possible measured values). In the Many Worlds interpretation, once the spin is measured the observer is entangled with the particle and two universes are in existence. The first is one which contains the observer seeing a spin up, and the second is one in which the observer sees a spin down.

In each of these universes more measurements can be made, leading to a proliferation of possible universes: a multiverse. Now we know that Marvel have written a lot about the multiverse. The following universes have been referenced by Marvel in the past: Earth-65, Earth-616, Earth-928, Earth 982, Earth-1048, Earth-1218, Earth-1287, Earth-1610, Earth 2149, Earth-8311, Earth-10005, Earth-12041, ,Earth-18119, Earth-45828, Earth-79203, Earth-88194, Earth-90214, Earth-92131, Earth-199999, and Earth-807128.

So the various possibilities that Dr. Strange looks through could actually be different universes in a Many Worlds multiverse, generated by the actions that are taken to create the universes. And 1 out of 14,000,504 universes involves the Avengers winning. But each of the other 14,000,503 universes exists. And in these 14,000,503 universes Thanos wins. Surely Thanos has dominated the multiverse?

Let’s create our own little multiverse in the IBM Q 14 quantum computer to see just how rarely Iron Man wins in the multiverse. The IBM Q 14 has 14 qubits and it is possible to place all 14 qubits into a quantum superposition. The word superposition simply means the condition that the electron was in when it was in all possible positions while crossing the street (and before it was observed). This superposition of the 14 qubits means that each of the 14 qubits has both value 1 and value 0 at the same time. So in binary, this actually stores all of the numbers between 1 and 16,384 in the quantum computer at the same time, and in the same place. You don’t need 16,384 memories to store these numbers, only a quantum superposition across 14 qubits. Neat huh?

Creating a multiverse of 16,384 universes in an IBM quantum computer

This is achieved using the quantum circuit above. Each of q0’s is a qubit. Each of the H’s in a square is called a “Hadamard gate” — this is the basic quantum computing operation for creating a superposition. Placing 14 of them in parallel creates a 14 qubit quantum superposition. After each Hadamard gate is a Measurement gate — this observes the qubit. So all 14 qubits are put into a superposition and then observed simultaneously. This causes them to collapse from representing all possible numbers 1 to 16,384 down to just one of those numbers. The number that is observed at the quantum computer’s output.

According to the Many Worlds interpretation of quantum mechanics / computing, once we observe the output, 16,384 universes are created. In each universe one of the values between 1 and 16,384 is output by the quantum computer. Compare this to Dr. Strange’s prediction. He observed the output from 14,000,504 universes, and only 1 of them was an Avenger’s winning output. (To simulate a number this large, we’d need a 24 qubit quantum computer — but I don’t have access to one yet). Dividing 14,000,504 by 16,384 tells us that the Avenger’s are 846 times more likely to win in the multiverse created by the 14 quit quantum computer than in Dr. Strange’s multiverse.

So let’s run the quantum circuit / program above and see how often the Avengers win. We’ll pick the winning number (which has to be between 1 and 16,384) as 1,473 — which is actually chosen as it’s the year the scientist Johann Kepler was born (1473). If we then run the IBM Quantum computer, it could take around a decade before the Avengers winning scenario is observed in the multiverse. To speed things up I actually run the circuit 4096 times each time I send it to the IBM quantum computer. And if just one of those runs observes 1,473 — I say the Avengers win.

Thus this quantum process should lead to the Avengers winning (14000504/16384)*4096 = 3.5 million times more often, than they would in Dr. Strange’s multiverse. So how does the IBM quantum computer that’s 3.5 million times more likely to let the Avengers win behave?

Thanos winning universes observed: 14

Avengers winning universes observed: 1

NUFF SAID!

(P.S. check out Episode 4 of “My Quantum Computer Wrote a Podcast” to hear Thanos winning…)

“HahahahaHAHAHA, puny humans!”

Alexis Kirke is a screenwriter and quantum/AI programmer. He has PhDs from an arts faculty and from a science faculty. http://www.alexiskirke.com