I was going through the qiskit documentation to see if there was a way to represent a mixture of quantum states as a density matrix or otherwise. Is there a way to do it? If so, how?


The short answer is: no.

The long answer is that only pure states can be encoded in Qiskit. However, there are ways around this. For example, by 'purifying' the state. For example, suppose you wanted the mixture

$$ \rho = p_0 |0\rangle\langle0| + p_+ |+\rangle\langle+|. $$

You could do this by creating the entangled state

$$ \psi = \sqrt{p_0} |00\rangle \sqrt{p_+} |1+\rangle. $$

In this, each term represents a term from the desired mixed state. The state of the rightmost qubit in each term corresponds to one from the desired mixture. Each term has a unique state from an orthonormal basis on the left most qubit. The amplitude for each term is the square root of the corresponding probability from the mixture.

Given these properties, the reduced density matrix for the rightmost qubit behaves exactly as the desired mixed state. We just need to leave the leftmost qubit out of any gates we perform, and not measure it at the end.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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