The purity of a quantum state is a important concept in quantum mechanics and quantum information theory, representing how mixed or pure a quantum system is. Mathematically, the purity of a quantum state is defined using the density matrix formalism. For a given quantum state represented by a density matrix
, the purity
is given by:
![]()
Here,
denotes the trace operation. The purity value ranges from 0 to 1, where
indicates a pure state, and
indicates a mixed state. A pure state is one that can be described by a single wave function, whereas a mixed state represents a statistical ensemble of different quantum states.
In the context of quantum machine learning, particularly when using frameworks such as TensorFlow Quantum, the purity of quantum states is essential for understanding the coherence properties of quantum circuits and the performance of quantum algorithms. Quantum machine learning often involves manipulating quantum states and measuring their properties to train and evaluate quantum models.
Experimentally measuring the purity of a quantum state involves several steps, typically requiring quantum state tomography. Quantum state tomography is a process used to reconstruct the density matrix of a quantum state by performing a series of measurements in different bases. Once the density matrix
is obtained, its purity can be calculated using the formula mentioned earlier.
To illustrate this with an example, consider a simple quantum system consisting of a single qubit. If the qubit is in a pure state
, its density matrix is
. For instance, if the qubit is in the state
,
![]()
The purity of this state is:
![Rendered by QuickLaTeX.com \[ \gamma = \text{Tr}(\rho^2) = \text{Tr}\left(\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}^2\right) = \text{Tr}\left(\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}\right) = 1 \]](https://eitca.org/wp-content/ql-cache/quicklatex.com-59ded817fb311d8418aaa76309acecf9_l3.png)
This confirms that the state is pure. For a mixed state, such as the maximally mixed state of a single qubit,
![]()
The purity is:
![Rendered by QuickLaTeX.com \[ \gamma = \text{Tr}(\rho^2) = \text{Tr}\left(\left(\frac{1}{2}\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}\right)^2\right) = \text{Tr}\left(\frac{1}{4}\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}\right) = \frac{1}{2} \]](https://eitca.org/wp-content/ql-cache/quicklatex.com-ad8cdfcb4fe14598d4275d45c7fe4440_l3.png)
This indicates a mixed state.
In the experimental realm, especially when dealing with quantum circuits implemented on quantum processors, measuring purity can be more complex due to noise and imperfections in the hardware. Quantum state tomography requires a large number of measurements to accurately reconstruct the density matrix, which can be resource-intensive. Advanced techniques such as compressed sensing tomography and machine learning-based approaches are being developed to improve the efficiency and accuracy of quantum state reconstruction.
TensorFlow Quantum, an open-source library for quantum machine learning, provides tools to simulate quantum circuits and measure properties of quantum states. It integrates with TensorFlow to enable hybrid quantum-classical machine learning models. In TensorFlow Quantum, one can define quantum circuits using Cirq, a Python library for quantum computing, and then use TensorFlow to build and train machine learning models that process quantum data.
For example, consider a quantum circuit that prepares a Bell state, which is a maximally entangled state of two qubits:
![]()
The density matrix for this state is:
![Rendered by QuickLaTeX.com \[ \rho = |\psi\rangle\langle\psi| = \frac{1}{2}\begin{pmatrix} 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 1 \end{pmatrix} \]](https://eitca.org/wp-content/ql-cache/quicklatex.com-335570a8753927f043a327e05a1fa7f8_l3.png)
To measure the purity of this state using TensorFlow Quantum, one would first simulate the circuit to obtain the density matrix and then compute the purity. The following code snippet demonstrates this process:
python
import tensorflow as tf
import tensorflow_quantum as tfq
import cirq
import sympy
import numpy as np
# Define a quantum circuit to prepare a Bell state
qubits = [cirq.GridQubit(0, 0), cirq.GridQubit(0, 1)]
circuit = cirq.Circuit()
circuit.append(cirq.H(qubits[0]))
circuit.append(cirq.CNOT(qubits[0], qubits[1]))
# Convert the circuit to a TensorFlow Quantum circuit
tfq_circuit = tfq.convert_to_tensor([circuit])
# Define the density matrix observable
density_matrix = tfq.layers.State()
rho = density_matrix(tfq_circuit)
# Compute the purity
purity = tf.linalg.trace(tf.linalg.matmul(rho, rho))
print("Purity:", purity.numpy())
In this example, the `cirq` library is used to define a quantum circuit that prepares a Bell state. The circuit is then converted to a TensorFlow Quantum tensor, and the `tfq.layers.State` layer is used to obtain the density matrix of the state prepared by the circuit. Finally, the purity is computed by taking the trace of the square of the density matrix.
Quantum machine learning algorithms often rely on the coherence properties of quantum states to achieve quantum advantage. Coherence refers to the ability of a quantum system to exhibit superposition and entanglement, which are essential for many quantum algorithms. The purity of a quantum state is directly related to its coherence, as a pure state can maintain coherence, while a mixed state may lose coherence due to decoherence and noise.
In the context of quantum supremacy experiments, such as those involving random quantum circuits, measuring the purity of quantum states can provide insights into the performance and fidelity of the quantum processor. Random quantum circuits are used to demonstrate quantum supremacy by generating quantum states that are difficult to simulate classically. The purity of the states produced by these circuits can serve as an indicator of the quantum processor's ability to maintain coherence and perform complex quantum operations.
For example, in Google's quantum supremacy experiment, random quantum circuits were used to generate quantum states on a 53-qubit processor. The fidelity of the quantum states was measured by comparing the experimental results with classical simulations. The purity of the quantum states played a important role in assessing the performance of the quantum processor and demonstrating quantum supremacy.
The purity of a quantum state is a fundamental concept in quantum mechanics and quantum information theory, representing the degree to which a quantum state is pure or mixed. Mathematically, purity is defined as the trace of the square of the density matrix. Experimentally measuring purity involves quantum state tomography, which can be resource-intensive but is essential for understanding the coherence properties of quantum states. In the context of quantum machine learning, frameworks like TensorFlow Quantum provide tools to simulate quantum circuits, measure quantum state properties, and integrate quantum data into machine learning models. The purity of quantum states is important for evaluating the performance of quantum algorithms and quantum processors, especially in quantum supremacy experiments involving random quantum circuits.
Other recent questions and answers regarding Examination review:
- What are the challenges and advantages of using speckle purity benchmarking compared to traditional quantum state tomography for assessing the coherence of quantum states?
- What role does the Porter-Thomas distribution play in the analysis of quantum circuits using cross-entropy benchmarking (XEB)?
- How does speckle purity benchmarking differ from cross-entropy benchmarking (XEB) in terms of extracting coherence information from quantum circuits?
- What is the foundational concept behind cross-entropy benchmarking (XEB) and how is it used to measure the fidelity of quantum circuits?

