...

/

Exploring the Quantum States

Exploring the Quantum States

Let’s learn about the implementation of the quantum state.

Let’s have a look at the qubit in action.

Qiskit uses Matplotlib to provide useful visualizations. A simple histogram will do. The result object provides the get_counts method to obtain the histogram data of an executed circuit in line 5.

The method plot_histogram returns a Matplotlib figure in line 8.

We have a 100%100\% chance of observing the value 1.

The measured qubit

Press + to interact
from qiskit.visualization import plot_histogram
import matplotlib.pyplot as plt
# get the probability distribution
counts = result.get_counts()
# Show the histogram
plot_histogram(counts)

Now, let’s move on to a more advanced case. Let’s assume that we want our qubit to result in either 0 or 1 with the same probability, 50:50.

In quantum mechanics, there is the fundamental principle superposition. It says any two or more quantum states can be added together, that is, they can be superposed, and the result will be another valid quantum state.

We already know two quantum states, 0|0\rangle and 1|1\rangle. Why don’t we add them? 0|0\rangle and 1|1\rangle are vectors, and adding two vectors is straightforward.

A vector is a geometric object that has a magnitude or length, and a direction. Usually, vectors are represented by straight arrows, starting at one point on a coordinate axis and ending at a different point.

We can add two vectors by placing one vector with its tail at the other vector’s head. The straight line between the unconnected tail and the unconnected head will be the sum of both vectors. Have a look at the figure “Adding two vectors”.

Mathematically, it is as follows:

u=[u1u2]\vec{u}=\begin{bmatrix}u_1\\u_2\end{bmatrix} and v=[v1v2]\vec{v}=\begin{bmatrix}v_1\\v_2\end{bmatrix} be two vectors.

The sum of u\vec{u} and v\vec{v} is:

u+v=[u1+v1u2+v2]\vec{u}+\vec{v}=\begin{bmatrix}u_1+v_1\\u_2+v_2\end{bmatrix} ...