Visualizations

Circuit Composer lets you see how quantum circuits affect the state of a collection of qubits through three types of visualizations. Each type of visualization is explained in detail below.

View visualizations

You can view the visualizations by selecting the Visualizations tab to the left of the editor.

visualization tab

The Visualizations tab, highlighted by a blue square, is labeled by an icon of a histogram.

Download visualizations

You can download a visualization by selecting the three stacked lines to the upper right of a visualization. You can download visualizations as an SVG, a PNG, or a CSV of the underlying data.

downloading a visualization

How to download a visualization.

Statevector view

This view visualizes the statevector as a histogram. The horizontal axis labels the computational basis states. The vertical axis measures the magnitude of the amplitudes associated with each computational basis state. The color of each bar represents the phase angle of each amplitude.

Consider the following quantum circuit and its statevector view:

a quantum circuit

A quantum circuit.

statevector view

The statevector view of the circuit above.

phase colormap

The colormap for phase angle.

The circuit puts a qubit in the state |\psi\rangle = (|0\rangle + i |1\rangle) / \sqrt{2} . The computational basis states are |0\rangle and |1\rangle . The magnitudes of the amplitudes are both 1/\sqrt{2} . The phases of the amplitudes are 0 and \pi/2 for |0\rangle and |1\rangle , respectively.

Density matrix view

This view visualizes the density matrix as a pair of heatmaps. The real and imaginary parts of the density matrix are each shown in their own heatmap. The horizontal and vertical axes label the computational basis states. The color of each cell represents the value of the real or imaginary part of the density matrix.

Consider the following quantum circuit and its density matrix view:

a quantum circuit

A quantum circuit.

real part of density matrix

The real part of the density matrix view of the circuit above.

imaginary part of density matrix

The imaginary part of the density matrix view of the circuit above.

The circuit puts a qubit in the state |\psi\rangle = (|0\rangle + i |1\rangle) / \sqrt{2} . The computational basis states are |0\rangle and |1\rangle . The density matrix is

\begin{split}\begin{bmatrix} \langle 0 | \psi \rangle \langle \psi | 0 \rangle & \langle 0 | \psi \rangle \langle \psi | 1 \rangle \\ \langle 1 | \psi \rangle \langle \psi | 0 \rangle & \langle 1 | \psi \rangle \langle \psi | 1 \rangle \end{bmatrix} = \frac{1}{2} \begin{bmatrix} 1 & -i \\ i & 1 \end{bmatrix}\end{split}

Measurement probabilities view

This view visualizes the measurement probabilities as a histogram. The vertical axis labels the computational basis states. The data labels to the right of the horizontal bars label the measurement probabilities of each computational basis state in terms of percentages. The probabilities P_i are related to the amplitudes \alpha_i of the computational basis states |i\rangle according to P_i = |\alpha_i|^2 .

Consider the following quantum circuit and its measurement probabilities view:

a quantum circuit

A quantum circuit.

measurement probabilities view

Measurement probabilities view of the circuit above.

The circuit puts a qubit in the state |\psi\rangle = (|0\rangle + i |1\rangle) / \sqrt{2} . The measurement probabilities are

P_0 = |\langle 0 | \psi \rangle|^2 = |1/\sqrt{2}|^2 = 1/2 = 50\% ,
P_1 = |\langle 1 | \psi \rangle|^2 = |i/\sqrt{2}|^2 = 1/2 = 50\% .

Q-sphere view

The q-sphere represents the state of a system of qubits by associating each computational basis state with a point on the surface of a sphere. A ball is placed at each point. Each ball’s radius is proportional to the magnitude of its basis state’s amplitude. Each ball’s color marks the phase angle of its basis state’s amplitude.

The balls are laid out on the q-sphere so that the basis state with all zeros (e.g., |000\rangle) is at its north pole and the basis state with all ones (e.g., |111\rangle ) is at its south pole. Basis states with the same number of zeros (or ones) lie on a shared latitude of the q-sphere (e.g., |001\rangle, |010\rangle, |100\rangle ). Beginning at the north pole of the q-sphere and progressing southward, each successive latitude has basis states with a greater number of ones.

Note

The q-sphere of a single-qubit system is not a Bloch sphere.

Consider the following quantum circuit and its q-sphere:

a quantum circuit

A quantum circuit.

a q-sphere

The q-sphere of the state created by the circuit above.

The circuit puts a qubit in the state |\psi\rangle = (|0\rangle + i |1\rangle) / \sqrt{2} prior to measurement. The basis state |0\rangle is associated with the ball at the north pole of the q-sphere. The basis state |1\rangle is associated with the ball at the south pole of the q-sphere. The two amplitudes have the same magnitude, so the balls have equal radii. The color of each ball marks the phase angle, as labeled by the color wheel below the q-sphere.

You can select, hold, and drag to rotate the q-sphere. To return the q-sphere to its default orientation, select the rewind-arrow button to the top right of the q-sphere.

a q-sphere, rotated

The q-sphere described above, rotated.