Maximizing Quantum Fisher Information

Parameter Estimation with Optimal States and Measurements

Quantum Fisher Information (QFI) plays a crucial role in quantum metrology, determining the fundamental precision limit for parameter estimation. In this article, we’ll explore a concrete example: estimating a phase parameter using a qubit system, and we’ll optimize both the input state and measurement to maximize the QFI.

Theoretical Background

The Quantum Fisher Information for a pure state $|\psi(\theta)\rangle$ with respect to parameter $\theta$ is given by:

$$F_Q(\theta) = 4(\langle\partial_\theta\psi|\partial_\theta\psi\rangle - |\langle\psi|\partial_\theta\psi\rangle|^2)$$

For a quantum state evolving under a unitary $U(\theta) = e^{-i\theta H}$ where $H$ is the Hamiltonian, the QFI becomes:

$$F_Q(\theta) = 4(\Delta H)^2$$

where $\Delta H$ is the variance of $H$ in the initial state. The Cramér-Rao bound states that the variance of any unbiased estimator satisfies:

$$\text{Var}(\hat{\theta}) \geq \frac{1}{nF_Q(\theta)}$$

where $n$ is the number of measurements.

Problem Setup

We consider a qubit undergoing phase evolution with Hamiltonian $H = \sigma_z/2$, where $\sigma_z$ is the Pauli Z operator. We’ll:

  1. Calculate QFI for different input states
  2. Find the optimal input state that maximizes QFI
  3. Determine the optimal measurement basis
  4. Visualize the QFI landscape on the Bloch sphere

Python Implementation

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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.optimize import minimize
from scipy.linalg import expm

# Set random seed for reproducibility
np.random.seed(42)

# Define Pauli matrices
sigma_x = np.array([[0, 1], [1, 0]], dtype=complex)
sigma_y = np.array([[0, -1j], [1j, 0]], dtype=complex)
sigma_z = np.array([[1, 0], [0, -1]], dtype=complex)
I = np.eye(2, dtype=complex)

# Hamiltonian for phase estimation (H = σ_z/2)
H = sigma_z / 2

def bloch_to_state(theta, phi):
"""Convert Bloch sphere angles to quantum state"""
return np.array([
[np.cos(theta/2)],
[np.exp(1j*phi) * np.sin(theta/2)]
], dtype=complex)

def state_to_bloch(state):
"""Convert quantum state to Bloch sphere coordinates"""
state = state.flatten()
state = state / np.linalg.norm(state)

x = 2 * np.real(state[0] * np.conj(state[1]))
y = 2 * np.imag(state[0] * np.conj(state[1]))
z = np.abs(state[0])**2 - np.abs(state[1])**2

return x, y, z

def quantum_fisher_information(state, hamiltonian):
"""Calculate Quantum Fisher Information for a pure state"""
state = state.flatten()
state = state / np.linalg.norm(state)

# For pure states: F_Q = 4 * Var(H) = 4 * (<H^2> - <H>^2)
exp_H = np.real(np.conj(state) @ hamiltonian @ state)
exp_H2 = np.real(np.conj(state) @ (hamiltonian @ hamiltonian) @ state)
var_H = exp_H2 - exp_H**2

qfi = 4 * var_H
return qfi

def evolve_state(state, theta, hamiltonian):
"""Evolve state under unitary U(θ) = exp(-iθH)"""
U = expm(-1j * theta * hamiltonian)
return U @ state

def compute_qfi_grid(n_theta=50, n_phi=50):
"""Compute QFI for a grid of states on the Bloch sphere"""
theta_vals = np.linspace(0, np.pi, n_theta)
phi_vals = np.linspace(0, 2*np.pi, n_phi)

qfi_grid = np.zeros((n_theta, n_phi))

for i, theta in enumerate(theta_vals):
for j, phi in enumerate(phi_vals):
state = bloch_to_state(theta, phi)
qfi_grid[i, j] = quantum_fisher_information(state, H)

return theta_vals, phi_vals, qfi_grid

def optimize_input_state():
"""Find optimal input state that maximizes QFI"""
def neg_qfi(params):
theta, phi = params
state = bloch_to_state(theta, phi)
return -quantum_fisher_information(state, H)

