# Weeding out qubit states with leftmost qubit as 1

Need help! I was working on a project when I required to use a projection operator. For an example case, I have the Bell state, $$|\psi\rangle = \frac1{\sqrt2}\left(\color{blue}{|0}0\rangle+|11\rangle\right)$$ which now I want to take to the state, $$|\psi'\rangle = |\color{blue}{0}0\rangle$$ by weeding out the states with the leftmost qubit as $$1$$.

Another example would be, $$\frac1{2}\left(|\color{blue}{0}0\rangle+|\color{blue}{0}1\rangle+|10\rangle+|11\rangle\right)\rightarrow\frac1{\sqrt2}\left(|00\rangle+|01\rangle\right).$$

Edit: Just putting another example to make my question clear. I want to weed out states when the third (leftmost) qubit is $$1$$ in the following example.

Suppose we have a three qubit state, $$|\psi\rangle=\displaystyle\frac1{N}\left(|\color{blue}{0}\rangle\otimes\left[|00\rangle+|01\rangle+|10\rangle\right] + |1\rangle\otimes|11\rangle\right)$$ it should then get transformed to $$|\psi'\rangle = \frac1{N'}|\color{blue}{0}\rangle\otimes\left[|00\rangle+|01\rangle+|10\rangle\right].$$

Is this possible? If yes, how can I implement it in the IBM Quantum Experience?

• It's not clear what you mean by "weeding out the states with the second qubit as $1$." It sounds as if you want to do some controlled operation on the second qubit, but if you want $\vert \psi\rangle$ to be $\vert 00\rangle$, why not apply a Hadamard transform to $\vert \psi\rangle$? Jun 10 '19 at 16:53
• In your second example, you probably meant $\frac1{2}\left(|00\rangle+|01\rangle+|10\rangle+|11\rangle\right)\rightarrow\frac1{\sqrt2}\left(|00\rangle+|10\rangle\right)$. Jun 10 '19 at 17:11
• I think it's standard to read "first," "second," "third" qubits from left to right. But your coloring helps. Also "weeding out" sounds pretty non-standard. But if you can prepare a Bell state from $\vert 00\rangle$, why not invert whatever operation got you there to get your state of interest? Jun 10 '19 at 18:14
• You can prepare the initial state $\vert \psi \rangle$ of the $3$-qubit state, starting as $\vert000\rangle$, with a Hadamard on the two right qubits and a Toffoli (CCNOT gate) having the right two qubits control the left qubit. To get to the final $\vert \psi'\rangle$ state, have you thought about making an $8\times 8$-column truth table and converting $\vert \psi\rangle$ to $\vert \psi'\rangle$? I'm not sure if it's reversible (unitary.) Jun 10 '19 at 19:04
• You could measure measure the leftmost bit in $\vert\psi\rangle$ and post-select upon measuring $\vert 0\rangle$; that would put you in $\vert\psi^{'} \rangle$. But otherwise quantum gates are unitary. Jun 11 '19 at 2:11

I'm afraid it is not possible to remove states from a superposition that you do not want. At least, not easily. If it were, a lot of computationally hard problems would become much easier, since you could just create a huge superposition and then weed out all the non-solutions to your problem.

There are ways to do it, however. But they always come with a price. The easiest to implement is post-selection, as mentioned in a comment above. This means simply measuring whether a condition is satisfied (in your case, whether a certain qubit outputs 0). The outcome to this measurement will be random, but it will sometimes give the answer you want. You just need to repeat until that happens.

The easiest way to run this in the IBM Q Experience is to make a circuit in which you first measure whether the condition is satisfied, and then do everything you would do on the remaining state if that condition comes out as true. When you run the circuit, you'll get many bit strings as output: some in which your condition is satisfied and some in which it is not. You then simply discard all the latter, and the former are then the results you need.

A method that is unitary would be to run Grover's algorithm to search for states that satisfy your condition. The way you do this may depend on the specific application you have in mind.

• Okay, Grover's Algorithm is very insightful! Thanks. Why do we then have projection matrices in QC, if they can never be applied? Jun 11 '19 at 9:37
• @KishoreSShenoy They're used to model measurements (more specifically, projective measurements). Jun 12 '19 at 5:21