Questions tagged [quantum-gate]

For questions regarding usage, performance, implementation, application or theory related to quantum gates.

An ideal quantum gate can be described by a unitary matrix. That is, any (ideal) gate acting on $n$ qubits can be described as an element of (the matrix representation of) $\mathrm U\left(2^n\right)$. For a gate acting on $n$, $d$-dimensional, qudits this becomes $\mathrm U\left(d^n\right)$. The result of a gate $U$ acting on state $\left|\psi\right>$ is $U\left|\psi\right>$. When the state is being described by a density matrix $\rho$, this becomes $U\rho U^\dagger$.

Gates are usually denoted with respect to the computational basis and any basis change on the state also has to be applied to the matrix representing the gate.


Gates can act on single, two or more qubits (or qudits). Some common examples are:

Single qubit gates:

  • Hadamard: $$H = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1 \\\ 1 & -1\end{pmatrix}$$
  • Pauli gates: $$X = \begin{pmatrix}0 & 1 \\\ 1 & 0\end{pmatrix},\quad Y = \begin{pmatrix}0 & -i \\\ i & 0\end{pmatrix},\quad Z = \begin{pmatrix}1 & 0 \\\ 0 & -1\end{pmatrix}$$
  • $\sqrt{\text{NOT}} = \sqrt X$: $$\sqrt X = \frac 12\begin{pmatrix}1+i & 1-i \\\ 1-i & 1+i\end{pmatrix}$$
  • Phase: $$R_\phi = \begin{pmatrix}1 & 0 \\\ 0 & e^{i\phi}\end{pmatrix}$$

Two qubit gates:

  • Controlled gates: $$\text{CNOT} = \begin{pmatrix}1&0&0&0\\\ 0&1&0&0 \\\ 0&0&0&1 \\\ 0&0&1&0\end{pmatrix},\quad CU = \begin{pmatrix}I_2 & 0 \\\ 0 & U\end{pmatrix}$$
  • SWAP: $$\text{SWAP} = \begin{pmatrix}1&0&0&0\\\ 0&0&1&0 \\\ 0&1&0&0 \\\ 0&0&0&1\end{pmatrix}$$

Multiple qubit gates/transformations:

  • Toffoli/CCNOT: $$\text{CCNOT} = \begin{pmatrix}I_6 & 0 \\\ 0 & X\end{pmatrix}$$
  • Quantum Fourier Transform (QFT)
  • (multiple qubit) Hadamard/Discrete Fourier Transform: This is defined by the recursive relation $H^{\otimes n} = H\otimes H^{\otimes \left(n-1\right)}$, where $H = H^{\otimes 1}$

However, currently, gates aren't perfect and an actual implementation of a gate can't recreate the exact, ideal gate. To quantify how 'close' an implemented gate is to the ideal one, gate fidelity is often used.

1708 questions
14
votes
3 answers

Is swap gate equivalent to just exchanging the wire of the two qubits?

Is swap gate equivalent to just exchanging the wire of the two qubits? if yes why not just switching the wire whenever we want to apply a swap gate?
Sam
  • 437
  • 2
  • 8
9
votes
1 answer

How to reduce circuit elements of a decomposed $C^2(U)$ operation?

This question refers to Nielsen and Chuang's Exercise 4.22: Prove that a $C^2(U)$ gate (for any single-qubit unitary U) can be constructed using at most eight one-qubit gates, and six controlled-not gates. To prove this, I decomposed all $C(V)$…
Eesh Starryn
  • 381
  • 4
  • 10
9
votes
1 answer

Is the controlled-Hadamard gate in the Clifford group?

Is the controlled-Hadamard gate a member of the Clifford group? I understand that Controlled Pauli gates are in the Clifford group. If controlled Hadamard is Clifford member, then is a controlled-SingleClifford also a member of the Clifford group ?
8
votes
1 answer

How to say "apply CNOT on qubit 1 controlled by qubit 2"?

Say you have $2$ qubits, namely $q_1, q_2$. What's the right language for saying apply CNOT on $q_1$ and $q_2$ where $q_1$ is the control qubit and $q_2$ is the target? For instance, can I say "apply CNOT on $q_2$ controlled by $q_1$"? What's the…
R. Chopin
  • 1,199
  • 6
  • 17
8
votes
1 answer