# Multiple random initializations
best_result = None
best_qfi = -np.inf

for _ in range(10):
init_params = [np.random.uniform(0, np.pi), np.random.uniform(0, 2*np.pi)]
result = minimize(neg_qfi, init_params, method='BFGS',
bounds=[(0, np.pi), (0, 2*np.pi)])

if -result.fun > best_qfi:
best_qfi = -result.fun
best_result = result

return best_result.x, best_qfi

def compute_measurement_statistics(state, theta_true, measurement_basis, n_samples=1000):
"""Simulate measurement statistics for parameter estimation"""
evolved_state = evolve_state(state, theta_true, H)

# Probability of measuring |0⟩ in the measurement basis
projector = measurement_basis @ measurement_basis.conj().T
prob_0 = np.real(evolved_state.conj().T @ projector @ evolved_state)[0, 0]

# Simulate measurements
measurements = np.random.binomial(1, 1-prob_0, n_samples)
estimated_prob = np.mean(measurements)

return prob_0, estimated_prob

# Calculate QFI for several example states
print("="*60)
print("QUANTUM FISHER INFORMATION FOR DIFFERENT INPUT STATES")
print("="*60)

example_states = {
"|0⟩ (North pole)": bloch_to_state(0, 0),
"|1⟩ (South pole)": bloch_to_state(np.pi, 0),
"|+⟩ (Equator, x-axis)": bloch_to_state(np.pi/2, 0),
"|+i⟩ (Equator, y-axis)": bloch_to_state(np.pi/2, np.pi/2),
}

for name, state in example_states.items():
qfi = quantum_fisher_information(state, H)
x, y, z = state_to_bloch(state)
print(f"\nState: {name}")
print(f" Bloch vector: ({x:.3f}, {y:.3f}, {z:.3f})")
print(f" QFI = {qfi:.6f}")

# Find optimal input state
print("\n" + "="*60)
print("OPTIMIZATION: FINDING MAXIMUM QFI")
print("="*60)

optimal_params, max_qfi = optimize_input_state()
optimal_state = bloch_to_state(*optimal_params)
x_opt, y_opt, z_opt = state_to_bloch(optimal_state)

print(f"\nOptimal Bloch angles: θ = {optimal_params[0]:.6f}, φ = {optimal_params[1]:.6f}")
print(f"Optimal Bloch vector: ({x_opt:.3f}, {y_opt:.3f}, {z_opt:.3f})")
print(f"Maximum QFI = {max_qfi:.6f}")
print(f"\nTheoretical maximum QFI = {4 * 0.25:.6f} (for eigenstate of H)")

# Optimal measurement basis
print("\n" + "="*60)
print("OPTIMAL MEASUREMENT BASIS")
print("="*60)
print("\nFor phase estimation with H = σ_z/2:")
print("Optimal measurement: σ_x basis (eigenstates |+⟩ and |-⟩)")
print("This is perpendicular to the evolution axis (z-axis)")

# Visualization
print("\n" + "="*60)
print("GENERATING VISUALIZATIONS")
print("="*60)

# Compute QFI grid
theta_vals, phi_vals, qfi_grid = compute_qfi_grid(n_theta=40, n_phi=80)

# Create figure with multiple subplots
fig = plt.figure(figsize=(18, 12))

# 1. QFI heatmap on Bloch sphere surface
ax1 = fig.add_subplot(2, 3, 1, projection='3d')

Theta, Phi = np.meshgrid(theta_vals, phi_vals)
X = np.sin(Theta) * np.cos(Phi)
Y = np.sin(Theta) * np.sin(Phi)
Z = np.cos(Theta)

surf = ax1.plot_surface(X.T, Y.T, Z.T, facecolors=plt.cm.viridis(qfi_grid/qfi_grid.max()),
alpha=0.8, linewidth=0, antialiased=True)

# Mark optimal state
ax1.scatter([x_opt], [y_opt], [z_opt], c='red', s=200, marker='*',
edgecolors='white', linewidths=2, label='Optimal state')

# Mark example states
for name, state in example_states.items():
x, y, z = state_to_bloch(state)
ax1.scatter([x], [y], [z], s=80, alpha=0.7)

