Playing with the Bloch Sphere

Share this post:

How we made a game of learning Qubits


In this article we will briefly show the tool we built while learning quantum computing; alas, this article is not about teaching these concepts. We will be covering these in a series of articles soon.



At the start of our journey we were learning about qubits, and basic operations on them. A qubit (or Qbit) is a quantum bit. While a normal bit is represented as a simple one or zero, a Qbit is the state of a quantum particle, and thus has superposition. This means it can inhabit the space between one and zero. This complex state can be represented in lots of different ways.

For example, a simple base “0” can be shown as as the sum of “Ks”. This says: “The state is made of one lot of zero, and no ones.”

|φ> = 1|0> + 0 • |1>

Here it is as a single ket shorthand. This says: “It’s all made of the zero state.”


Here it is as a vector. The first row is the amount of zero we have (one) and the second is the amount of one we have (zero).

Here it is as a Bloch Sphere. This is probably the most common visualisation we use. The amount of of the zero state and the one state we have are both complex numbers. They have real and imaginary parts. Two numbers with two degrees of freedom means 4 degrees of freedom (or a 4D number if you will). However, because the squares of these numbers must add up to one, we lose a degree of freedom, and can cram this 4D number into “3D” space and draw it as points on the surface of a sphere.  

The more we dove into this the harder and less intuitive it became for computer scientists like us. How, for example, do you get from the |φ> = α•|0> + β• |1>  representation to working out the angles θ and φ in the bloch sphere?

I won’t leave you hanging, because we had to work it out ourselves after not finding it anywhere we searched:

Θ = 2cos-1(α)  


φ = log(β/sin(Θ/2))/i

Then it comes time for Quantum Gates, which are linear maps that you apply to a Qbit. For example, the Pauli Gates:

The way these gates are applied is to multiply them by the Qbits’ vector. They are described at 180-degree rotations around the X,Y,Z axis of the Bloch sphere. Except that’s not exactly true.

You see, the Bloch sphere is a really useful lie. It’s a way of cramming a number with degrees of freedom into 3D space, which means it does strange things.

Let’s take the X,Y gates for example. If they were true 180-degree rotations as you were expecting, then |0> (shorthand for zero) would flip |1> (shorthand for one) and vice versa. The X gate does this; well done X gate. The Y gate, however, flips |0> to |i> (imaginary one).

This is all really confusing, and we will be writing some articles about it in the near future to explain it. Right now however, we want show you the tool we built to help us understand it all.

This was built in Unity3D at IBM’s Emerging Tech Labs. It represents the Qbit internally as two complex numbers, and then translates this into 3D animations so you can visualize what on earth is going on while at the same time viewing the maths though the UI.

If you want to download and play with it, the public github is here:


A 3D Unity Application for working with Bloch Spheres – GwilymNewton/BlochSphereExplorer-

We also have a video of it action:


More Innovation stories

Emerging Technology supports Project Owl within IBM Corporate Service Corps Deployment

In March 2019, Dan Cunnington from Emerging Technology was deployed to Puerto Rico to help facilitate the field testing of the winning Call for Code solution – Project Owl. As part of the grand prize, Project Owl won a field testing opportunity supported by IBM Corporate Service Corps to field test their winning solution on […]

Continue reading

Helping Disabled Passengers Travel with Confidence

Introduction Disabled or disadvantaged passengers have every right to fear travelling with multiple high profile cases of unfair and appalling levels of service evident in the media, particularly for rail passengers. Our team have been tackling this problem recently in collaboration with the IBM Travel and Transport team and 50% funding through Innovate UK’s call […]

Continue reading

Fully automatic method for robust age progression

In Emerging Technology, we are constantly working on new research projects around security and biometrics. Since late last year, I spent some time researching age progression related problems using biometrics. One of the interesting problems with age progression was to create age progressed images with occlusions and in different age gaps for face subjects of […]

Continue reading