@@ -308,14 +308,18 @@ namespace Quantum.Kata.Measurements {
308308 // P(b|0) = probability to observe second outcome given that the state was |0⟩
309309 // P(a|+) = probability to observe first outcome given that the state was |+⟩
310310 // P(b|+) = probability to observe second outcome given that the state was |+⟩
311- // the task is to maximize the probability to be correct on a single shot experiment
311+ // The task is to maximize the probability to be correct on a single shot experiment,
312312 // which is the same as to minimize the probability to be wrong (on a single shot).
313313 // Assuming uniform prior, i.e., P(+) = P(0) = 1/2, we get
314- // P_correct = P(0) P(a|0) + P(+) P(b|+). Assuming a von Neumann measurement of the
315- // form E_a = Ry(2*alpha) * (1,0) = (cos(alpha), sin(alpha)) and
316- // E_b = Ry(2*alpha) * (0,1) = (sin(alpha), -cos(alpha)), we get that
317- // P_correct = 1/2 + cos²(alpha) + cos(alpha) sin(alpha). Maximizing this for alpha,
318- // we get max P_success = 1/2 (1 + 1/sqrt(2)) = 0.8535.., which is attained for alpha = π/8.
314+ // P_correct = P(0) P(a|0) + P(+) P(b|+) = 1/2 * (P(a|0) + P(b|+)).
315+ // Assuming a von Neumann measurement of the form
316+ // E_a = Ry(2*alpha) * (1,0) = (cos(alpha), sin(alpha)) and
317+ // E_b = Ry(2*alpha) * (0,1) = (sin(alpha), -cos(alpha)), we get
318+ // P(a|0) = |⟨E_a|0⟩|² = cos²(alpha),
319+ // P(b|+) = |⟨E_b|+⟩|² = 1/2 + cos(alpha) sin(alpha), and
320+ // P_correct = 1/2 * (1/2 + cos²(alpha) + cos(alpha) sin(alpha)).
321+ // Maximizing this for alpha, we get max P_success = 1/2 (1 + 1/sqrt(2)) = 0.8535...,
322+ // which is attained for alpha = π/8.
319323
320324 // Rotate the input state by π/8 means to apply Ry with angle 2π/8.
321325 Ry (0 .25 * PI (), q );
0 commit comments