ax1.set_xlabel('X', fontsize=10)
ax1.set_ylabel('Y', fontsize=10)
ax1.set_zlabel('Z', fontsize=10)
ax1.set_title('QFI on Bloch Sphere\n(Color: QFI magnitude)', fontsize=12, fontweight='bold')
ax1.legend()

# 2. QFI vs theta (for phi=0)
ax2 = fig.add_subplot(2, 3, 2)
qfi_theta = [quantum_fisher_information(bloch_to_state(t, 0), H) for t in theta_vals]
ax2.plot(theta_vals, qfi_theta, 'b-', linewidth=2)
ax2.axhline(y=1.0, color='r', linestyle='--', label='Maximum QFI = 1')
ax2.axvline(x=np.pi/2, color='g', linestyle='--', alpha=0.5, label='θ = π/2')
ax2.set_xlabel('θ (radians)', fontsize=11)
ax2.set_ylabel('Quantum Fisher Information', fontsize=11)
ax2.set_title('QFI vs Polar Angle θ (φ=0)', fontsize=12, fontweight='bold')
ax2.grid(True, alpha=0.3)
ax2.legend()

# 3. QFI contour plot
ax3 = fig.add_subplot(2, 3, 3)
contour = ax3.contourf(phi_vals, theta_vals, qfi_grid, levels=20, cmap='viridis')
ax3.scatter([optimal_params[1]], [optimal_params[0]], c='red', s=200,
marker='*', edgecolors='white', linewidths=2, label='Optimal')
cbar = plt.colorbar(contour, ax=ax3)
cbar.set_label('QFI', fontsize=10)
ax3.set_xlabel('φ (radians)', fontsize=11)
ax3.set_ylabel('θ (radians)', fontsize=11)
ax3.set_title('QFI Contour Map', fontsize=12, fontweight='bold')
ax3.legend()

# 4. Parameter estimation simulation
ax4 = fig.add_subplot(2, 3, 4)
theta_range = np.linspace(0, 2*np.pi, 50)
measurement_basis_x = bloch_to_state(np.pi/2, 0) # |+⟩ state

prob_optimal = []
prob_suboptimal = []
suboptimal_state = bloch_to_state(0, 0) # |0⟩ state

for theta in theta_range:
evolved_opt = evolve_state(optimal_state, theta, H)
evolved_sub = evolve_state(suboptimal_state, theta, H)

projector = measurement_basis_x @ measurement_basis_x.conj().T
p_opt = np.real(evolved_opt.conj().T @ projector @ evolved_opt)[0, 0]
p_sub = np.real(evolved_sub.conj().T @ projector @ evolved_sub)[0, 0]

prob_optimal.append(p_opt)
prob_suboptimal.append(p_sub)

ax4.plot(theta_range, prob_optimal, 'b-', linewidth=2, label='Optimal state (|+⟩)')
ax4.plot(theta_range, prob_suboptimal, 'r--', linewidth=2, label='Suboptimal state (|0⟩)')
ax4.set_xlabel('True parameter θ', fontsize=11)
ax4.set_ylabel('Measurement probability P(|+⟩)', fontsize=11)
ax4.set_title('Measurement Statistics vs Parameter', fontsize=12, fontweight='bold')
ax4.grid(True, alpha=0.3)
ax4.legend()

# 5. Fisher Information vs measurement angle
ax5 = fig.add_subplot(2, 3, 5)
measurement_angles = np.linspace(0, np.pi, 100)
classical_fi = []

for m_theta in measurement_angles:
m_basis = bloch_to_state(m_theta, 0)

# Calculate classical Fisher Information for this measurement
theta_test = 0.5
evolved = evolve_state(optimal_state, theta_test, H)
projector = m_basis @ m_basis.conj().T

# Numerical derivative of probability
dtheta = 0.001
evolved_plus = evolve_state(optimal_state, theta_test + dtheta, H)
evolved_minus = evolve_state(optimal_state, theta_test - dtheta, H)

p = np.real(evolved.conj().T @ projector @ evolved)[0, 0]
p_plus = np.real(evolved_plus.conj().T @ projector @ evolved_plus)[0, 0]
p_minus = np.real(evolved_minus.conj().T @ projector @ evolved_minus)[0, 0]