Do global phases matter when a gate is converted into a controlled gate?

Let's say that we have a unitary matrix M such that: $$ M = e^{i\pi/8}\begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/12} \\ \end{pmatrix} $$ If we were to apply this unitary matrix to the state $|1\rangle$, we would get: $$ M|1\rangle\ =\…
8
votes
3 answers

Square root of Pauli operators: is there a common convention to define them uniquely?

There exists many different matrices square root. For instance I can define either of the two for square root of $X$: $$\sqrt{X}^{(1)} \equiv \frac{1}{\sqrt{2 i}} \begin{pmatrix} 1 & i \\ i & 1 \end{pmatrix}$$ Or as suggested on…
Marco Fellous-Asiani
  • 1,514
  • 2
  • 13
  • 33
7
votes
1 answer

Why is the CNOT gate matrix a valid representation for two-qubit states?

Can anyone explain how the CNOT matrix below is a valid presentation for the four-qubit states that follow after? |0 0> -> |0 0> |0 1> -> |0 1> |1 0> -> |1 1> |1 1> -> |1 0> Source: Wikipedia
DrHamed
  • 181
  • 1
  • 8
7
votes
1 answer

What limits speed of quantum gates?

I would like to check something. Consider I am working on cQED (superconducting qubits), or ion trapped, or silicon qubits (I would like to exclude "exotic for me" quantum computing like photon based, or topological Q.C). The fastest you perform a…
Marco Fellous-Asiani
  • 1,514
  • 2
  • 13
  • 33
6
votes
2 answers

Just want to confirm: Do two CNOT gates cancel each other?

I see somewhere that this happens: But I wonder if this is just identity.
Ka Wa Yip
  • 171
  • 3
5
votes
2 answers

Why are oracles Hermitian by construction?

$\newcommand{\qr}[1]{|#1\rangle}$In this lecture, it is nicely explained how to define an operator that computes a function $f(x)$. I know how to implement such operators. (We just define $O\qr{x}\qr{y} = \qr{x}\qr{y \oplus f(x)}$.) However, it it…
R. Chopin
  • 1,199
  • 6
  • 17
5
votes
1 answer

How to apply the outer product operator?

$\newcommand{\q}[2]{\langle #1 | #2 \rangle} \newcommand{\qr}[1]{|#1\rangle} \newcommand{\ql}[1]{\langle #1|} \renewcommand{\v}[2]{\langle #1,#2\rangle} \newcommand{\norm}[1]{\left\lVert#1\right\rVert}$ Here's an application of the operator…
R. Chopin
  • 1,199
  • 6
  • 17
5
votes
2 answers

Why can the CNOT representation $e^{i\frac{\pi}{4}\left(I-Z\right)\otimes\left(I-X\right)}$ hardly be found in books?

The CNOT gate is usually written as $|0\rangle\langle0|\otimes I + 1\rangle\langle1|\otimes X$ (with $X,Y,Z$ being the Pauli Basis and $I$ the Identity). I have yet to stumble across the representation Wikipedia gives when looking at books on the…
manuel459
  • 201
  • 1
  • 4
4
votes
1 answer

Why does a quantum circuit consist of simple quantum gates which act on at most a fixed number of qubits?

While reading the Quantum algorithm Wikipedia entry, I noticed that the sentence "A quantum circuit consists of simple quantum gates which act on at most a fixed number of qubits", was annotated with a "why?".
Victory Omole
  • 1,636
  • 1
  • 8
  • 18
4
votes
0 answers

Implementing controlled $U_3$ gate from $R_{\hat{n}}$ with given parameters

This is a follow-up question to solve for parameters of a controlled $U_3$ gate. Suppose I have the unit vector $\hat{n} = (n_x,n_y,n_z)$ and an angle $\xi$ (assume we know both of them). Then, we could…
ZR-
  • 2,388
  • 7
  • 19
4
votes
2 answers

How does the CNOT gate work?

As defined, CNOT should for the two input states $|0\rangle = \pmatrix{1 \\ 0}$ and $\pmatrix{\alpha \\ \beta}$ should result in the second state unchanged: $\pmatrix{\alpha \\ \beta}$. However, to me it does not seem to be the case. The matrix for…
SlowerPhoton
  • 173
  • 4
1
2 3 4 5 6