2

Is it possible for me to construct a gate that inverse everything ($|0\rangle \rightarrow -|0\rangle, |1\rangle \rightarrow -|1\rangle$, etc. basically like a $-I$ gate) from the basic $X, Y, Z, CX,...$ gates, for any number of qubits? How do I do so if it's possible?

Thank you!

Juan
  • 634
  • 5
  • 21

2 Answers2

8

As a general rule, you wouldn't bother constructing this: it is just a global phase that has no observable consequence.

If you really insist on doing this, introduce an ancilla qubit in the $|1\rangle$ state and apply a $Z$ gate to it.

PS "inverse identity gate" is a really bad name for it. The identity operation is its own inverse.

DaftWullie
  • 62,671
  • 4
  • 55
  • 140
4

You might be interested in controlled version of $-I$. Despite the fact that you can neglect global phase in case of non-controlled gates, you cannot do so in case of controlled version.

The controled gate $-I$ is described by matrix \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & -1 & 0\\ 0 & 0 & 0 & -1\\ \end{pmatrix}.

This gate set a phase to $\pi$ (note that $\mathrm{e}^{i\pi} = -1$) if control qubit is in state $|1\rangle$.

To implement the gate simply put $Z$ gate on first qubit (i.e. control qubit) and nothing (i.e. identity operator) on second qubit (i.e. target qubit). You can check that the matrix above is really equal to $Z \otimes I$ and hence the proposed construction really implements the requested gate.

Martin Vesely
  • 15,244
  • 4
  • 32
  • 75