Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

history | excerpt history