# Quantum computing problem

Suppose that a qubit is in the state $|\varphi\rangle=a|0\rangle+\sqrt{1-a^2}|1\rangle$, where $a\in[-1,1]$.

If we first perform a standard basis measurement on this qubit and then perform a $\{|u\rangle,|u^\perp\rangle\}$-basis measurement, where $$|u\rangle=b|0\rangle+\sqrt{1-b^2}|1\rangle \text{ for some }b\in[-1,1],$$ what is the probability that the outcome of the second measurement is $|u\rangle$, in terms of $a$ and $b$?

Edit: I've found a solution, it should be $ab+\sqrt{(1−a^2)(1-b^2)}$.

-
 Shouldn't there be some squares in your expression? (Otherwise the probability might be negative.) – Peter Shor Feb 24 at 16:42 Please use LaTeX notation, as the fonts you used may not display correctly for other users. – Emilio Pisanty Feb 24 at 16:44

$$a^2 b^2 + (1-a^2)(1-b^2).$$
The probability that the result of the first measurement is $|0\rangle$ and the result of the second measurement is $|u\rangle$ is $\langle 0|\phi\rangle ^2\langle u|0 \rangle ^2$, which gives the first term: $a^2b^2$. The second term is the probability that the results are respectively $|1\rangle$ and $u\rangle$, and is derived similarly.