Quantum Measurement and State Tomography¶
Introduction to Quantum Measurement¶
Quantum measurement is a fundamental aspect of quantum mechanics and quantum computing. It involves extracting classical information from a quantum system. The process of measurement collapses the quantum state into one of the possible eigenstates of the measurement operator. Understanding quantum measurement is crucial for interpreting the results of quantum computations and experiments.
Types of Quantum Measurements¶
Projective Measurement¶
Projective measurement, also known as von Neumann measurement, is the most common type of quantum measurement. It involves projecting the quantum state onto the eigenstates of an observable.
Mathematical Representation¶
If a quantum state is represented by |ψ⟩ and the observable has eigenstates $|φ_i⟩$ with corresponding eigenvalues $λ_i$, the probability of measuring $λ_i$ is given by: $$ P(λ_i) = |\langle φ_i | ψ \rangle|^2 $$ After the measurement, the quantum state collapses to the eigenstate $|φ_i⟩$.
Example¶
Consider a qubit in the state: $$ |ψ⟩ = α|0⟩ + β|1⟩ $$ A projective measurement in the computational basis ${|0⟩, |1⟩}$ will yield the outcome $|0⟩$ with probability $|α|^2$ and $|1⟩$ with probability $|β|^2$.
Positive Operator-Valued Measure (POVM)¶
POVM is a more general form of quantum measurement that allows for a broader range of measurement outcomes. It is described by a set of positive semi-definite operators ${E_i}$ that sum to the identity operator.
Mathematical Representation¶
The probability of obtaining the i-th outcome is given by: $$ P(i) = ⟨ψ|E_i|ψ⟩ $$ POVMs are useful for describing measurements that cannot be represented as projective measurements.
Example¶
Consider a POVM with elements ${E_0, E_1}$ where: $$ E_0 = \frac{1}{2}|0⟩⟨0| + \frac{1}{2}|1⟩⟨1| $$ $$ E_1 = \frac{1}{2}|0⟩⟨0| + \frac{1}{2}|1⟩⟨1| $$ The probabilities of obtaining outcomes 0 and 1 are given by $⟨ψ|E_0|ψ⟩$ and $⟨ψ|E_1|ψ⟩$, respectively.
Quantum State Tomography¶
Quantum state tomography is a process used to reconstruct the quantum state of a system based on measurement data. It is essential for verifying and characterizing quantum states in experiments.
Basic Principles¶
Quantum state tomography involves performing a series of measurements on multiple copies of the quantum state and using the results to reconstruct the density matrix ρ that describes the state.
Steps Involved¶
- Prepare multiple copies of the quantum state: Ensure that the state is prepared identically for each measurement.
- Perform a set of measurements: Measure the state in different bases to gather sufficient data.
- Reconstruct the density matrix: Use the measurement data to reconstruct the density matrix using techniques such as maximum likelihood estimation.
Example Implementation of Quantum State Tomography using Qiskit¶
Setting up the Quantum Circuit¶
from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit.visualization import plot_histogram
from qiskit.quantum_info import Statevector, state_fidelity, partial_trace
from qiskit.quantum_info import DensityMatrix, partial_trace, state_fidelity
from matplotlib import pyplot as plt
# Create a Quantum Circuit with 1 qubit
qc = QuantumCircuit(1)
# Prepare a superposition state
qc.h(0)
# Draw the circuit
qc.draw('mpl')
Performing Measurements¶
# Initialize the simulator
simulator = AerSimulator()
# Add save_statevector instruction to the circuit
qc.save_statevector()
# Simulate the statevector
compiled_circuit = transpile(qc, simulator)
result = simulator.run(compiled_circuit).result()
statevector = result.get_statevector(qc)
# Perform measurements in different bases
measurements = ['x', 'y', 'z']
counts = {}
for basis in measurements:
# Create a new quantum circuit for each basis measurement
qc_basis = QuantumCircuit(1)
qc_basis.initialize(statevector, 0)
if basis == 'x':
qc_basis.h(0)
elif basis == 'y':
qc_basis.sdg(0)
qc_basis.h(0)
qc_basis.measure_all()
result = simulator.run(transpile(qc_basis, simulator)).result()
counts[basis] = result.get_counts()
# Plot the measurement results
for basis, count in counts.items():
print(f'Measurement in {basis}-basis: {count}')
plot_histogram(count, title=f'Measurement in {basis}-basis')
plt.show()
Measurement in x-basis: {'0': 1024} Measurement in y-basis: {'1': 520, '0': 504} Measurement in z-basis: {'0': 533, '1': 491}
Reconstructing the Quantum State¶
from qiskit_experiments.library import StateTomography
from qiskit_experiments.framework import ExperimentData
# Generate state tomography circuits
tomo = StateTomography(qc)
tomo_circuits = tomo.circuits()
# Execute the circuits
tomo_job = simulator.run(transpile(tomo_circuits, simulator))
tomo_result = tomo_job.result()
# Reconstruct the density matrix
tomo_data = ExperimentData(experiment=tomo)
tomo_data.add_data(tomo_result)
tomo.analysis.run(tomo_data)
rho_fit = tomo_data.analysis_results("state").value
# Check if analysis_result is not empty
if tomo_data.analysis_results():
rho_fit = tomo_data.analysis_results("state").value
# Display the reconstructed density matrix
print("Reconstructed density matrix:")
print(rho_fit)
else:
print("No analysis results found.")
Reconstructed density matrix: DensityMatrix([[0.50682115+0.j , 0.49891824+0.03215684j], [0.49891824-0.03215684j, 0.49317885+0.j ]], dims=(2,))
Visualizing the Results¶
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
# Convert the density matrix to a state vector
statevector = rho_fit.to_statevector()
# Create a new quantum circuit to initialize the qubit to the reconstructed state
qc_reconstructed = QuantumCircuit(1)
qc_reconstructed.initialize(statevector.data, 0)
# Draw the new circuit
qc_reconstructed.draw('mpl')
plt.show()
Analysis of Results¶
Through this example we have taken the steps to perform quantum state tomography on a single qubit.
We started by preparing a superposition state using a Hadamard gate: $|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ . This is shown by our qc.draw() output, which illustrates the quantum circuit with the Hadamard gate applied to the qubit.
Next, we performed measurements in different bases (X, Y, and Z) to gather the necessary data for state reconstruction. The measurement results in different bases showed the expected probabilities for a superposition state. For instance, in the Z-basis, we observed nearly equal probabilities for measuring 0 and 1, which is consistent with the state being in an equal superposition. We got the following results:
Measurement Results:
- Measurement in x-basis: {'0': 1024}
- Measurement in y-basis: {'1': 520, '0': 504}
- Measurement in z-basis: {'0': 533, '1': 491}
This output indicates that the state was indeed in a superposition, as we expected.
- Applying a Hadamard gate before measurement in the X-basis should transform the state to: $H|\psi\rangle = |0\rangle$. Therefore, the measurement result should be {'0': 1024} (all measurements in state 0).
- Applying an S-dagger gate followed by a Hadamard gate before measurement in the Y-basis should transform the state to: $ H S^\dagger |\psi\rangle$. This should ideally result in an equal superposition of |0⟩ and |1⟩ in the Y-basis, leading to approximately equal counts for '0' and '1'. The results we obtained were {'1': 520, '0': 504}, which is consistent with our expectations.
- Direct measurement in the Z-basis should result in an equal superposition of |0⟩ and |1⟩, leading to approximately equal counts for '0' and '1'. The results we obtained were {'0': 533, '1': 491}, which is consistent with our expectations.
We then used the measurement data to reconstruct the density matrix of the quantum state. The reconstructed density matrix was:
\begin{bmatrix} 0.50682115+0.j & 0.49891824+0.03215684j \\ 0.49891824-0.03215684j & 0.49317885+0.j \end{bmatrix}
This matrix confirms that the state was indeed in an equal superposition of |0⟩ and |1⟩, as expected.
Note: It is okay if your results are not the same as mine. We expect slight variations in the measurement results due to the probabilistic nature of quantum mechanics. However, the overall trends and reconstructed density matrix should remain consistent.
Finally, we visualized the reconstructed state by initializing a new quantum circuit with the statevector derived from the density matrix. The resulting circuit representation confirmed that the state was correctly reconstructed.
Note: The slight difference in the circuit representation from the original circuit is to be expected and most likely due to the probabilistic nature of quantum mechanics.
Overall, the outputs demonstrate the effectiveness of quantum state tomography in accurately characterizing quantum states. The consistency between the measurement results, reconstructed density matrix, and visualized state confirms that our implementation worked as expected.
Conclusion¶
In this notebook, we have explored the concepts of quantum measurement and state tomography. We discussed the different types of quantum measurements, including projective measurements and POVMs, and their mathematical representations. We also covered the principles and steps involved in quantum state tomography.
Through the example implementation using Qiskit, we demonstrated how to set up a quantum circuit, perform measurements in different bases, reconstruct the quantum state, and visualize the results. Quantum state tomography is a powerful tool for verifying and characterizing quantum states, and it plays a crucial role in quantum computing experiments and research.
By understanding and applying these techniques, you can gain deeper insights into the behavior of quantum systems and improve the accuracy and reliability of your quantum computations.