# How to calculate the meauring probabilities of quantum states $\vert 0\rangle$ and $\vert 1 \rangle$ in $R_x$ gate?

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

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

• 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. Commented Oct 8, 2022 at 6:50
• Welcome to QC exchange. Let us know what your initial ideas/doubts for such questions please. Also, first attempts might be helpful as well.
– R.W
Commented Oct 8, 2022 at 8:50

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.