A Cat’s Survival Mechanism

This post is part of the Q# Advent Calendar 2020. Check out the calendar for more great posts!

It’s been a difficult year for everybody. I hope this post finds you well. Perhaps a positive result that came out of this turbulent year is some motivation to learn new things. It has been the case for me, as well as many people who attended my Sunday Quantum Computing class. I’ll share a few things I’ve learned from teaching a broad audience, including some thoughts about the quantum workforce, career options, learning needs and some technical misconceptions in quantum.


As part of my day job working at Microsoft Quantum, I create and manage our official MS Learn quantum modules and documentation.

MS Learn is a platform for on-demand online interactive tutorials. We have developed a new learning path, Quantum Computing Foundations (aka.ms/learnqc), to help people quickly get hands-on experience with quantum computing. It currently has four modules focused on getting started with the Quantum Development Kit (QDK), learning to write algorithms using Q# and applying quantum-inspired optimization. With the public preview of Azure Quantum launching soon, there will be more modules added to the learning path to help you start using Azure Quantum services. The modules provide training that is complementary to the Quantum Katas (focused on learning Q#) and the documentation (a detailed manual on the QDK and Q#, and later on Azure Quantum and Optimization).

Quantum learning path on MS Learn

Like a cat in a superposition state, I always have personal projects in parallel. Sometimes they help feed additional insights into my day job.

When the world-wide lockdown happened in March, I gave myself a challenge – to come up with a few pages of comics every week on a specific quantum computing topic. It was at first an intellectual exercise, as being able to convert scientific ideas into pictures is a way for me to check for any gaps in my understanding.

A page in my comics book

It then quickly expanded into a systematic course which I started teaching at HackadayU (an alternative grad school for hardware hackers), co-hosted by Microsoft Reactor. From 29 March to 1 November, learners from around the world gathered via a Teams meeting every Sunday to walk through a quantum computing concept, including theory, hardware and programming. I taught 20 sessions and invited a few guest lecturers to finish the course with some active research and development topics (Quantum Cryptography by Prof. Terrill Frantz, Q# Community Project qTril by Rolf Huisman, Quantum Machine Learning by Dr. Maria Schuld, Quantum Tomography by Prof. Chris Ferrie and Quantum Error Correction by Dr. Michael Beverland. Thank you!)

HackadayU: Quantum Computing through Comics

All the classes were recorded and can be watched on-demand, via this link. We used the Quantum Katas to exercise coding algorithms like Deutsch-Jozsa, Grover’s and Shor’s in Q#. I offered certificates for completing certain activities in the course. You can still work on the katas any time and get a certificate like these participants did:

Participation rules

My comics became especially popular, so they must be doing something right – they provide readers with an intuition-focused approach to go from the beginning concepts to more advanced topics like algorithms. They do not oversimplify, as some people may expect comics to do – they never try to avoid the necessary physics and math. The comics fortunately were featured in Quantum Zeitgeist and Forbes. If you are interested in reading the comics, here is the book.

In 2019’s Q# Advent Calendar blog, I mentioned that one doesn’t have to know everything about quantum mechanics to do quantum computing. In fact, there is a shortcut to help people quickly get on the right track of learning to do quantum computing. The fundamental underlying physical principle that quantum computing uses is superposition, which results in interference and entanglement. These are the three key concepts that one has to grasp first. With a little bit of math, that is, linear algebra, one can quickly start writing algorithms on quantum hardware using the quantum programming language Q#. Where do you learn all these? Microsoft has them all covered through various materials. Based on where you are and what you need, you will find the materials made for you.

Quantum learning landscape

A new technology cannot develop without a community and collaborations. As Sarang Brahme put nicely in the Dec. 8’s blog Cloud Architecture for Quantum Computing — with Azure, different parts of the community are connecting an ecosystem. This means we also need different types of people to build the quantum computing industry. I’m looking forward to seeing more quantum-curious hobbyists join the professional workforce.

What will you do? Who will you be? (Some names above reference historic characters, but the future is wide open for you.)


Teaching is the best way to learn. When teaching, I always need to revisit materials I thought I already knew. I had a big revelation during this year’s teaching and drawing – how to think about interference to understand quantum algorithms intuitively.

In the 2018 Q# Advent Calendar blog, I wrote about how constructive or destructive interference enhances or reduces the probability of the states in the system, which determines what we observe in measurements. But then what?

You might have had similar experience like I had, getting lost in the math while trying to learn about the various quantum algorithms. And even if the math steps are clear, is there any intuitive insight we can be inspired by? What are the oracles really doing? The answers all become obvious if we look at the amplitudes of each state, zooming out to a high-level, and considering the interference at each step.

In these series of comics below, I draw big-picture representations along with the commonly-seen quantum circuits of Deutsch’s, Deutsch-Jozsa, Grover’s and Shor’s algorithms. I hope these can be useful references for you when you need additional insights understanding the algorithms. The key trick is often played by the negative signs of the output qubits |y⟩ (with the negative sign introduced by the H gates on the |1⟩ states). The oracle applies the controlled gates, with the input qubits |x⟩ as the controls and output qubits |y⟩ as the targets. So entanglements happen to the states with the negative signs, and that destructive interference carries over through the iterations in the algorithm.

I was also happy to realize that Shor’s algorithm is just a quantum-algorithm counterpart of a Bragg diffraction grating (connecting to my condensed matter background). Peter Shor mentioned this in his 2min video – at first I didn’t think he had explained much, but then I realized that he’s exactly making analogy between Bragg diffraction gratings and the Fourier transform. The Quantum Fourier transform (QFT) changes the state from a superposition of functions of x to a superposition of functions of r, exactly like transforming from a real space (functions of location, with periodicity, r) to a reciprocal space (functions of momentum, with periodicity, 1/r) of a periodic crystal lattice in a diffraction experiment.


Finally, I want to highlight some common confusions about the three key concepts captured in this comparative cartoon:

It is a funny phenomenon that often three classes into the entire 20+ course, there are people who argue with me, claiming that entanglement does mean “instantaneous change”, just because Einstein famously (and misleadingly) said “spooky interaction at a distance”. If this drawing and my statement here provoke an urge to argue with me or an attempt to make quantum computing mysterious again, I recommend learning first about gates, measurements and teleportation (or other algorithms), rethink, then come back.

The problem with phrases like “instantaneous change” is that it misleads people to think that any kinds of “change” would be instantaneously communicated from one qubit to its entangled qubit. That would violate the principle that no information can travel faster than light. Take the example of (|00⟩+|11⟩)/√2. The “change” that one talks about in entanglement is induced by “measurement”. After a measurement, the system as a whole ends up in one of its possible states, |00⟩ or |11⟩. However, it does so in a way that does not allow any information to be communicated. It would be impossible to set up an instantaneous “telephone” using entangled qubits. “Change” however can include other alterations to the qubits, such as applying a gate. When we apply an X gate to the first qubit, for example, that flips it between 0 and 1. The system becomes (|10⟩+|01⟩)/√2. But it doesn’t instantaneously flip the second qubit. 

Quantum mechanics has nuances and unanswered questions, but quantum computing is definitely not mysterious. You can do it today.

Have a happy learning holiday!

One thought on “A Cat’s Survival Mechanism

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s