July 18th, 2019

One Year of Quantum Katas

Mariia Mykhailova
Principal Software Engineer

In July 2018 we announced the Quantum Katas – an open-source project aimed at teaching quantum computing and Q# programming. This July we’re celebrating the first anniversary of the Katas (the exact anniversary date is a bit hazy, since the GitHub repository went public a week or two before the official announcement), so I decided to step back for a moment and look at how the project grew and evolved during this year.

OneWeek Hackathon

The first release of the Quantum Katas had only 4 katas, covering basic gates used in quantum computing, the concept of superposition, the use of measurements, quantum oracles and Deutsch–Jozsa algorithm. Even with this seemingly scarce material they were very useful for people learning quantum computing, but it was obvious that we needed more topics.

The first big batch of the new katas came in from Microsoft’s OneWeek Hackathon – a yearly global event that brings together Microsoft employees and interns to tackle unusual and exciting projects. A group of hackers from different countries got together to learn something about quantum computing and to write new katas about the topics they’ve just learned.

Hackathon 2018 participants

This Hackathon brought in such gems as the katas on teleportation, superdense coding, Simon’s algorithm and Grover’s algorithm – all of them essential stepping stones on the way to mastering quantum computing, and all of them already used in teaching these topics.

University of Washington Course

Outside of the Hackathon things looked quiet for a while: in the half a year since the katas were released we added only two new katas – the ones on joint measurements and on the bit-flip error correction code. But behind the scenes work was in full swing: we were preparing for the next big events – the course on quantum computing we were going to teach in University of Washington and the second Q# coding contest.

The impact of the course was two-fold. On one hand, we heavily relied on the katas for teaching the students Q#, but at that point the katas covered the introductory topics well enough that we only needed to write one new kata, the one on phase estimation. On the other hand, a lot of students elected to write a kata or several as their final project in the course and to contribute them back to the project. The set of three katas on quantum entanglement games was one of these final projects, as well as the prototype of the kata on solving graph coloring problems using Grover’s algorithm (and there are more lined up!).

Q# Coding Contest

For the second Q# coding contest, we took a brief detour from the usual learning path and wrote a very uncommon kata called UnitaryPatterns. It offers tasks of the following form: given a pattern of zero and non-zero elements in a square matrix of size 2N × 2N, write a Q# operation that implements a unitary transformation on N qubits described by a matrix that matches this pattern.

An example of a UnitaryPattern task

These are not the kind of tasks you’ll often see in a book, but they make for a really great brainteaser – and teach you a lot about what it means for a matrix to be unitary and about decomposing unitary transformations into Q# operations.

Another kata written for the contest aims to answer one of the most frequent questions about Grover’s search algorithm: how to implement an oracle for the search problem if you don’t know the answer yet, and what’s the point of implementing an oracle if you already know the answer? SAT problems are a perfect example of problems that can be expressed as oracles and tackled using Grover’s search, as shown by this kata.

Q# Jupyter Notebooks

The next big step for the evolution of the Quantum Katas were Jupyter Notebooks for Q#. I’ve already praised them for making an excellent front-end for the existing katas, so I won’t repeat the odes here – I’ll just point out that (due to relentless effort of our community) 13 of the katas are already available online as Jupyter Notebooks, and the rest of them are coming soon.

But the benefits of the Notebooks don’t end at the beautiful presentation for existing problems…

What’s Next?

Jupyter Notebooks open the door to a whole world of new possibilities. The most obvious of them is writing proper tutorials that explain a topic using a mix of theory, visualization, Q# code samples/small demos and programming exercises. The first of such tutorials is already up – it offers you a rather extensive exploration of the Deutsch–Jozsa algorithm, including the classical solution to the problem and an introduction to phase oracles and implementing them in Q#.

Deutsch-Jozsa algorithm tutorial

We hope you find the growing Quantum Katas project useful. Stay tuned as we share with you new tutorials and programming exercises!

Category
Tutorials

Author

Mariia Mykhailova
Principal Software Engineer

Mariia Mykhailova is a principal software engineer at the Advanced Quantum Development team at Microsoft. She works on developing software for fault-tolerant quantum computation. Mariia is also a part-time lecturer at Northeastern University, teaching Introduction to Quantum Computing since 2020, and the author of O’Reilly book “Q# Pocket Guide”. In her spare time, she writes problems for programming competitions and creates puzzles.

0 comments

Discussion are closed.