I wish to initalise the state $\rho=(1-\frac{p}{2})|0\rangle \langle0|+\frac{p}{2}|1\rangle\langle1|$, where p is some measure of decoherence. This is a mixed state. There are some suggestions on here for how to implement this with ancilla qubits and extra gates. However I am now trying to run a quantum circuit with this as my initial state on the actual IBM quantum computers. The problem is that to intialise two qubits in this state requires 6 ancilla qubits using my current approach, meaning I have to use the Melbourne quantum computer which has moderately high gate error rates. It also increases my circuit depth. In order to simplify my circuit I tried something like this

    circuit2 = QuantumCircuit(3,3);

Although this is statistically correct over many runs it does not give what I want. In each run of the quantum circuit (say 1000 shots), the same intial state is used for all 1000 shots. Is there any way I can make it so that the circuit reevaluates what the initial state should be for each shot?

I do not wish to have to set the number of shots to 1 and evaluate the circuit thousands of times, as the queue time to get my circuit evaluated would be huge.

  • $\begingroup$ A general comment - you can always purify a mixed state of rank $r$ using some $r$ dimensional purifying system. Since your rank here is 2, you only need one qubit in the purifying system as explained in the answer. $\endgroup$
    – rnva
    Commented Sep 30, 2020 at 14:18

1 Answer 1


Why do you need 6 ancilla qubits? Surely you'd just produce the two-qubit state $$ \sqrt{1-p/2}|00\rangle+\sqrt{p/2}|11\rangle $$ by starting with two qubits in $|00\rangle$, performing a single qubit unitary that maps $|0\rangle\rightarrow \sqrt{1-p/2}|0\rangle+\sqrt{p/2}|1\rangle$ (this is a $Y$ rotation of a suitable angle), and then perform a controlled-not controlled from that qubit, targeting the other. The reduced density matrix of either qubit is then what you want (but you should only use one of the two qubits in subsequent measurements etc).

  • $\begingroup$ I don't think your method is equivalent. The CNOT will produce either $\sqrt{1-p/2}|00>+\sqrt{p/2}|01>$ or $\sqrt{1-p/2}|00>+\sqrt{p/2}|10>$ depending on which qubit is the target. The reduced density matrix is either the $|0>$ state or the pure state $\sqrt{1-p/2}|0>+\sqrt{p/2}|1>$. It is possible that this state produces the statistics I want but if this is true, I can simply initialise a single qubit in this manner without the need for an ancilla $\endgroup$
    – LOC
    Commented Sep 30, 2020 at 10:31
  • $\begingroup$ No, it produces the two-qubit state that I said it does, one qubit of which has exactly the single-qubit density matrix you're asking for. $\endgroup$
    – DaftWullie
    Commented Sep 30, 2020 at 10:58
  • $\begingroup$ Okay I do not see how this is true. First of all, if I perform two single qubit unitaries each of which map $|0>$ to $\sqrt{1-p/2}|0>+\sqrt{p/2}|1>$, the two qubit state is $(1-p/2)|00>+(\sqrt{1-p/2}\sqrt{p/2})(|01>+|10>)+p/2|11>$ instead of $\sqrt{1-p/2}|00>+\sqrt{p/2}|11>$ is it not? Taking the partial trace of this after a CNOT then does not give me a mixed state $\endgroup$
    – LOC
    Commented Sep 30, 2020 at 23:35
  • $\begingroup$ You perform ONE single qubit unitary, giving you the oveall state $\sqrt{1-p/2}|00\rangle+\sqrt{p/2}|10\rangle$, where the first qubit is the qubit I've applied the unitary to. THEN you apply controlled-not $\endgroup$
    – DaftWullie
    Commented Oct 1, 2020 at 11:19
  • $\begingroup$ Yes okay this makes sense, however this is different to your original answer, hence my confusion $\endgroup$
    – LOC
    Commented Oct 2, 2020 at 0:19

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.