r/QuantumComputing • • Feb 19 '21

Continuing my series on Quantum Algorithms, here's an article on the theory and high-level concepts used in Grover's Algorithm, a very powerful algorithm!

https://medium.com/quantum-untangled/grovers-algorithm-quantum-algorithms-untangled-bdf15c8ccfab
49 Upvotes

6 comments sorted by

3

u/LegendStreak Feb 19 '21

A few weeks ago, I started a series about the Deutsch-Jozsa Algorithm (with a bonus dive into Bernstein-Vazirani). And today, it's time for the next step; moving into Grover's Algorithm, an incredibly versatile and hugely influential Quantum Algorithm.

Along with famous names such as Shor's Algorithm, this is one of the areas where Quantum Computers can truly shine, offering extreme advantages over the slow, classical computing of today.
So, what makes it so versatile, and where can it be used? And, most importantly, why does it work so well?

We'll delve into all of that and more, as we explore Grover's Algorithm. Next week, Part 2: Mathematics, Circuits and Code will come out - between the two articles, there's all the knowledge needed to truly understand the inner workings of Grover's Algorithm, and see how you might have built it yourself.

I hope it can be helpful!

As always, if you've got any questions, criticisms, or feedback, please let me know! Feel free to respond on the Medium article or here on Reddit, I'll be sure to reply.
Finally, thanks to Quantum Untangled again, for letting me publish with them!

2

u/[deleted] Feb 19 '21

Good work ! I find it a tad bit confusing that you call CNOT gates CX. But it helps to understand MCX gates ! You did a good explanation starting from the oracle, I have learned it starting from the phase flipping and diffusion operator, and laster implementing the oracle correctly. I also find the part on the complexity theory very good, although O(n) is not too bad, compared to the things you explain after. A very good introduction to the fascinating algorithm and its magical speedup.

1

u/LegendStreak Feb 19 '21 edited Feb 20 '21

Thanks! I've always personally preferred calling it the 'X' Gate rather than the 'NOT' - helps me keep the quantum and classical versions distinct in my mind. It can be a lifesaver sometimes when trying to deal with Phase Kickback and all! I do see how it can be fairly confusing, since plenty of resources call it the 'CNOT', so I'll be sure to keep it in mind.

You're absolutely right in that O(n) is actually still pretty good; it's in polynomial time, and most algorithms in 'P' are fast enough for use. Sadly, though, my explanation was a slight over-simplification - I hope to clear it up in Part 2, since that's much more 'applied' rather than high-level and theoretical. Most regular Computer Science resources will follow Part 1, discussing O(n) time for Linear Search. Quantum Computing resources seem to follow Part 2, using O(2n).

In the article, I used 'n' to represent the size of the input domain - say, an input domain of '[0 ,1 ,2, 3, 4, 5, 6, 7]' gets solved in O(8) time in the worst case.But, those numbers don't mean anything to a computer. For a computer, that list is just a series of 3-digit binary numbers. If you wanted to add '8' to the list, you'd have to add a fourth digit, '1000'. If you wanted to add '16', you'd have to add a fifth, '10000'.

So, the size of the input domain, in reference to the number of bits (what the computer actually worries about) is 2n. Each bit is a 'parameter' of sorts, which can be 'on' or 'off' to produce the final result; and adding one bit doubles the complexity of a classical algorithm. Because of this, we end up with exponential time taken to solve this problem, which isn't great - along with factorial time, it gets extremely problematic for large numbers.

So each time I refer to 'n', it's actuall 2n. Even Grover's Algorithm only works as O(sqrt(2n)), so it still can scale very quickly. In any case, it's still an incredible improvement - since 2n is constant between the two algorithms, the difference between them shown in the graphs still applies, and Grover's Algorithm's advantage is still massive. If anything, this just makes Grover all the more awesome!

2

u/[deleted] Feb 20 '21

I do agree that the difference between classical and quantum confused me a lot in the beginning, and still does sometimes. This is why some ressources say N = 2n and use it that way. I find your article very good ! Will you expand on how to create the traveling salesman oracle ? Because as you said it, you need to compare two paths, which is a bit trickier than other NP problems.

1

u/LegendStreak Feb 20 '21

I'm considering doing a bonus Part 3 for this series for more complex expansion on the algorithm, like Bernstein-Vazirani was the bonus for Deutsch-Jozsa. If it sounds helpful, I'd been toying with an introduction to translating Classical Oracles to Quantum Oracles, and perhaps using an example in Grover's Algorithm to illustrate it.

Problem like the Traveling Salesman Problem might be a little too complex for the article, especially if you're looking for Quantum Advantage over the best known classical algorithm. Research into those fields are still on-going, and the method I suggested is just one of many. I'd be more than happy to try and create a path for further reading, though - hopefully a potential Part 3 would be a good enough introduction to begin understanding more complicated applications.

1

u/[deleted] Feb 20 '21

If you need any help or contribution (though you are very self-sufficient), I am more than happy to help !