dp_dtheta = (p_plus - p_minus) / (2 * dtheta)

if p > 1e-10 and p < 1 - 1e-10:
fi = dp_dtheta**2 / (p * (1 - p))
else:
fi = 0

classical_fi.append(fi)

ax5.plot(measurement_angles, classical_fi, 'g-', linewidth=2)
ax5.axhline(y=max_qfi, color='r', linestyle='--', linewidth=2, label=f'QFI = {max_qfi:.3f}')
ax5.axvline(x=np.pi/2, color='b', linestyle='--', alpha=0.5, label='Optimal (θ=π/2)')
ax5.set_xlabel('Measurement basis angle θ', fontsize=11)
ax5.set_ylabel('Classical Fisher Information', fontsize=11)
ax5.set_title('Fisher Information vs Measurement Basis', fontsize=12, fontweight='bold')
ax5.grid(True, alpha=0.3)
ax5.legend()

# 6. Estimation variance comparison
ax6 = fig.add_subplot(2, 3, 6)
n_measurements = np.logspace(1, 4, 50, dtype=int)
cramer_rao_optimal = 1 / (n_measurements * max_qfi)
cramer_rao_suboptimal = 1 / (n_measurements * quantum_fisher_information(suboptimal_state, H))

ax6.loglog(n_measurements, cramer_rao_optimal, 'b-', linewidth=2,
label='Optimal state (QFI=1.00)')
ax6.loglog(n_measurements, cramer_rao_suboptimal, 'r--', linewidth=2,
label=f'Suboptimal state (QFI={quantum_fisher_information(suboptimal_state, H):.2f})')
ax6.set_xlabel('Number of measurements', fontsize=11)
ax6.set_ylabel('Minimum variance (Cramér-Rao bound)', fontsize=11)
ax6.set_title('Estimation Precision vs Measurements', fontsize=12, fontweight='bold')
ax6.grid(True, alpha=0.3, which='both')
ax6.legend()

plt.tight_layout()
plt.savefig('qfi_optimization.png', dpi=150, bbox_inches='tight')
print("\nVisualization complete! Saved as 'qfi_optimization.png'")
plt.show()

# Summary statistics
print("\n" + "="*60)
print("SUMMARY")
print("="*60)
print(f"\n1. Maximum achievable QFI: {max_qfi:.6f}")
print(f"2. Optimal input state: Equatorial states (θ = π/2)")
print(f"3. Optimal measurement: σ_x basis (perpendicular to evolution)")
print(f"4. Minimum variance (n=1000): {1/(1000*max_qfi):.6e}")
print(f"5. Suboptimal |0⟩ state QFI: {quantum_fisher_information(suboptimal_state, H):.6f}")
print(f"6. Improvement factor: {max_qfi/quantum_fisher_information(suboptimal_state, H):.2f}x")

print("\n" + "="*60)
print("EXECUTION COMPLETED SUCCESSFULLY")
print("="*60)

Code Explanation

Core Functions

Bloch Sphere Conversion Functions

The bloch_to_state() function converts spherical coordinates $(\theta, \phi)$ on the Bloch sphere to a quantum state vector:

$$|\psi\rangle = \cos(\theta/2)|0\rangle + e^{i\phi}\sin(\theta/2)|1\rangle$$

The inverse function state_to_bloch() computes the Bloch vector components using the expectation values of Pauli operators.

Quantum Fisher Information Calculation

The quantum_fisher_information() function implements the formula for pure states. For a state $|\psi\rangle$ and Hamiltonian $H$:

$$F_Q = 4\text{Var}(H) = 4(\langle H^2 \rangle - \langle H \rangle^2)$$

This calculation is exact and efficient for pure states, avoiding the more complex symmetric logarithmic derivative formalism.

State Evolution

The evolve_state() function applies the unitary evolution $U(\theta) = e^{-i\theta H}$ using matrix exponentiation. This simulates how the quantum state changes with the parameter we’re trying to estimate.

Grid Computation and Optimization

The compute_qfi_grid() function systematically evaluates QFI across the entire Bloch sphere, creating a comprehensive map of estimation precision. The optimize_input_state() function uses numerical optimization with multiple random initializations to find the global maximum QFI, ensuring we don’t get trapped in local optima.

