Podcast
Root Causes 474: Explaining Shor's Algorithm


Hosted by
Tim Callan
Chief Compliance Officer
Jason Soroko
Fellow
Original broadcast date
March 3, 2025
We talk a lot about Shor's Algorithm in our discussion of post quantum cryptography (PQC). In this episode Jason explains Shor's algorithm for non-quantum physicists.
Podcast Transcript
Lightly edited for flow and brevity.
That's great. But there's another type of bit. This bit isn't a zero or one.
So no, it's gonna take a lot more than 4096 bits to correct, because you're gonna have to have error correction systems and all kinds of funky things. So why the 4096? Why? Just think about this. What are you trying to solve for? We’re trying to solve for prime numbers that have been multiplied together within that system.
I won't get into the math of RSA. That's not what this is about. Shor's algorithm is really another name for a system that's using quantum Fourier transform.
I’m gonna tell you a funny story. I remember this. I was exactly 16 years old. I was working for a government office that was concerned with lands and forests and various forms of wildlife and one of the things we did was we were setting up lightning locator systems because we were interested in lightning. We were interested in forest fires, and that's basically what business we were in. I remember jumping out of a helicopter because we were in the middle of absolutely nowhere in northern Ontario and I'll never forget that I had in my hands two spectrum analyzers. We're talking circa late 1980s. Imagine this, Tim. Think about this. This is the analogy I want you to imagine before I tell you the rest of the story of jumping out of the helicopter. You are far old enough to remember, like me, dialing on an FM dial.
And so if you were to ask the question, how many radio stations can I listen to on this FM dial, you would have to brute force every single turn of a knob and listen to all those frequencies. Well, within that radio was a system that actually was able to listen to a specific frequency and give you your FM or give you your AM station. Great. Well, by the time I was jumping out of that helicopter, we had systems that could actually analyze through a fast Fourier transform all of the radio stations all at once. In other words, any frequency that was being modulated on, you would have a signal across what basically looked like an oscilloscope. If you can imagine that. So that was amazing, because at a glance, you could see the entire frequency spectrum that was defined by the machine, and you could actually solve for, all right, tell me every frequency that's being broadcast on right now. The reason why we had that in the bush - I'll tell you the rest of the story – I’m about to jump out of the helicopter. I’m a pretty strong kid. I'm not very tall, but I was a strong kid and I was told just before I jumped out of the helicopter, hey, watch out for the bear. What? Jump out of the helicopter and sure enough, there's a bear about 30 feet away from me, and he's just looking at me like, what? It was like an alien just dropped out of space. Probably never seen a human being before.
If you go back to papers, very early papers on, how in the world do we look at a number space and solve for every prime number in that space? Well, believe it or not, you can put a quantum computer against that problem and one of the ways a quantum computer can be programmed to solve for a lot of prime numbers quickly is to say how many stable qubits do I have, and that number of stable qubits can define my number space that I can evaluate for prime numbers.
So if you need to solve for RSA-2048, you need to have X amount of stable qubits. So very rapidly, what a quantum computer can do is through a quantum Fourier transforming – eh, what does that really mean? Fourier sets are really all about saying, all right, when there's a repeating pattern happening, if there's a certain number that is calculable in this repeating set of frequencies. In other words, remember, there's a temporal element to this in a fast Fourier transform, but in a quantum Fourier transform, what you're measuring is the energy level of the qubits, because you're taking measurements of all the qubits.
And if the qubits at specific points in number space, say, as a quantum, as a Fourier set, you can actually look at – and it’s amazing. I will put screenshots of the original IBM research that looked just like the spectrum analyzer, that I was sitting in front of that bear looking at.
Chlorophyll. Strangely enough - I didn't know this till I started to look it up - It's one of these weird things where a little more energy is going into the plant than you would expect for the amount of chlorophyll in a plant. What the heck is going on? Now, nobody has fully explained it, but I tell you one guy who has tried to explain it, and this is not proven. This is merely an analogy. It turns out that chlorophyll in plants have nanotubules. Now this is not something I've witnessed. I'm just reading and repeating here. Don't shoot the messenger. That potentially could be creating a type of quantum field where photons could be everywhere at once.
In other words, photons that are just coming at random angles might not be hitting the little solar panel equivalents in the chlorophyll. Because, don't forget, just because it's green doesn't mean it's collecting energy.
Richard Feynman. Like Richard Feynman with quantum, and I'm talking about like guys like Roger Penrose, who are no joke, they're the guys who are talking about this kind of stuff. Let's go back to our world now.
Our world basically, just to answer your question about the fact that these qubits are evaluating everything at once, in other words, the entire number space that they're defined to be looking at, essentially act like kind of - I like analogies. They kind of act just like a spectrum analyzer so that you can see the entire number space. In other words, the entire frequency spread all at once. Something that used to have to be brute forced by a traditional computer. And so now Shor's algorithm has all kinds of mechanisms for how you do the input to the quantum Fourier transform. The reason I over rotated on the quantum Fourier transform and tried to create several semi intuitive explanations for what it's actually doing, that's about as close as I'm going to get to explaining to you, really what is at the heart of Shor's algorithm.
Can I spend an extra minute with you to talk about quantum annealing? Quantum annealing is definitely different because it's not fully gated. It's not a universal computer. It normally is dependent upon you bringing it an optimization problem. That's what quantum annealers are the best at. But what happens if you can flip the table a little bit and actually program into a quantum annealer optimizing for factorization.
Which is this. You're talking about a collapse. In other words, the natural degradation of - - it’s still qubits - - But here's the thing about a quantum annealer. Instead of starting with like a 40 qubit fully gated computer, that d’wave computer, those Chinese researchers were using - 5000 qubits.
If you were trying to solve for a maze, one of those paths in the maze was, absolutely, factorized the two prime numbers that were multiplied together for RSA, and that's and yet like this is not just a maze. This is like the most complicated maze you've ever seen in your life. I don't even know how large of a number space I'd have to explain to you, but this is like the biggest maze ever.
But, yes, there are many, many, many failed paths, but there's one path that gives you the answer. A quantum annealer will actually follow every path, and as it's rolling down the hill, - - this is the thing. As it's degrading, as the energy levels of the qubits are allowed to degrade down to zero, eventually what you end up finding out is one of the paths emerges as the oh, this is not zero, and now you found the path.
So remember how he said in quantum Fourier transform, it required you to have a lot of stable qubits in order to be able to give you that beautiful sinusoidal wave representation, the spectrum analyzer. With quantum annealing, the number of qubits you start with allows you to determine, again, the number space. Therefore, you still need to have a lot more qubits at the beginning than we have today in current state of the art quantum annealers. But achieving a higher number is less difficult. I hope that was enough for today.

