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

Show parent comments

123

u/GroundStateGecko Mar 28 '21 edited Mar 28 '21

(This is the second part, read the first part first)

Now, why do we go through this hell?

Indeed, using a classical computer, this algorithm is definitely not faster than just trying to divide 85 by prime numbers. The main problem is to find a p, so that we have:

Ap = m * B + 1

We now need another fact:

If Ap = m * B + 1, and we pick any number q:

Aq = n * B + k

We multiply those two, you will always get:

Aq * Ap = Ap+q = something * B + k

(you can multiply (m * B + 1)*(n * B + k) yourself to get the something term)

Also:

Aq * Ap * Ap = A2p+q = something * B + k

Aq * Ap * Ap * Ap = A3p+q = something * B + k

.....

You can derive it yourself.

Now we test it with our case:

Our p is 16, we randomly pick q to be 8.

You can test:

118 = 2521869 * 85 + 16

118+16 = [A long number] * 85 + 16

118+16×2 = [A much longer number] * 85 + 16

118+16×3 = [A much much longer number] * 85 + 16

The remainder is always 16.

This satisfies for ANY q:

Like when q is 5:

115 = 1894 * 85 + 61

115+16 = [A long number] * 85 + 61

115+16×2 = [A much longer number] * 85 + 61

115+16×3 = [A much much longer number] * 85 + 61

The remainder is always 61.

So, here is the most important message, this sequence has a period of p. If we find the period (frequency), we find our factors.

The answer to how do we find a period is almost always Fourier transform.

It's kinda like when you hear a sound, the sound signal is very very complicated if you look at the position-time diagram (see this image). But after Fourier transform, you can immediately see it's just the superposition of three sine waves.

Now when you hear a song, you immediately notice that's an A-minus, not because you can calculate really fast, but because there are hair cells, that will resonances with different frequencies (Wikipedia), only the hair cell that has the right frequency will vibrate strongly, forced vibration to the other cells will cancel out as multiple periods of the sound passes through.

In a strikingly accurate way, your ear is a Fourier transform computer!

This finding-period part is where the quantum part comes in.

Now we can do a very similar thing with a quantum computer to crack passwords.

As we said before,

118 , 118+16, 118+16×2,118+16×3 all satisfies [A much much longer number] * 85 + 16

115 , 115+16, 115+16×2,115+16×3 all satisfies [A much much longer number] * 85 + 61

So we can somehow craft a system, which is the superposition of the states including the power and the remainder:

|8, 16> + |8+16, 16> + |8+16*2, 16> + |8+16*3, 16> + ...

|5, 61> + |5+16, 61> + |5+16*2, 61> + |5+16*3, 61> + ...

All this sequence will have a period 16, which is our p.

So this sequence will resonance only with something that also has a period 16 (or the multiple of it)

So, we can somehow build a "quantum ear", called QFT (quantum Fourier transform), so that only the "quantum hair cell" that has a period 16 will vibrate strongly, and the other will stay still.

Why do we need to do this? As I said in the original comment "you can only get ONE answer from the superposition of 2N states." So we must do something, to let the correct answer "pop out".

By constructing the "quantum ear", only the period-16 "hair cell" vibrates, so it has the largest amplitude. If we do a measurement, it's highly likely we will find the period-16 "hair cell" (the wave function will collapse to period-16), instead of any other number.

Now we can find our p (it's 16) with one measurement (one try)!

And with some simple Euclidean algorithm. We can crack the Internet!

(Actually, not all encryption is based on prime factors. There are things like Elliptic-curve Diffie–Hellman that will not be solved by Shor's algorithm and a quantum computer. So not all of the Internet will be cracked.) Edit: This sentence is not correct, as pointed out by u/Oye_Beltalowda. Elliptic-curve can be accelerated by Shor's algorithm. Although people have proposed variants to ECDH like SIDH that can resist quantum computer attacks.

17

u/Oye_Beltalowda Mar 28 '21

There are things like Elliptic-curve Diffie–Hellman that will not be solved by Shor's algorithm and a quantum computer.

Wikipedia says otherwise. In fact, it says that elliptic curve cryptography is even easier to break with Shor's algorithm than traditional RSA.

26

u/Harrison_Fjord Mar 28 '21

Wow. I'm reading through this a slowly, and reading through it a couple of times, but thank you so much for this explanation! The connection between FFTs is I think the biggest thing I was missing, I've tried to get explanations of the actual things that are going on when quantum computers are... executed?, but I always got something like "we wrangle these things called qubits, do black magic process that no one explains, and then we get the results. Easy peasy, what don't you understand?'. I never had a grasp on the translation between "quantum qubits are in a set of superpositions" and "we measure that to get results" until now.

Thanks again for going over all this. Your procedural method for explaining it makes it easy to follow and you do a good job of leading me through all the steps involved, not just the beginning and the end.

4

u/SirSilvan96 Mar 28 '21

Your explanation was beautiful!

2

u/atimholt Mar 28 '21

Quick question: I've read Feynman's book QED (though it's been a long time), and I've built up some (tentative) intuition for superpositions/entanglement. If this isn't a purely philosophical question, is it correct to say that a waveform collapse is still entangled with all the “histories” that could have caused it? That is, the “quantum fourier transform” doesn't necessarily collapse to the most likely outcome because it “picked one of the options”—there can still be a superposition of every Feynman diagram that leads to that outcome.

I figure it has to be this way for time-reversibility to make any sense. Aside from the massive low-entropy well that is the big bang, the past has aspects of unknowability that are the same as those of the future.

2

u/[deleted] Mar 28 '21 edited Mar 29 '21

[removed] — view removed comment

1

u/[deleted] Mar 29 '21

So you just make sure that you encrypt with an odd P and this doesn't work?

1

u/dack42 Mar 29 '21

I don't think shor's algorithm would help crack passwords. Those are normally stored as hashes - not something that involves primes or factoring.