# Keyword Analysis & Research: density matrix qiskit

## Frequently Asked Questions

How to find the purity of a density matrix in Qiskit?

In Qiskit, we can easily extract the purity of a density matrix by using the purity () class method. For example, for the pure state |+⟩ | + ⟩, we should expect to see a purity of 1: And, for a mixed state, like ρm = 1 2|0⟩⟨0|+ 1 2|1⟩⟨1| ρ m = 1 2 | 0 ⟩ ⟨ 0 | + 1 2 | 1 ⟩ ⟨ 1 | , we expect a purity of less than 1:

What are the properties of the density matrix?

A very useful property of the density matrix is that when taking the trace Tr Tr of its square ρ2 ρ 2, we obtain a scalar value γ γ that is good measure of the purity of the state the matrix represents. For normalized states, this value is always less than or equal to 1, with the equality occurring for the case of a pure state:

How to generate state |ψcd⟩ | ψ c d ⟩ in Qiskit?

In Qiskit, state |ψCD⟩ | ψ C D ⟩ can be generated using the following circuit: Alternatively, we can express this state in terms of its density matrix ρCD = |ψCD⟩⟨ψCD|: ρ C D = | ψ C D ⟩ ⟨ ψ C D |: And now, we can find the density matrices for the corresponding subsystems C C and D D:

What can we learn from reduced density matrix?

We previously learned that, by the use of the reduced density matrix, we can actually find a representation for each individual part that makes up a composite state, even if the state is entangled. For instance, let's look at the following partially-entangled state: