Quantum State Discrimination

Minimizing Error Probability with Optimal POVM (Helstrom Measurement)

Introduction

Quantum state discrimination is a fundamental problem in quantum information theory. Given two quantum states $|\psi_0\rangle$ and $|\psi_1\rangle$ that occur with prior probabilities $\eta_0$ and $\eta_1$, we want to design an optimal measurement strategy that minimizes the probability of making an incorrect identification.

The Helstrom measurement provides the optimal solution to this binary state discrimination problem. In this article, we’ll work through a concrete example and implement the solution in Python.

Problem Setup

Consider two non-orthogonal quantum states in a 2-dimensional Hilbert space:

$$|\psi_0\rangle = \begin{pmatrix} 1 \ 0 \end{pmatrix}, \quad |\psi_1\rangle = \begin{pmatrix} \cos\theta \ \sin\theta \end{pmatrix}$$

where $0 < \theta < \pi/2$. These states occur with prior probabilities $\eta_0$ and $\eta_1 = 1 - \eta_0$.

The optimal measurement is given by the Helstrom bound, and the minimum error probability is:

$$P_{\text{error}}^{\min} = \frac{1}{2}\left(1 - \sqrt{1 - 4\eta_0\eta_1|\langle\psi_0|\psi_1\rangle|^2}\right)$$

Python Implementation

Here’s the complete code to solve this problem, visualize the results, and demonstrate the optimal POVM:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import seaborn as sns

# Set style
sns.set_style("whitegrid")
plt.rcParams['figure.figsize'] = (15, 12)

# Define quantum states
def create_states(theta):
"""Create two quantum states with angle theta between them"""
psi0 = np.array([1, 0], dtype=complex)
psi1 = np.array([np.cos(theta), np.sin(theta)], dtype=complex)
return psi0, psi1

def density_matrix(psi):
"""Create density matrix from state vector"""
return np.outer(psi, psi.conj())

def helstrom_error(eta0, eta1, inner_product):
"""Calculate minimum error probability using Helstrom bound"""
overlap = np.abs(inner_product)**2
return 0.5 * (1 - np.sqrt(1 - 4*eta0*eta1*overlap))

def optimal_povm(theta, eta0, eta1):
"""
Calculate optimal POVM elements for binary state discrimination
Returns POVM elements Pi0 and Pi1
"""
psi0, psi1 = create_states(theta)
rho0 = density_matrix(psi0)
rho1 = density_matrix(psi1)

# Construct the Helstrom matrix
Q = eta0 * rho0 - eta1 * rho1

# Eigendecomposition
eigenvalues, eigenvectors = np.linalg.eigh(Q)

# POVM element Pi0 corresponds to positive eigenvalue projector
Pi0 = np.zeros((2, 2), dtype=complex)
Pi1 = np.zeros((2, 2), dtype=complex)

for i, ev in enumerate(eigenvalues):
projector = np.outer(eigenvectors[:, i], eigenvectors[:, i].conj())
if ev > 0:
Pi0 += projector
else:
Pi1 += projector

return Pi0, Pi1, Q

def calculate_success_probabilities(Pi0, Pi1, psi0, psi1, eta0, eta1):
"""Calculate success probabilities for each measurement outcome"""
rho0 = density_matrix(psi0)
rho1 = density_matrix(psi1)

# P(correct | state 0) = Tr(Pi0 * rho0)
p_correct_0 = np.real(np.trace(Pi0 @ rho0))
# P(correct | state 1) = Tr(Pi1 * rho1)
p_correct_1 = np.real(np.trace(Pi1 @ rho1))

# Overall success probability
p_success = eta0 * p_correct_0 + eta1 * p_correct_1

return p_correct_0, p_correct_1, p_success

# Main analysis
print("="*70)
print("QUANTUM STATE DISCRIMINATION: HELSTROM MEASUREMENT")
print("="*70)

# Example parameters
theta_example = np.pi/6 # 30 degrees
eta0_example = 0.7
eta1_example = 0.3

psi0, psi1 = create_states(theta_example)
inner_product = np.vdot(psi0, psi1)

print(f"\nExample Configuration:")
print(f" Angle θ = {theta_example:.4f} rad = {np.degrees(theta_example):.2f}°")
print(f" Prior probability η₀ = {eta0_example:.2f}")
print(f" Prior probability η₁ = {eta1_example:.2f}")
print(f" Inner product ⟨ψ₀|ψ₁⟩ = {inner_product:.4f}")
print(f" Overlap |⟨ψ₀|ψ₁⟩|² = {np.abs(inner_product)**2:.4f}")

# Calculate optimal POVM
Pi0, Pi1, Q = optimal_povm(theta_example, eta0_example, eta1_example)

print(f"\nHelstrom Matrix Q = η₀ρ₀ - η₁ρ₁:")
print(Q)

print(f"\nOptimal POVM Element Π₀:")
print(Pi0)

print(f"\nOptimal POVM Element Π₁:")
print(Pi1)

# Verify POVM completeness
print(f"\nPOVM Completeness Check (Π₀ + Π₁ should be I):")
print(Pi0 + Pi1)

# Calculate error probability
min_error = helstrom_error(eta0_example, eta1_example, inner_product)
print(f"\nMinimum Error Probability: {min_error:.6f}")

# Calculate success probabilities
p_correct_0, p_correct_1, p_success = calculate_success_probabilities(
Pi0, Pi1, psi0, psi1, eta0_example, eta1_example
)

print(f"\nSuccess Probabilities:")
print(f" P(correct | state 0) = {p_correct_0:.6f}")
print(f" P(correct | state 1) = {p_correct_1:.6f}")
print(f" Overall success probability = {p_success:.6f}")
print(f" Overall error probability = {1 - p_success:.6f}")

# Create comprehensive visualizations
fig = plt.figure(figsize=(18, 12))

# Plot 1: Error probability vs angle for different prior probabilities
ax1 = fig.add_subplot(2, 3, 1)
theta_range = np.linspace(0.01, np.pi/2 - 0.01, 100)
prior_probs = [0.5, 0.6, 0.7, 0.8, 0.9]
colors = plt.cm.viridis(np.linspace(0, 1, len(prior_probs)))

for eta0, color in zip(prior_probs, colors):
eta1 = 1 - eta0
errors = []
for theta in theta_range:
psi0_temp, psi1_temp = create_states(theta)
ip = np.vdot(psi0_temp, psi1_temp)
errors.append(helstrom_error(eta0, eta1, ip))
ax1.plot(np.degrees(theta_range), errors, label=f'η₀={eta0:.1f}',
linewidth=2, color=color)

ax1.axvline(np.degrees(theta_example), color='red', linestyle='--',
alpha=0.5, label='Example θ')
ax1.set_xlabel('Angle θ (degrees)', fontsize=11)
ax1.set_ylabel('Minimum Error Probability', fontsize=11)
ax1.set_title('Error Probability vs State Overlap', fontsize=12, fontweight='bold')
ax1.legend(fontsize=9)
ax1.grid(True, alpha=0.3)

# Plot 2: 3D surface plot of error probability
ax2 = fig.add_subplot(2, 3, 2, projection='3d')
theta_grid = np.linspace(0.01, np.pi/2 - 0.01, 50)
eta0_grid = np.linspace(0.01, 0.99, 50)
THETA, ETA0 = np.meshgrid(theta_grid, eta0_grid)
ERROR = np.zeros_like(THETA)

for i in range(len(eta0_grid)):
for j in range(len(theta_grid)):
psi0_temp, psi1_temp = create_states(THETA[i, j])
ip = np.vdot(psi0_temp, psi1_temp)
ERROR[i, j] = helstrom_error(ETA0[i, j], 1 - ETA0[i, j], ip)

surf = ax2.plot_surface(np.degrees(THETA), ETA0, ERROR, cmap=cm.coolwarm,
linewidth=0, antialiased=True, alpha=0.9)
ax2.set_xlabel('Angle θ (degrees)', fontsize=10)
ax2.set_ylabel('Prior η₀', fontsize=10)
ax2.set_zlabel('Min Error Prob', fontsize=10)
ax2.set_title('3D Error Landscape', fontsize=12, fontweight='bold')
fig.colorbar(surf, ax=ax2, shrink=0.5)

# Plot 3: Bloch sphere representation
ax3 = fig.add_subplot(2, 3, 3, projection='3d')

# Bloch sphere
u = np.linspace(0, 2 * np.pi, 50)
v = np.linspace(0, np.pi, 50)
x_sphere = np.outer(np.cos(u), np.sin(v))
y_sphere = np.outer(np.sin(u), np.sin(v))
z_sphere = np.outer(np.ones(np.size(u)), np.cos(v))
ax3.plot_surface(x_sphere, y_sphere, z_sphere, alpha=0.1, color='gray')

# State vectors on Bloch sphere
def state_to_bloch(psi):
"""Convert quantum state to Bloch vector"""
rho = density_matrix(psi)
x = 2 * np.real(rho[0, 1])
y = 2 * np.imag(rho[0, 1])
z = np.real(rho[0, 0] - rho[1, 1])
return x, y, z

x0, y0, z0 = state_to_bloch(psi0)
x1, y1, z1 = state_to_bloch(psi1)

ax3.quiver(0, 0, 0, x0, y0, z0, color='blue', arrow_length_ratio=0.1,
linewidth=3, label='|ψ₀⟩')
ax3.quiver(0, 0, 0, x1, y1, z1, color='red', arrow_length_ratio=0.1,
linewidth=3, label='|ψ₁⟩')

ax3.set_xlim([-1, 1])
ax3.set_ylim([-1, 1])
ax3.set_zlim([-1, 1])
ax3.set_xlabel('X', fontsize=10)
ax3.set_ylabel('Y', fontsize=10)
ax3.set_zlabel('Z', fontsize=10)
ax3.set_title('Bloch Sphere Representation', fontsize=12, fontweight='bold')
ax3.legend(fontsize=9)

# Plot 4: POVM elements visualization
ax4 = fig.add_subplot(2, 3, 4)
povm_data = np.array([[np.real(Pi0[0, 0]), np.real(Pi0[1, 1])],
[np.real(Pi1[0, 0]), np.real(Pi1[1, 1])]])
im = ax4.imshow(povm_data, cmap='RdYlBu', aspect='auto', vmin=0, vmax=1)
ax4.set_xticks([0, 1])
ax4.set_yticks([0, 1])
ax4.set_xticklabels(['Diagonal 1', 'Diagonal 2'])
ax4.set_yticklabels(['Π₀', 'Π₁'])
ax4.set_title('POVM Elements (Diagonal)', fontsize=12, fontweight='bold')
for i in range(2):
for j in range(2):
ax4.text(j, i, f'{povm_data[i, j]:.3f}', ha='center', va='center',
color='black', fontsize=11, fontweight='bold')
plt.colorbar(im, ax=ax4)

# Plot 5: Error probability heatmap
ax5 = fig.add_subplot(2, 3, 5)
theta_heat = np.linspace(0.01, np.pi/2 - 0.01, 40)
eta0_heat = np.linspace(0.01, 0.99, 40)
error_heat = np.zeros((len(eta0_heat), len(theta_heat)))

for i, eta0_val in enumerate(eta0_heat):
for j, theta_val in enumerate(theta_heat):
psi0_temp, psi1_temp = create_states(theta_val)
ip = np.vdot(psi0_temp, psi1_temp)
error_heat[i, j] = helstrom_error(eta0_val, 1 - eta0_val, ip)

im2 = ax5.imshow(error_heat, aspect='auto', origin='lower', cmap='hot',
extent=[0, 90, 0, 1])
ax5.plot(np.degrees(theta_example), eta0_example, 'c*', markersize=20,
label='Example point')
ax5.set_xlabel('Angle θ (degrees)', fontsize=11)
ax5.set_ylabel('Prior η₀', fontsize=11)
ax5.set_title('Error Probability Heatmap', fontsize=12, fontweight='bold')
ax5.legend(fontsize=9)
plt.colorbar(im2, ax=ax5, label='Error Probability')

# Plot 6: Success probability comparison
ax6 = fig.add_subplot(2, 3, 6)
categories = ['Given |ψ₀⟩', 'Given |ψ₁⟩', 'Overall']
probabilities = [p_correct_0, p_correct_1, p_success]
bars = ax6.bar(categories, probabilities, color=['blue', 'red', 'green'],
alpha=0.7, edgecolor='black', linewidth=2)
ax6.axhline(0.5, color='gray', linestyle='--', alpha=0.5, label='Random guess')
ax6.set_ylabel('Success Probability', fontsize=11)
ax6.set_title('Measurement Success Probabilities', fontsize=12, fontweight='bold')
ax6.set_ylim([0, 1])
ax6.legend(fontsize=9)
for bar, prob in zip(bars, probabilities):
height = bar.get_height()
ax6.text(bar.get_x() + bar.get_width()/2., height,
f'{prob:.4f}', ha='center', va='bottom', fontsize=10,
fontweight='bold')

plt.tight_layout()
plt.savefig('helstrom_measurement_analysis.png', dpi=300, bbox_inches='tight')
print("\n" + "="*70)
print("Visualization saved successfully!")
print("="*70)
plt.show()

# Additional analysis: Quantum Chernoff bound comparison
print("\n" + "="*70)
print("ADDITIONAL ANALYSIS")
print("="*70)

print(f"\nComparison with classical strategies:")
print(f" Random guessing error: 0.5000")
print(f" Helstrom (optimal) error: {min_error:.6f}")
print(f" Improvement factor: {0.5/min_error:.4f}x")

# Calculate quantum fidelity
fidelity = np.abs(np.vdot(psi0, psi1))**2
print(f"\nQuantum Fidelity F = |⟨ψ₀|ψ₁⟩|²: {fidelity:.6f}")
print(f"Trace distance: {np.sqrt(1 - fidelity):.6f}")

print("\n" + "="*70)

Code Explanation

State Preparation Functions

The create_states(theta) function generates two quantum states with a specified angle $\theta$ between them. The first state $|\psi_0\rangle$ is aligned with the computational basis $|0\rangle$, while $|\psi_1\rangle$ makes an angle $\theta$ with it in the $x$-$z$ plane of the Bloch sphere.

The density_matrix(psi) function converts a pure state vector into its corresponding density matrix representation $\rho = |\psi\rangle\langle\psi|$, which is essential for POVM calculations.

Helstrom Bound Calculation

The helstrom_error(eta0, eta1, inner_product) function implements the analytical formula for the minimum achievable error probability:

$$P_{\text{error}}^{\min} = \frac{1}{2}\left(1 - \sqrt{1 - 4\eta_0\eta_1|\langle\psi_0|\psi_1\rangle|^2}\right)$$

This bound is derived from the trace distance between the weighted density matrices and represents the fundamental quantum limit for discriminating between two states.

Optimal POVM Construction

The optimal_povm(theta, eta0, eta1) function constructs the optimal measurement operators by:

  1. Creating density matrices: $\rho_0 = |\psi_0\rangle\langle\psi_0|$ and $\rho_1 = |\psi_1\rangle\langle\psi_1|$

  2. Constructing the Helstrom matrix: $Q = \eta_0\rho_0 - \eta_1\rho_1$

  3. Performing eigendecomposition: Finding eigenvalues and eigenvectors of $Q$

  4. Assigning POVM elements:

    • $\Pi_0$ = projector onto positive eigenspace of $Q$
    • $\Pi_1$ = projector onto negative eigenspace of $Q$

This decomposition ensures that the measurement minimizes the error probability while satisfying the completeness relation $\Pi_0 + \Pi_1 = I$.

Success Probability Analysis

The calculate_success_probabilities function computes:

  • $P(\text{correct}|\psi_0) = \text{Tr}(\Pi_0 \rho_0)$: Probability of correctly identifying state 0
  • $P(\text{correct}|\psi_1) = \text{Tr}(\Pi_1 \rho_1)$: Probability of correctly identifying state 1
  • Overall success: $P_{\text{success}} = \eta_0 P(\text{correct}|\psi_0) + \eta_1 P(\text{correct}|\psi_1)$

Visualization Features

