Index
- Quantum States
- Bloch Sphere
- Visualizing a Quantum State
- Deriving the Equation
- Polar Coordinates on a Sphere
- Half-Angles
- Conclusion
Quantum States
In quantum computing, the possible states of a system can be mathematically represented as a linear combination of the vectors and .
Considering a system with only one quantum bit (qubit), we have:
Where .
Bloch Sphere
Without physical meaning, it is a mathematical model used to geometrically represent the state of a qubit, as shown below for the state :
Useful for verifying states in superposition, it can be used to visualize the application of logical operators through the rotation of the state vector.
To be represented on the Sphere, a quantum state can be rewritten in terms of a pair of angles:
Visualizing a Quantum State
Using Qiskit, a development kit written by IBM to create and manipulate quantum states and circuits in Python, it is possible to generate a random state (using the relation above) and visualize the generated vector on the Bloch Sphere.
1. Required Dependencies
- NumPy: For angle calculations.
- Qiskit: For state generation and Bloch sphere rendering.
- Interactive Environment (e.g., Jupyter Notebook): For image display.
- Matplotlib: Required by Qiskit for plotting.
$ pip install numpy matplotlib qiskit ipykernel
import numpy as np
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_bloch_multivector
2. Generating a Random State
First, we can use NumPy methods to create the angles
and
:
theta = np.random.uniform(0, np.pi)
phi = np.random.uniform(0, 2*np.pi)
The angle limitations will be explained later.
With the angles, we create a Statevector
from a list, where the first element represents the
portion of the vector, and the second represents the
portion:
state = Statevector([
np.cos(theta/2),
np.exp(phi * 1.j) * np.sin(theta/2)
])
Note: since in computing i is a commonly used letter, the complex root is represented by
j
.
3. Displaying the state and Bloch Sphere
By executing this code in Jupyter cells, we can display the results of the operations
- writing the state created by
Statevector
in text or LaTeX format - illustrating the Sphere as an image
display(state.draw('LaTeX'))
plot_bloch_multivector(state)
An example output would be:
Deriving the Equation
Let's deduce the equation, showing in a simplified manner why it is valid.
Polar Coordinates
Let be a complex number, such that (where is the imaginary unit).
This number can be represented in the Argand-Gauss plane as a vector with modulus :
We can represent the vector in its polar form, rewriting its sides in terms of the angle between them:
Applying Euler's Formula, we have:
Thus, we can rewrite the state vector as:
Simplifying the Vector
In summary, the “global phase” is a mathematical representation of the phase of a quantum system, consisting of a factor that multiplies a state without altering its physical properties.
That is, we can multiply the state vector by its global phase while maintaining the described relations:
Let :
We can also rewrite one of the coefficients in the form , since the original coefficients ( and ) are complex:
As this notation is equivalent to the original, the vector remains normalized, that is:
This last equation represents a sphere in a three-dimensional space, meaning that the state vector can be represented on a sphere.
Polar Coordinates on a Sphere
Analogous to a two-dimensional vector, a three-dimensional vector ( ) on a sphere can have its components written in polar form as:
Where:
- is the angle formed between the vector and the axis;
- is the angle formed between the vector and the axis;
- ;
- Normalization ensures that .
Rewriting the vector in polar coordinates, we have:
Half Angles
However, this is not the complete Sphere. To be able to represent any state vector, we restrict the angles such that:
Thus, we arrive at the general form of a quantum state vector as a function of its angles:
Conclusion
Using this relation, we ensure that the generated state can always be visualized on a Bloch Sphere, which implies that it will always be a valid state.
Top comments (0)