# Calculate of theoretical probabilities for the outcomes

I have a $$|+\rangle$$ state qubit and I measure it in a random basis. The random basis is made with random $$\theta$$, $$\varphi$$ and $$\lambda$$ of $$U3$$ gate. How can I calculate the theoretical probabilities for this basis.

The theoretical probability is calculated by looking at the projection of state $$|+\rangle$$ on random basis.
Let the random basis be written as $$|M\rangle=e^{i\lambda}(\cos(\theta /2) |0\rangle+ e^{i\phi}\sin(\theta /2)|1\rangle)\,.$$
Then the probability of measuring state $$|+\rangle$$ is given by: $$|\langle M|+ \rangle|^2=1/2+\cos(\phi)\cos(\theta /2)\sin(\theta /2)\,.$$
For example, if $$\theta=\pi/2,\phi=0$$ with any arbitrary global phase $$\lambda$$, we have $$|M\rangle=|+\rangle\,,$$ and the probability would be 1.
For $$\theta=\pi/2, \phi=\pi$$, $$|M\rangle=|-\rangle\,,$$ and the probability would be 0.
I have assumed that the initial state of the qubit is $$|0\rangle$$ before the $$U3$$ gate application to determine the basis. If not we will have to consider initial state probabilities into account as well.