Qiskit: Bloch Sphere

In previous chapter of this Qiskit Tutorial, you learned about representing the state of a Qubit in terms of |0> and |1> basis pairs. The state of a Qubit can also be represented on a Bloch Sphere. In this chapter of the Qiskit tutorial, you will learn about the Bloch Sphere, how the states of a Qubit can be represented on the Bloch Sphere, and how you can plot Bloch Sphere in Qiskit.


Bloch Sphere

Bloch(pronounced as Block) Sphere is a way of representing a Quantum State. It is a sphere with its centre at the origin and radius of 1 unit. Each point on the surface of the sphere corresponds to a possible Quantum State that the Qubit can be in. The vector from the centre of the sphere to the point on the sphere represents the state of the Qubit.

On the Bloch Sphere, the state |0> is on the “north-pole” of the sphere(along the positive z-axis), i.e, at the coordinate x = 0, y = 0, z = 1. Whereas, the state |1> is on the “south-pole” of the sphere(along the negative z-axis), i.e, at the coordinate x = 0, y = 0, z = -1.

Plotting Bloch Sphere for states |0> and |1> in Qiskit

Similar to the |0> and |1> basis pairs, there are a few other standard basis pairs, such as- |+> and |->, and |i> and |-i>

The state |+> has the co-ordinates x = 1, y = 0, z = 0 and the state |-> has the co-ordinates x = -1, y = 0, z = 0.

Similarly, the state |i> has the co-ordinates x = 0, y = 1, z = 0 and the state |-i> has the co-ordinates x = 0, y = -1, z = 0.

It is important to note that the Bloch Sphere is a way to represent the state of the Qubit and is not a representation of the Qubit itself.

Note– The angles on the Bloch Sphere are twice as large. For example, while the vectors |0> and |1> are orthonormal, the angle between them on the Bloch Sphere is 180°.


Representing a State on Bloch Sphere

Any Quantum State can be represented by a point on the Bloch Sphere. To define any point on the Bloch Sphere(or any other sphere), we need just 2 parameters.

On the Bloch Sphere, these parameters turn out to be θ- the angle made by the vector from origin to the point with the positive z-axis.

The angle made between Z axis and state vector is θ

The other parameter is ɸ- the angle made by the projection of the vector on the xy-plane with the positive x-axis.

The angle made between XY plane and state vector is ɸ

Note– In last chapter you learned that any Quantum State can be represented as ψ = α|0> + β|1>, where α and β are complex numbers. The state of the Qubit can also be defined as ψ = α|0> + eiɸ β|1>, where α, β and ɸ are real numbers instead of complex numbers. Here, ɸ represents the phase of the Qubit(the angle made between the projection of the vector on xy-plane and positive x-axis). Therefore, the value of both α and β is dependent on θ. In terms of the value of θ, α = cos(θ/2), and β = sin(θ/2).
Since both α and β are dependent on the value of θ, the probabilities of both, measuring 0 and 1 are dependent on θ.

The state of a Qubit can be defined in terms of θ and ɸ as-

Defining state of Qubit in terms of angles on the Bloch Sphere

Where, α, β, ɸ, and θ are all real numbers.

Notice that the equations defining the state of the Qubit define the state in terms of θ/2 and not θ. This is because the angles on the Bloch Sphere are twice as large.


Bloch Sphere in Qiskit

You can plot the Bloch Sphere representation of a Qubit using Qiskit. You need to import the plot_bloch_vector function from qiskit.visualization

You can plot the Bloch Sphere for a Qubit by passing the plot_bloch_vector function the coordinates of the point on the sphere to which the vector from the centre of the sphere should point. For example, to represent the state |0> which lies on the ‘north pole’ of the Bloch Sphere, the coordinates of the point x = 0, y = 0, z = 1 need to be passed to the function as a list. Optionally, the label for the Bloch Sphere diagram can also be passed with the title parameter.

# Plotting a Bloch Sphere for the state |0>
plot_bloch_vector([0, 0, 1], title="Bloch Sphere for state |0>")

The output of this code will be-

Plotting Bloch Sphere for state |0> in Qiskit