What are density matrices and how do they work? I have looked in Stack Exchange about density matrices but haven't found any answers. What are density matrices and how do they work? What are they used for?
(Also, please tell me what is wrong with my question or whether there was a duplicate I didn't find so I can fix this question or delete it.)
 A: A density matrix is a matrix that describes a quantum system in a mixed state, a statistical ensemble of several quantum states. This should be contrasted with a single state vector that describes a quantum system in a pure state. The density matrix is the quantum-mechanical analogue to a phase-space probability measure (probability distribution of position and momentum) in classical statistical mechanics. 
UPDATE: 
Explicitly, suppose a quantum system may be found in state $| \psi_1 \rangle $with probability $p1$, or it may be found in state $| \psi_2 \rangle$ with probability $p2$, or it may be found in state $| \psi_3 \rangle$ with probability $p3$, and so on. The density operator for this system is
$$\hat \rho = \sum_i p_i | \psi_i \rangle \langle \psi_i|,$$
where $\{|\psi_i\rangle\}$ need not be orthogonal and $\sum_i p_i=1$. By choosing an orthonormal basis $\{|u_m\rangle\}$, one may resolve the density operator into the density matrix, whose elements are 
$$\rho_{mn} = \sum_i p_i \langle u_m | \psi_i \rangle \langle \psi_i | u_n \rangle = \langle u_m |\hat \rho | u_n \rangle.$$
The density operator can also be defined in terms of the density matrix,
$$\hat \rho = \sum_{mn} |u_m\rangle \rho_{mn} \langle u_n| $$
For an operator $\hat A$ (which describes an observable A of the system), the expectation value $\langle A \rangle$ is given by 
$$\langle A \rangle = \sum_i p_i \langle \psi_i | \hat{A} | \psi_i \rangle = \sum_{mn} \langle u_m | \hat\rho | u_n \rangle \langle u_n | \hat{A} | u_m \rangle = \sum_{mn} \rho_{mn} A_{nm} = \operatorname{tr}(\rho A)$$
In words, the expectation value of A for the mixed state is the sum of the expectation values of A for each of the pure states $|\psi_i\rangle$ weighted by the probabilities pi and can be computed as the trace of the product of the density matrix with the matrix representation of A in the same basis.
For more details see:
http://en.wikipedia.org/wiki/Density_matrix 
