All the quantum gate identities fit for print
Welcome to Introduction to Quantum Computing. I am your guide, Associate Professor Chris Ferrie, a researcher in the UTS Centre for Quantum Software and Information. These are the notes for Lab 5. You should have already enjoyed Lecture 5. The syllabus is here:
At this point it is time for you to put in the work. Practice not only makes perfect, but it can also make you even half-way competent! I don’t expect the former, but I will accept nothing less than the latter. So let’s get to work and make our hands cramp from bra-keting!
Quantum Rosetta Stone
I remember a physics class in undergrad where we were allowed to bring a “cheat-sheet” into the exam. We could write whatever we wanted on a single side of a Letter-sized piece of paper. The only stipulation? It had to be hand-written. By writing, over and over again, the equations as neatly and compactly as I could in preparation for the exam, I had nearly memorised every formula and even generated my own mnemonics!
Your task will be to generate a few quantum cheat sheets. This will be useful practice and also produce some references you can use throughout the subject. The first will be a cheat sheet of equivalent definitions of various quantum gates. You can find a table of common unitaries in many places, such as the one below from Wikipedia’s Quantum logic gate page.
What’s missing in most of these that you’ll find is the translation to Dirac notation. For example, the identity — which is missing and should also be included — needs to also be written as
The first person that recreates this table with an additional column that contains each operation in Dirac notation (all convenient representations!) gets either a copy of Climate Change for Babies (shipped within Australia) or its equivalent value donated to an environmental charity of their choice. Send proof to me on Twitter: @csferrie. In addition to the first, the person with the best (as arbitrarily judged by me) will receive the same.
Quantum Gate Identities
When we multiply a bunch of simple matrices together, we might end up with a more complicated matrix. In quantum computing, we are usually interested in the reverse procedure where we are given a complicated gate or algorithm and must find a way to decompose it in terms of simpler gates. One you won’t be asked to prove quite yet, but gives you the flavour, is the decomposition of the Quantum Fourier Transform (QFT).
The animation (which was made using Quirk) shows several things. First, the moving parts are cycling each basis state through the circuit. The dots don’t do anything and are just to guide the eye. The fact that the basis states going into the circuit are the same as the ones coming out shows that this circuit implements the identity — it does nothing at all! In other words, wherever I decide to split the circuit, the thing on the left is the inverse of the thing on the right, and vice versa. In this case the interesting split is at the dotted line. The thing on the right (the inverse of the QFT) is the inverse of the thing on the left. That is, the sequence of gates on the left implements the QFT.
But let’s start with some more simple identities. For example, HZH = X. Can you show this?
(Note that in the following animations, the gates on the right of the dots should be the inverse of the displayed gate. However, in all of the cases we look at below the gates are self-inverse, and so it works out the same.)
There are many ways you can do this given the equivalent representations that you listed in your Quantum Rosetta Stone. The first is to write out the matrices and perform the matrix multiplication.
This is equivalent to performing the calculation using Dirac notation.
Another way is to see what happens to the computational basis for each circuit. This is similar to how we will analyse more complicated quantum circuits, but for all basis states instead just one.
The above animation shows a similar identity HXH = Z. Try that one out on your own. The next one is a little more challenging, but uses the identity we just proved!
The trick is to recognize different representations of operators. For example, the identity matrix is |0⟩⟨0| + |1⟩⟨1|, but also |+⟩⟨+| + |−⟩⟨−|.
Here’s another identity using the CNOTs. The object on the right is the SWAP gate which switches the states on either side of the tensor product. Intuitively, it is its own inverse.
With only CNOTs in the following circuit, it is much easier to prove the identity by tracking the basis elements.
I’ll leave you with one more to try on your own. It is similar to the previous one but requires three qubits.
If you prove it, try to play with Quirk and create your own identities. Good luck!
The Quantum Katas is a learning resource, much surrounding the use of the Microsoft Quantum Development Kit. It contains many exercises at the introductory
The Qiskit Textbook has many exercises scattered throughout.