r/askscience • u/[deleted] • 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
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.