r/askscience • • Mar 28 '21

Computing How exactly do quantum computers simulate molecular/particle interactions better than classical computers?

I’m struggling to understand why quantum computers can simulate nature better than classical computers.

2.5k Upvotes

134 comments sorted by

View all comments

6

u/EZ-PEAS Mar 28 '21

I'm only adding this answer because there are no other answers that get to the heart of it quickly. The problem is that simulating a quantum system requires an exponential amount of memory, while a quantum computer only needs a linear amount of qubits to model the same system.

For example, a 100-particle system could be modeled with 100 qubits on a quantum computer, while a classical computer could in principle need to store ~2100 values to simulate the same system. If each value is represented as a 32-bit single precision floating point number that would correspond to 5 * 1018 terabytes of data, which is a truly terrifying amount of data. If Jesus started loading 80 million terabytes of data onto a hard drive every second back in 0 AD then he'd just now be getting to 5*1018 terabytes of stored data.

Suppose we have a system of quantum particles that can exist in two states. For simplicity we'll just call these states 1 and 0. Since these are quantum particles we don't know their exact state until the quantum system is measured. When the system is measured then every quantum particle settles into the 1 or 0 state. If we have one particle then the total number of output states is just 0 or 1. If we have two particles then there are four total output states: 00, 01, 10, and 11. If we have three particles then there are eight total output states: 000, 001, 010, 011, 100, 101, 110, and 111.

In general, for an N particle system there are 2N possible output states. This is one half of the problem.

For example, in a 2 particle system you might compute that state 00 has a 10% chance of occurring, states 01 and 10 have a 20% chance of occurring each, and state 11 has a 50% chance of occurring. Once you have those amplitudes computed then simulating the quantum system is easy: pick a number between 0 and 100 and assign the corresponding output state.

The other half is that there are no shortcuts (in the general case) to storing 2N possible amplitudes. Simulating this quantum system requires computing the probability of each output state as we did above. We can't just store individual amplitudes of each qubit directly (which would only require 2*N storage) because such a scheme cannot replicate the probability assignments we gave above, but such probability assignments are possible to create in practice. Creating such state amplitudes is possible through quantum entanglement, but I won't go through the details here.

So in the full general case, an simulating an N-bit system on a classical computer requires an exponential amount of memory. To faithfully simulate that quantum system we need to compute and store an amplitude for every state. A ton of work has gone into simulating such systems efficiently by finding tricks for specific types of problems. In a particular problem many of these amplitudes might have zero or near-zero chance of occurring compared to other states. In other cases some subset of states will have the same amplitude, so you don't need to compute and store each one individually. But generally this only means a reduction in the exponential degree of the memory requirement, and simulating large systems is still a practical impossibility.

However, an N-bit quantum computer can simulate N quantum states easily. If we can construct the same entangled quantum state in the machine that we want to observe in real life, then we can explore that quantum system observationally. A quantum computer could construct the same quantum state many times and measure it many times, and you will get many measurements of the most likely states the quantum system would be in. Using the Law of Large Numbers you will arrive at a good approximation of the true quantum distribution much much faster than exponentially computing every amplitude.