I have this Quantum Fourier Transform (QFT) and I want to know how to find the final state of each qubit if q0, q1, q2 start in the states $|0\rangle$, $|1\rangle$, $|0\rangle$.

Do I go along the wire of each qubit and multiply the operations together. i.e. for q_0:

$|q_0\rangle = |0\rangle * H$

For $|q_1\rangle$: $|q_1\rangle = |1\rangle * H$

For $|q_2\rangle$: $|q_2\rangle = |0\rangle * H * P(\pi/2)$

Then swap for $|q0\rangle$ and $|q2\rangle$?

Also is there any software that can find the states of the qubits before being measured?

(The circuit is from the Qiskit implementation) enter image description here


2 Answers 2


You can get the individual state of each qubit as long as they don't get entangled. For example, you cannot write the Bell state $|00\rangle+|11\rangle$ (normalized) as a tensor product. Therefore, in this case, you cannot get the individual state of each qubit.

For your example, you can get the individual states. I would do it by doing all operations to the tensor product of all three qubits and then just extracting the state of each qubit from the final state. I'm not going to do all of this since that calculation can be found in the Qiskit textbook section linked below.

From the Qiskit textbook section where you got that circuit from (3.5.6), you can see that the final state is the following. (I just adapted the qubit ordering and indexing so that it is $|q_2q_1q_0\rangle$).

$$ \frac{1}{\sqrt{2}}\left(|0\rangle+\exp\left(\frac{2\pi i}{2}q_2 + \frac{2\pi i}{2^2}q_1 + \frac{2\pi i}{2^3}q_0\right)|1\rangle\right) \otimes \frac{1}{\sqrt{2}} \left(|0\rangle + \exp\left( \frac{2\pi i}{2}q_1 + \frac{2\pi i}{2^2}q_0 \right)|1\rangle\right) \otimes \frac{1}{\sqrt{2}} \left(|0\rangle + \exp\left( \frac{2\pi i}{2}q_0\right)|1\rangle\right) $$

Therefore, the state of $q_0$ is $$\frac{1}{\sqrt{2}} \left(|0\rangle + \exp\left( \frac{2\pi i}{2}q_0\right)|1\rangle\right)$$

The state of $q_1$ is

$$\frac{1}{\sqrt{2}} \left(|0\rangle + \exp\left( \frac{2\pi i}{2}q_1 + \frac{2\pi i}{2^2}q_0 \right)|1\rangle\right)$$

And the state of $q_2$ is

$$ \frac{1}{\sqrt{2}}\left(|0\rangle+\exp\left(\frac{2\pi i}{2}q_2 + \frac{2\pi i}{2^2}q_1 + \frac{2\pi i}{2^3}q_0\right)|1\rangle\right) $$

Plugging in the values for your initial state, you will get the final state for each qubit.


In the above, qubits $q_0$ and $q_2$ are not swapped. Thus, in reality, the final state of the qubits would be the other way. $q_0$ would be in the state of $q_2$ and viceversa. And $q_1$ remains the same.


You can do this pretty easily with Qiskit, assuming you already have the quantum circuit as a variable qc you can do something like:

from qiskit import QuantumCircuit
init_qc = QuantumCircuit(3)
init_qc.initialize(2)  # initialize to 0 1 0
qc.compose(init_qc, front=True, inplace=True)

Which will insert the initialize your circuit to |010> (if you don't have the circuit object already just call initialize before you populate the other gates). Then with your initialized circuit you can do:

from qiskit.quantum_info import Statevector

statevector = Statevector(qc)

the variable statevector there will be Statevector object which is basically a wrapper around a numpy array representing the statevector for your circuit in it's current state (without measurements). When I run that on your circuit (unless I made a mistake transcribing the example diagram) I get:

Statevector([ 3.53553391e-01+0.j        ,  2.16489014e-17+0.35355339j,
             -3.53553391e-01+0.j        , -2.16489014e-17-0.35355339j,
              3.53553391e-01+0.j        ,  2.16489014e-17+0.35355339j,
             -3.53553391e-01+0.j        , -2.16489014e-17-0.35355339j],
            dims=(2, 2, 2))
  • $\begingroup$ Thank you very much! I know how to get the overall state of the entire circuit, like you suggested, but is there any way to get the state of each individual qubit? $\endgroup$
    – John
    Jun 25, 2021 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.