Quantum gates are fundamental building blocks in quantum computing. They operate on quantum bits, or qubits, and are responsible for transforming quantum states through unitary operations. Unlike classical logic gates that process binary values (0 and 1), quantum gates exploit the principles of quantum mechanics, including superposition, entanglement, and interference, to perform complex computations.
Fundamental Concepts in Quantum Gates
Quantum gates differ significantly from classical gates due to the following key principles:
Types of Quantum Gates
The Pauli spin matrices are three 2×2 complex Hermitian and unitary matrices used in quantum mechanics to describe the spin-1/2 operators. They are fundamental in describing the spin angular momentum of particles like electrons.
The three Pauli matrices are:

σi2 =I
which means that their eigenvalues are ±1, corresponding to quantum spin projections.
The Quantum NOT gate, also called the Pauli-X gate, is a fundamental single-qubit gate in quantum computing. It is mathematically represented by the Pauli matrix 𝜎𝑥 :
This gate flips the quantum state of a qubit, just like the classical NOT gate flips a bit (0 to 1 and 1 to 0). However, in quantum computing, it also operates on superposition states.
X-gate is the single qubit input gate and is also called as Pauli X – gate or quantum NOT gate.
The Matrix form of X is given by:
\[ \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} \]
\[ \begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix} \]
\[ X = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \]
Action of the X-gate on inputs:
\[ X|0\rangle = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} = |1\rangle \]
\[ X|1\rangle = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix} = |0\rangle \]
X inverts each input; hence it is called a bit-flip gate.
If a superposed qubit goes through X gate, the result will be
\[ X|\psi\rangle = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \begin{bmatrix} \beta \\ \alpha \end{bmatrix} = \alpha |1\rangle + \beta |0\rangle \]
The quantum Y gate (also known as the Pauli-Y gate) is one of the fundamental quantum logic gates used in quantum computing. It operates on a single qubit and is represented by the Pauli-Y matrix.
\[ Y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} \]
Action of Y gate on inputs:
\[ Y|0\rangle = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} i \\ 0 \end{bmatrix} = i|1\rangle \]
\[ Y|1\rangle = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} -i \\ 0 \end{bmatrix} = -i|1\rangle \]
If a superposed qubit goes through Y gate:
\[ Y|\psi\rangle = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \begin{bmatrix} -i\beta \\ i\alpha \end{bmatrix} = -i\beta|0\rangle + i\alpha|1\rangle \]
The quantum Z gate (also known as the Pauli-Z gate) is one of the fundamental quantum logic gates used in quantum computing. It operates on a single qubit and is represented by the Pauli-Z matrix.
\[ Z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \]
Action of Z gate on inputs:
\[ Z|0\rangle = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} = |0\rangle \]
\[ Z|1\rangle = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ -1 \end{bmatrix} = -|1\rangle \]
If a superposed qubit goes through Z gate:
\[ Z|\psi\rangle = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \begin{bmatrix} \alpha \\ -\beta \end{bmatrix} = \alpha|0\rangle - \beta|1\rangle \]
Hadamard gate is the single qubit input gate that creates equal superposition states from computational basis states.
The Matrix form of Hadamard gate is given by:
\[ H = \frac{1}{\sqrt2} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \]
Action of the H-gate on |0> state:
\[ H|0\rangle = \frac{1}{\sqrt2} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \frac{1}{\sqrt(2)} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \frac{1}{\sqrt2} (|0\rangle + |1\rangle) \]
Action of the H-gate on |1> state:
\[ H|1\rangle = \frac{1}{\sqrt2} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \frac{1}{\sqrt(2)} \begin{bmatrix} 1 \\ -1 \end{bmatrix} = \frac{1}{\sqrt2} (|0\rangle - |1\rangle) \]
If a superposed qubit goes through H gate, the result will be
\[ H|\psi\rangle = \frac{1}{\sqrt2} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \frac{1}{\sqrt2} \begin{bmatrix} \alpha+\beta \\ \alpha-\beta \end{bmatrix} = \frac{1}{\sqrt2} (\alpha+\beta) |0\rangle - \frac{1}{\sqrt2}(\alpha-\beta)|1\rangle \]
A Phase Quantum Gate is a fundamental quantum logic gate that applies a phase shift to a quantum state without altering its probability amplitude. It is a key component in quantum algorithms and quantum information processing.
The 𝑆 gate (also called the 𝜋/2 phase gate) introduces a 90o phase shift to the ∣1⟩ state:
\[ S = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} \]
Effect:
Action of S gate on inputs:
Apply S gate to a state |0>, it will remain same
\[ S|0\rangle = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} = |0\rangle \]
Apply S gate to a state |1>, it will remain same.
\[ S|1\rangle = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = i\begin{bmatrix} 0 \\ 1 \end{bmatrix} = i|1\rangle \]
S gate apply to the state \(\alpha \) |0⟩ + \(\beta \) |1⟩ , it transforms to the state \(\alpha \) |0⟩ + i\(\beta \) |1⟩
\[ S|\psi\rangle = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \begin{bmatrix} \alpha \\ i\beta \end{bmatrix} \]
The 𝑇 gate introduces a 45o phase shift and is crucial in quantum error correction:
\[ T = \begin{bmatrix} 1 & 0 \\ 0 & e^{\pi/4} \end{bmatrix} \]
Effect:Action of T gate on inputs:
Apply T gate to a state |0>, it will remain same
\[ T|0\rangle = \begin{bmatrix} 1 & 0 \\ 0 & e^{\pi/4} \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} = |0\rangle \]
Apply T gate to a state |1>, it will remain same.
\[ T|1\rangle = \begin{bmatrix} 1 & 0 \\ 0 & e^{\pi/4} \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = e^{\pi/4}\begin{bmatrix} 0 \\ 1 \end{bmatrix} = e^{\pi/4}|1\rangle \]
T gate apply to the state \(\alpha \) |0⟩ + \(\beta \) |1⟩ , it transforms to the state \(\alpha \) |0⟩ + i\(\beta \) |1⟩
\[ T|\psi\rangle = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \begin{bmatrix} \alpha \\ i\beta \end{bmatrix} \]
The Controlled-NOT (CNOT) gate is one of the most fundamental two-qubit quantum logic gates. It operates on a control qubit and a target qubit, flipping (applying an X-gate) to the target qubit only if the control qubit is in state ∣1⟩.
The CNOT gate is a two-qubit operation, where the first qubit is referred as the control qubit |A⟩ and the second qubit as the target qubit |B⟩. If the control qubit is |1⟩ then it will flip the target qubit state from|0⟩ to |1⟩ or from |1⟩ to |0⟩. When the control qubit is in state |0⟩ then the target qubit remains unchanged. It operates on a control qubit and a target qubit, flipping (applying an X-gate) to the target qubit only if the control qubit is in state ∣1⟩.
\[ CNOT = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix} \]

The SWAP gate is a fundamental two-qubit quantum logic gate that exchanges the states of two qubits.
The SWAP gate is represented by the following matrix:
\[ SWAP = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]
Operation on Basis States

The Controlled-Z (CZ) gate is a fundamental two-qubit quantum logic gate. It applies a Pauli-Z operation (phase flip) on the target qubit if the control qubit is in state \(|1\rangle\).
The CZ gate is represented by the following matrix:
\[ CZ = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix} \]

The Toffoli gate, also known as the Controlled-Controlled-NOT (CCNOT) gate, is a three-qubit quantum logic gate. It flips the target qubit if both control qubits are in state \(|1\rangle\).
The Toffoli gate is represented by the following matrix:
\[ Toffoli = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \end{bmatrix} \]
