Get the probability amplitudes of the 0 and 1 states of a single qubit in Qiskit considering a system of multiple qubits

I am looking for a method to get the values of $$\alpha$$ and $$\beta$$ probability amplitudes of each single qubit in a multiple qubit system. Is that possible?

As you can see in the image, I have a 4-qubit quantum circuit. I want to read the values of the amplidues in each qubit individually.

Here I used the Aer simulation for getting the statevector, but this for the states of the whole quantum system, i.e. 0000, 0001, 0010, ..., 1111, if I get this right.

• Do you know the angles beforehand or are you considering 4 qubits in random/unknown states? Also when you say "read the values" do you mean so that qiskit simulates the statevector or do you want to do some measurement? Aug 26, 2021 at 16:00
• are you asking for the code to do it in qiskit, or the formulas to go from a Bloch sphere representation to the amplitudes of the corresponding ket vector? Also, if you are referring to a four-qubit state, this cannot be represented as four Bloch vectors (unless you have a product state)
– glS
Aug 26, 2021 at 18:00
• Hi and welcome to Quantum Computing SE. To get $\alpha$ and $\beta$ you have to carry out a quantum tomography. Measuring in standard basis allows you to get only $|\alpha|^2$ and $|\beta|^2$, i.e. probabilities. Concerning the tomograhpy, you may be interested in this part of Qiskit documentation: qiskit.org/documentation/tutorials/noise/8_tomography.html Aug 26, 2021 at 18:07
• @Mauricio I start in a superposition state applying hadamard gates to all qubits and then I rotate them using QGates but I need maybe a function or code example where it lets me read out the probability amplitudes of each qubit individually. I dont want to make any measurements in order not to destroy the state. I just need to simulate and read the values out maybe. Actually I used the statevector but this gives me a 16 entry matrix which are the probabilities of having 0000, 0001, 0010 and so on to 1111. I added above (in the main question) a screenshot explaining what I exactly meant here Aug 27, 2021 at 8:37
• @glS I am asking about the code to do it in qiskit since the statevector simulation using the Aer simulator (as I recently added to the question) delivers the states of the whole 4 qubit system and not for each single qubit Aug 27, 2021 at 8:40

It is always useful to check the documentation: https://qiskit.org/documentation/_modules/qiskit/visualization/state_visualization.html You can see there the source code for all visualization tools in qiskit.visualization.

The function plot_bloch_multivector is somehow factorizing the state and converting the statevector data into products of individual qubit vectors in the Bloch sphere.

The steps are the following, import the factorization routine called _bloch_multivector_data as follows:

from qiskit.visualization.utils import _bloch_multivector_data

and then store the data of your multivector called state as

bloch_data = (_bloch_multivector_data(state))

each bloch_data[i], for i=0,1,2,3 has three entries with correspond to the i-th qubit in Cartesian coordinates ($$x,y,z$$), which can be used to get the angles.

For example if you chose qubit 2 qubitvector=bloch_data[2] then its coordinates are :

• qubitvector_x=qubitvector[0] for $$x$$,
• qubitvector_y=qubitvector[1] for $$y$$,
• qubitvector_z=qubitvector[2] for $$z$$.

The angles can be retrieved by looking at the definition of the spherical coordinates (in a unit sphere):

• the azimuthal angle is given by $$\tan \varphi = y/x$$, and
• the polar angle is given by $$\cos \theta = z$$.

Disclaimer: this procedure works only for products of single qubit states. This procedure will not work if you use any entangling gates (gates that apply to more than one qubit like CNOT) in your quantum circuit.

• Thanks. That really helps I believe Aug 27, 2021 at 11:23
• @GeoNasr Sorry the original answer was a bit messy, I just updated the link and the steps. Aug 27, 2021 at 11:32