Trying to understand below probability how it occured?

qc = QuantumCircuit(1)
qc.ry(3 * math.pi/4, 0)

A. 0.8536

B. 0.5

C. 0.1464

D. 1.0

And the answer is C. But I can't understand the calculation behind it. Can someone please explain?


We have, $$\begin{align}\begin{aligned}\newcommand{\th}{\frac{\theta}{2}}\\\begin{split}Ry(\theta) = \exp\Big(-i \th Y\Big) = \begin{pmatrix} \cos{\th} & -\sin{\th} \\ \sin{\th} & \cos{\th} \end{pmatrix}\end{split}\end{aligned}\end{align}$$

If the input state is $|0\rangle$, then the probability of getting $|0\rangle$ as a measurement result is the square of the absolute value of the entry in the first row and first column. That is, $\cos^2\big({\th}\big)$.

Now, $\theta = 3 \pi/4$, so the probability equals $\cos^2(3 \pi/8) = 0.1464$.

  • $\begingroup$ Thanks for the answer. I wonder how this calculation can be done in head. Because there were many questions similar as above which appeared during the certification exam of qiskit. So is there any shortcut to do that? $\endgroup$ Jan 3 at 15:28
  • $\begingroup$ You need to memorize the matrix. And for the calculation, you don't need to calculate the precise value. It is enough to know the shape of cosine function and note that the value must be between $0.5$ and $0$ because the angle is between $\pi/4$ and $\pi/2$ $\endgroup$ Jan 3 at 16:18

If you run the following code you will see the output statevector plotted in Bloch sphere.

qc = QuantumCircuit(1) 
qc.ry(3 * np.pi/4, 0) 
sim = Aer.get_backend('statevector_simulator') 
result = execute(qc, sim).result()
output_state = result.get_statevector(qc)

bloch sphererepresentation

Now from the picture you can see that the state lies near to |1> and much far from |0>.It lies in the lower hemisphere. So probability of being in state |0> is less than 0.5, it is more likely to be in state |1>. So option a, b, d are not possible. And the correct answer is c. You don't need to actually calculate the true probability in this case.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.