2
$\begingroup$

As we know, Qiskit can give us the results of our measurements in computational or, better to say, $\sigma_z$ basis. However, I am courageous about measuring the qubit in, for instance, $\sigma_x$ basis. In $\sigma_x$ basis, we have to projective measurements such that $|+\rangle$ and $|-\rangle$. Here, how can we realize that we have measured the state of the qubit in either $|+\rangle$ or $|-\rangle$?

$\endgroup$
2
  • $\begingroup$ Literally, I have read this answer. However, my goal is to do some continuous mid-measurements on the qubit in $\sigma{x}$ basis. I want to have a clear outcome whether the result was + or -. $\endgroup$ Nov 15 at 17:51
  • $\begingroup$ Could you elaborate on what a "continuous mid-measurement" is or maybe state what the equivalent method is in the $\sigma_z$ basis is? I think this might help us understand what you are looking for that's different to just "put an $H$ gate before you measure" $\endgroup$ Nov 16 at 8:40

1 Answer 1

1
$\begingroup$

It's a bit long for a comment but my goal is to explain that the answer linked as duplicate does indeed answer your question.

The measure operation of qiskit measures in the computational basis, there's no way around that (though it may change in the future).

However, it is possible to simulate a measurement in the $X$-basis using a measurement in the computational basis. To keep things simple, I'll stick to single qubit pure states here, but the reasoning is identical for more qubits and mixed states.

When measuring a state $|\psi\rangle=\alpha|0\rangle+\beta|0\rangle$ in the computational basis, we measure $|0\rangle$ with probability $|\alpha|^2$, and $|1\rangle$ with probability $|\beta|^2$.

When measuring the aforementioned state in the computational basis, we measure $|+\rangle$ with probability $$|\langle+|\psi\rangle|^2=\frac{|\alpha+\beta|^2}{2}$$ and $|1\rangle$ with probability $$|\langle-|\psi\rangle|^2=\frac{|\alpha-\beta|^2}{2}$$

Now, suppose we apply an Hadamard gate on $|\psi\rangle$, we end up with: $$H|\psi\rangle=\frac{\alpha+\beta}{\sqrt{2}}|0\rangle+\frac{\alpha-\beta}{\sqrt{2}}|1\rangle$$

Thus, if we now measure the state in the computational basis, we will measure $|0\rangle$ with probability $|\langle+|\psi\rangle|^2$ and $|1\rangle$ with probability $|\langle-|\psi\rangle|^2$. Thus, if we finally apply an Hadamard gate after having measured, we would have perfectly simulated a measurement in the $X$-basis using a measurement in the computational basis.


More generally, for an arbitrary number of qubits, when you want to measure in a given basis, it will always be possible to write this basis as $(U|i\rangle)_i$. If you apply $U^\dagger$ to $|\psi\rangle$ and measure in the computational basis, you will measure $|i\rangle$ with probability: $$\left|\langle i|U^\dagger|\psi\rangle\right|^2$$ Which is exactly the probability to measure $U|i\rangle$ if we measure in the $(U|i\rangle)_i$ basis. You then simply need to apply $U$ to simulate a measurement in this basis using one in the computational basis.

$\endgroup$

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