In the below code snippet, what is the probability of measuring $|1\rangle$?

 qc = QuantumCircuit(1) 
 qc.rx(3*math.pi/4, 0)
  • $\begingroup$ Have a look at the matrix of Rx gate, then multiply the matrix with vector describing state $|1\rangle$. Finally take square of abs. value of the second member of the resulting vector. This is the probability you look for. $\endgroup$ Commented Oct 8, 2022 at 6:50
  • 1
    $\begingroup$ Welcome to QC exchange. Let us know what your initial ideas/doubts for such questions please. Also, first attempts might be helpful as well. $\endgroup$
    – R.W
    Commented Oct 8, 2022 at 8:50

1 Answer 1


The gate $R_x(\theta)$ is defined by the matrix $$\begin{pmatrix}\cos \frac{\theta}{2} & -i\sin\frac{\theta}{2} \\ -i\sin\frac{\theta}{2} &\cos\frac{\theta}{2}\end{pmatrix}$$ and the state $|1\rangle$ is the column-matrix $\begin{pmatrix}0 \\ 1\end{pmatrix}$. Multiply them and you will find the resulting state and thus the amplitude of $|1\rangle$.

Alternatively, you can use the fact that $$R_x(\theta) \equiv \exp\left(\frac{-i\theta X}{2}\right)=\cos\frac{\theta}{2}I-i\sin\frac{\theta}{2}X$$ where $I$ is the identity gate and $X$ the Pauli $X$ gate. The second identity follows from the fact that the $X$ gate is idempotent ($X^2=I$) and the definition of the exponential of an operator.

Either way should give you the same result.


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.