Analysis Pipeline

The code performs several key analyses:

  1. Example State Evaluation: Calculates QFI for common quantum states to illustrate how state choice affects estimation precision
  2. Global Optimization: Finds the optimal input state that maximizes QFI
  3. Measurement Analysis: Demonstrates how measurement basis affects classical Fisher Information
  4. Performance Comparison: Shows the practical advantage of optimal states through Cramér-Rao bounds

Visualization Strategy

The six-panel visualization provides comprehensive insight:

  • 3D Bloch Sphere: Shows QFI distribution spatially with color coding
  • Theta Dependence: Reveals how polar angle affects QFI at fixed azimuth
  • Contour Map: Provides a 2D overview for identifying optimal regions
  • Measurement Statistics: Demonstrates signal strength for parameter estimation
  • Measurement Optimization: Shows how measurement basis choice impacts achievable precision
  • Scaling Analysis: Illustrates the practical benefit of higher QFI as measurements increase

The code is optimized for speed by vectorizing calculations where possible and using efficient NumPy operations. The grid resolution is chosen to balance accuracy with computation time.

Expected Results

When you run this code, you’ll observe:

  1. Optimal States: The maximum QFI of 1.0 is achieved at equatorial states $(\theta = \pi/2)$, where the state is maximally sensitive to phase evolution
  2. Worst States: The eigenstates of $H$ (north and south poles, $|0\rangle$ and $|1\rangle$) have QFI = 0, providing no information about the parameter
  3. Measurement Basis: The optimal measurement is in the $\sigma_x$ basis (equatorial), perpendicular to the evolution axis
  4. Precision Scaling: With optimal states, estimation variance decreases as $1/n$, achieving the quantum Cramér-Rao bound

The 3D visualization clearly shows that QFI forms a “belt” around the equator of the Bloch sphere, with zeros at the poles. This geometric picture provides intuition: states that are orthogonal to the evolution direction provide maximum information.

Execution Results

============================================================
QUANTUM FISHER INFORMATION FOR DIFFERENT INPUT STATES
============================================================

State: |0⟩ (North pole)
  Bloch vector: (0.000, 0.000, 1.000)
  QFI = 0.000000

State: |1⟩ (South pole)
  Bloch vector: (0.000, 0.000, -1.000)
  QFI = 0.000000

State: |+⟩ (Equator, x-axis)
  Bloch vector: (1.000, 0.000, 0.000)
  QFI = 1.000000

State: |+i⟩ (Equator, y-axis)
  Bloch vector: (0.000, -1.000, 0.000)
  QFI = 1.000000

============================================================
OPTIMIZATION: FINDING MAXIMUM QFI
============================================================

Optimal Bloch angles: θ = 1.570796, φ = 3.761482
Optimal Bloch vector: (-0.814, 0.581, 0.000)
Maximum QFI = 1.000000

Theoretical maximum QFI = 1.000000 (for eigenstate of H)

============================================================
OPTIMAL MEASUREMENT BASIS
============================================================

For phase estimation with H = σ_z/2:
Optimal measurement: σ_x basis (eigenstates |+⟩ and |-⟩)
This is perpendicular to the evolution axis (z-axis)

============================================================
GENERATING VISUALIZATIONS
============================================================

/tmp/ipython-input-906618079.py:82: RuntimeWarning: Method BFGS cannot handle bounds.
  result = minimize(neg_qfi, init_params, method='BFGS',
/tmp/ipython-input-906618079.py:279: RuntimeWarning: divide by zero encountered in divide
  cramer_rao_suboptimal = 1 / (n_measurements * quantum_fisher_information(suboptimal_state, H))


Visualization complete! Saved as 'qfi_optimization.png'

============================================================
SUMMARY
============================================================

1. Maximum achievable QFI: 1.000000
2. Optimal input state: Equatorial states (θ = π/2)
3. Optimal measurement: σ_x basis (perpendicular to evolution)
4. Minimum variance (n=1000): 1.000000e-03
5. Suboptimal |0⟩ state QFI: 0.000000
6. Improvement factor: infx

============================================================
EXECUTION COMPLETED SUCCESSFULLY
============================================================