I was trying to understand how to calculate the probability of measuring $|1\rangle$ when executing the following circuit in Qiskit:

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

The answer in the book states it’s 0.8536 but I can’t understand the logic behind this.

I tried with the matrix of the $R_x$ gate but I am unable to achieve the same result.


1 Answer 1


You start out with $|0\rangle$.

You multiply that with

$ \begin{bmatrix} \cos(\theta/2) & -i \cdot \sin(\theta/2) \\ -i \cdot \sin(\theta/2) & \cos(\theta/2) \end{bmatrix} $

where $\theta=3 \pi/4$ , which gets you

$ \begin{bmatrix} \cos(\theta/2) \\ -i \cdot \sin(\theta/2) \end{bmatrix} $.

Now you take the lower entry of the vector to calculate your probability using $|x|²$.

  • $\begingroup$ Question 3: In the below code snippet, what is the probability of measuring |1>? qc = QuantumCircuit(1) qc.rx(3*math.pi/4, 0) $\endgroup$ Aug 11, 2023 at 6:49
  • $\begingroup$ sorry for the confusion. I am just learning the things as well. This shuld be the way to solve now :) $\endgroup$
    – ilga
    Aug 11, 2023 at 7:19
  • $\begingroup$ So if I take sin 3 pi by 4, it would be |0.74|² which is not equal to 0.85. $\endgroup$ Aug 11, 2023 at 7:48
  • $\begingroup$ You have an error in your calculation. You should put your calculation in the question $\endgroup$
    – ilga
    Aug 11, 2023 at 8:37
  • 1
    $\begingroup$ Note that when you put qc.rx(3*math.pi/4,0), you are setting $\theta = \pi/4$, so your bottom entry becomes $- i \cdot \sin(3\pi/8) $ i.e. don't forget to divide the angle by 2! And also separately there seems to be a slight confusion about the states, because if you do the calculation, the probability of measuring the $|0\rangle$ state should be about 0.86 (not the $|1\rangle$ state) $\endgroup$ Aug 11, 2023 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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