# How to prepare a statistical mixture of $|0,0\rangle$ and $|1,1\rangle$ in QuTiP?

A QuTiP novice here. It's easy to prepare a pure state in QuTiP. For example, to prepare $$\frac{1}{\sqrt{2}}(|0,0\rangle + |1,1\rangle)$$:

psi = (ket('00') + ket('11')).unit()
psi = (tensor(basis(2,0), basis(2,0)) + tensor(basis(2,1), basis(2,1))).unit()


But what code would you use to prepare a statistical mixture of $$|0,0\rangle$$ and $$|1,1\rangle$$?

Mixed states are represented by density matrices cf. Density matrices for pure states and mixed states. This is the QuTiP documentation for density matrices; check the 4th example. The ket2dm function takes input a ket or bra vector and returns density matrix formed by the outer product. So say for a 50-50 mixture the following code should work:

from qutip import *
0.5*ket2dm(tensor(basis(2,0), basis(2,0))) + 0.5*ket2dm(tensor(basis(2,1), basis(2,1)))


This returns the required density matrix representing a 50-50 statistical mixture of $$|0,0\rangle$$ and $$|1,1\rangle$$.

Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = True
Qobj data =
[[0.5 0.  0.  0. ]
[0.  0.  0.  0. ]
[0.  0.  0.  0. ]
[0.  0.  0.  0.5]]