The code generates six comprehensive plots:

  1. Error Probability vs Angle: Shows how the minimum error probability changes with state overlap (angle $\theta$) for different prior probability distributions. When $\eta_0 = 0.5$, the problem is symmetric. As $\eta_0$ increases, the measurement favors state 0, reducing errors when state 0 occurs but increasing errors for state 1.

  2. 3D Error Landscape: A surface plot showing the joint dependence of error probability on both the angle $\theta$ and the prior probability $\eta_0$. This visualization reveals that the error is minimized when states are orthogonal ($\theta = 90°$) and maximized when they are identical ($\theta = 0°$).

  3. Bloch Sphere Representation: Visual representation of the quantum states on the Bloch sphere. The two state vectors show the geometric relationship between $|\psi_0\rangle$ and $|\psi_1\rangle$. The angle between them determines how distinguishable they are.

  4. POVM Elements Heatmap: Displays the diagonal elements of the optimal measurement operators $\Pi_0$ and $\Pi_1$. These values indicate which measurement outcomes are assigned to each hypothesis.

  5. Error Probability Heatmap: A 2D color-coded visualization of the error probability parameter space. The cyan star marks our specific example point. Darker colors indicate higher error rates.

  6. Success Probabilities Bar Chart: Compares the conditional success probabilities for each state with the overall success rate. The gray dashed line at 0.5 represents random guessing performance, demonstrating that the optimal measurement significantly outperforms random selection.

Execution Results

======================================================================
QUANTUM STATE DISCRIMINATION: HELSTROM MEASUREMENT
======================================================================

Example Configuration:
  Angle θ = 0.5236 rad = 30.00°
  Prior probability η₀ = 0.70
  Prior probability η₁ = 0.30
  Inner product ⟨ψ₀|ψ₁⟩ = 0.8660+0.0000j
  Overlap |⟨ψ₀|ψ₁⟩|² = 0.7500

Helstrom Matrix Q = η₀ρ₀ - η₁ρ₁:
[[ 0.475     +0.j -0.12990381+0.j]
 [-0.12990381+0.j -0.075     +0.j]]

Optimal POVM Element Π₀:
[[ 0.95209722+0.j -0.21356055+0.j]
 [-0.21356055+0.j  0.04790278+0.j]]

Optimal POVM Element Π₁:
[[0.04790278+0.j 0.21356055+0.j]
 [0.21356055+0.j 0.95209722+0.j]]

POVM Completeness Check (Π₀ + Π₁ should be I):
[[1.+0.j 0.+0.j]
 [0.+0.j 1.+0.j]]

Minimum Error Probability: 0.195862

Success Probabilities:
  P(correct | state 0) = 0.952097
  P(correct | state 1) = 0.458900
  Overall success probability = 0.804138
  Overall error probability = 0.195862

======================================================================
Visualization saved successfully!
======================================================================

======================================================================
ADDITIONAL ANALYSIS
======================================================================

Comparison with classical strategies:
  Random guessing error: 0.5000
  Helstrom (optimal) error: 0.195862
  Improvement factor: 2.5528x

Quantum Fidelity F = |⟨ψ₀|ψ₁⟩|²: 0.750000
Trace distance: 0.500000

======================================================================

Physical Interpretation

The Helstrom measurement represents the fundamental quantum limit for distinguishing between two quantum states. Several key insights emerge from this analysis:

Quantum Advantage: The optimal measurement achieves an error probability of approximately 0.196, which is significantly better than random guessing (50% error rate). This represents a 2.55× improvement factor.

Role of Prior Probabilities: When one state is much more likely than the other (e.g., $\eta_0 = 0.7$ vs $\eta_1 = 0.3$), the optimal strategy biases the measurement toward the more probable state, achieving higher success rates for that state.

State Overlap Impact: The inner product $\langle\psi_0|\psi_1\rangle = 0.866$ (corresponding to $\theta = 30°$) means the states have significant overlap. This overlap fundamentally limits how well we can distinguish them, regardless of our measurement strategy.

POVM Structure: The optimal POVM elements are projectors onto the eigenspaces of the Helstrom matrix $Q$. This structure ensures that the measurement extracts maximum information about which state was prepared while respecting the constraints of quantum mechanics.

Trace Distance: The trace distance $\sqrt{1 - F} \approx 0.5$ quantifies the distinguishability of the quantum states. Smaller trace distances correspond to states that are more difficult to discriminate.

Conclusion

The Helstrom measurement provides the theoretically optimal solution for binary quantum state discrimination. Our implementation demonstrates how to construct the optimal POVM elements and calculate the minimum achievable error probability for a concrete example. The visualizations clearly show the trade-offs between state distinguishability, prior probabilities, and measurement performance, providing deep insights into the fundamental limits of quantum information processing.