OMG, I’m starting to understand Quantum Computing!

Kathie Wang
6 min readMay 11, 2024

--

Today, I will be writing about a time when I first realized that I was starting to understand quantum computing and some resources that were very helpful for me!

Like many others, I first came across Bloch spheres when I started reading about how quantum states are represented on a qubit. Though it made sense to me that the states represented information of a qubit, I struggled with visualizing them since the sphere represents information in 3D, and all I saw were 2D images! I also read how certain gates were “bit flips” and “phase-flips”, and had a hard time keeping track of which gates did what operation. This was until I came across this website: https://javafxpert.github.io/grok-bloch/

Using this website, you can drag the sphere and rotate it any way you want to see the sphere in different perspectives, see the probability the state will be measured to have state 0, and most importantly, experiment and see what different combinations of gates affect the quantum state!

The Bloch Sphere

First, let me explain how the Bloch sphere works. The Bloch sphere geometrically represents one qubit, or the state of a qubit. It can either be a pure state — when the vectors end at the surface of the sphere (which has a radius of 1) — or a mixed state — when the vectors stop at the interior. If you are unsure of what a term means, such as pure and mixed states, there will be a vocabulary section below to explain them!

Since the Bloch sphere represents three dimensions, the X, Y, and Z axes are drawn to show direction, and the center of the sphere is aligned with the origin (0,0,0). The positive end of the X axis is state |+> (pronounced “ket plus”), and the negative end is state |-> (“ket minus”). Similarly, the positive and negative ends of the Y and Z axes are |i>, |-i> and |0>, |1> respectively.

The Z-axis represents the probability of the qubit being measured as a 0 or a 1, the X-axis represents the real part of the state vector, and the Y-axis represents its imaginary part. Oftentimes we use the Z basis when defining states because quantum computers perform all measurements in the Z basis (also called the standard computational basis).

Image from researchgate.net

Examples

Here are four examples that I find are the most interesting and helped me visualize the purpose of quantum operators the most:

  1. Pauli Gates

Using the website from above, you can see that there are three gate icons in light green. These are known as the Pauli X, Y, and Z gates, and just like all the other gates, they are fundamental to manipulating quantum states. The Pauli X gate is known as a “bit flip” gate because it flips a state 0 to state 1, and vice versa. This is possible because quantum states and operators are represented by matrices, and you can determine the outcome of applying a gate/operator to a state by multiplying the matrices.

You can also think of the X gate as an operator that rotates the current state by π radians of 180 degrees around the X axis. This is tricky to visualize with just a 2D image, so this gif shows what the rotation looks like.

Original source from https://twitter.com/j_bertolotti/status/1142503314287943680

Now that you understand the X gate, the Y and Z gates will also make more sense! All the Pauli gates perform a π radian rotation about their respective axis, and clicking the same gate twice brings you back to its initial state. Something to note is that the Pauli Z gate is called a “phase-flip” because it keeps the probabilities of measuring 0 or 1 the same, but swaps the probabilities of the qubit being + or -.

2. The Hadamard Gate

Now, if you want to “reset” your sphere, you can also set the qubit to state |0>. Then, try clicking on the H gate, which is below the Pauli Z gate. You should see that unlike the Pauli gates that perform a rotation by π radians, it rotates the state by rotation states |0> and |1> to |+> and |+> respectively. Feel free to verify this by applying the H gate after different initial states!

As I mentioned before in previous articles, applying the Hadamard gate puts the state into an equal superposition of the |0> and |1> states. This means that there is an equal probability of measuring the states 0 and 1 — each probability is 1/2. This is shown by the bar on the left side of the Bloch sphere screen, which displays the probability of measuring |0>. When you apply the H gate with the initial state as |0>, the bar changes from a probability of 1 to 0.5, as indicated by the dark “shaded” rectangle. You can also check out the mathematical proof here.

3. Phase Gates

Two more phase gates are the T and S gates. The T gate performs a phase shift of π/4 radian rotation about the Z axis, and the S gate a phase shift of π/2 to the |1> state. There are also Rx, Ry, and Rz gates that are orange. You can also apply Rz (rotation about the Z axis) of θ=π/8 twice to get the same outcome of a T gate. There is also an inverse T and inverse S gate, which is an Rz by -π/4 and -π/2 respectively.

If your sphere is set at state 0, you probably won’t see anything since nothing happens when you are performing a rotation on the Z axis, and the vector is already on the axis. When at state 0, you can then apply the H gate so it’s not on the Z axis to see what the T and S gates do.

4. Combinations of Gates

Now, you can experiment with different combinations of the gates. Some I want to highlight are that applying the order of HZH is the same as an X gate (bit-flip), and the HXH operator is a phase-flip gate since it’s the same as the Z gate. Also, applying two T gates in a row is the same as an S gate, which makes sense since π/4 + π/4 = π/2.

Summary

Today, you learned about how the Bloch sphere works, and some of the basic quantum operators. Some terms may be new to you, so here is a list of key words I think would help you better understand quantum computing.

Pure state: a quantum state whose state can be defined by a single state vector

Mixed state: a quantum state whose state cannot be defined by a single state vector. It is instead defined by a density matrix, and it is essential to representing concepts related to quantum entanglement.

Operator: mathematical constructs that can be represented as a matrix, and transforms an input matrix

Gate: a specific type of operator used in quantum computing that manipulates qubits in a reversible way

Recognizing how these gates affect the final state of a qubit was a key moment for me, so I hope this article helps you understand the Bloch sphere and quantum computing better!

Make sure to check out Vidur’s article here on his “OMG” moment!

Below are some links for further reading:

--

--