# An operator that checks the second qubit

Applying Hadamard gate to classical bit $$|0, \psi, \phi\rangle$$

$$H|0\rangle =\frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\\ 1 & -1\end{pmatrix}|0\rangle = \frac{1}{\sqrt{2}}|0, \psi, \phi\rangle + \frac{1}{\sqrt{2}}|1, \psi, \phi\rangle$$

Applying Fredkin gate to the quantum state $$\frac{1}{\sqrt{2}}|0, \psi, \phi\rangle + \frac{1}{\sqrt{2}}|1, \psi, \phi\rangle$$

$$S(\frac{1}{\sqrt{2}}|0, \psi, \phi\rangle + \frac{1}{\sqrt{2}}|1, \psi, \phi\rangle) = \frac{1}{\sqrt{2}}|0, \psi, \phi\rangle + \frac{1}{\sqrt{2}}|0, \phi, \psi\rangle$$

Applying Hadamard gate to the quantum state $$\frac{1}{\sqrt{2}}|0, \psi, \phi\rangle + \frac{1}{\sqrt{2}}|0, \phi, \psi\rangle$$

\begin{align}H(\frac{1}{\sqrt{2}}|0, \psi, \phi\rangle + \frac{1}{\sqrt{2}}|0, \phi, \psi\rangle) &= \biggr(\frac{1}{2}|0, \psi, \phi\rangle + \frac{1}{2}|1, \psi, \phi\rangle\biggr) + \biggr(\frac{1}{2}|0, \phi, \psi\rangle - \frac{1}{2}|1, \phi, \psi\rangle\biggr) \\ &= \frac{1}{2}|0\rangle\biggr(|\psi, \phi\rangle + |\phi, \psi\rangle\biggr) + \frac{1}{2}|1\rangle\biggr(|\psi, \phi\rangle-|\phi, \psi\rangle\biggr)\end{align}

At this point, I am curious as to whether there exists an operator $$\hat{C}$$ that is identity $$I$$ whenever second qubit is $$\psi$$, and that is zero whenever second qubit isn't $$|\psi\rangle$$, i.e

$$\hat{C}|0,\psi, \phi\rangle = |0,\psi, \phi\rangle$$

$$\hat{C}|0,\phi, \psi\rangle = 0$$

Can such an operator be constructed? Here, we suppose that $$|\phi\rangle, |\psi\rangle\in \mathcal{H}$$ are normalized and not necessilarly orthogonal states.

• It seems that this is a kind of reset gate. Since the reset is not unitary it cannot be constructed in quantum sense. However, I can imagine that reset gate is controlled by a classical bit. So, you can measure a qubit and based on the result apply reset or not to other qubit. Oct 5 at 11:29

I t depends on exactly what you mean by "is zero whenever the second qubit isn't". As you've specified, no you can't. Remember that everything is linear, so you should remember that generically any state $$|\phi\rangle$$ contains a bit of $$|\psi\rangle$$. In other words, you should be writing $$|\phi\rangle=\alpha|\psi\rangle+\beta|\psi^\perp\rangle$$ where $$\langle\psi^\perp|\psi\rangle=0$$. You want to define a $$C$$ such that $$C|\psi\rangle=|\psi\rangle$$ and $$C|\phi\rangle=0$$, which implies $$C|\psi^\perp\rangle=-\frac{\alpha}{\beta}|\psi^\perp\rangle$$. You might be able to do this for a specific $$|\phi\rangle$$ if you know $$\alpha,\beta$$, but you need that knowledge and cannot do it in general.
On the other hand, a better interpretation of "whenever the qubit isn't $$|\psi\rangle$$" would be "whenever the state is orthogonal to $$|\psi\rangle$$, which you can do: $$C=I\otimes|\psi\rangle\langle\psi|\otimes I$$. Of course, you need to know $$|\psi\rangle$$ to be able to do that.