A density matrix is a mathematical representation used in quantum mechanics to describe the statistical state of a quantum system, encompassing both pure states and mixed states. It provides a complete description of the system's statistical properties, allowing for the calculation of expectation values and probabilities for various measurements.