Quantum gates are the building blocks of quantum computing, manipulating qubits to perform complex calculations. Each gate, like the Hadamard or CNOT, plays a unique role in creating superposition, entanglement, and controlling qubit states for powerful algorithms.
-
Hadamard (H) gate
- Creates superposition by transforming a qubit from |0⟩ or |1⟩ to an equal probability of both states.
- The matrix representation is (1/√2) * [[1, 1], [1, -1]].
- Essential for quantum algorithms, enabling parallelism in computations.
-
Pauli-X gate (NOT gate)
- Flips the state of a qubit: |0⟩ becomes |1⟩ and |1⟩ becomes |0⟩.
- Represented by the matrix [[0, 1], [1, 0]].
- Acts as a fundamental building block for constructing more complex quantum circuits.
-
Pauli-Y gate
- Combines a bit flip and a phase flip, transforming |0⟩ to i|1⟩ and |1⟩ to -i|0⟩.
- Its matrix form is [[0, -i], [i, 0]].
- Important for introducing phase shifts in quantum states.
-
Pauli-Z gate
- Applies a phase flip to the |1⟩ state, leaving |0⟩ unchanged.
- Represented by the matrix [[1, 0], [0, -1]].
- Useful for controlling the phase of qubits in quantum algorithms.
-
Phase (S) gate
- Introduces a phase shift of π/2 (90 degrees) to the |1⟩ state.
- Its matrix representation is [[1, 0], [0, i]].
- Often used in conjunction with other gates to manipulate qubit phases.
-
T gate
- Applies a phase shift of π/4 (45 degrees) to the |1⟩ state.
- Represented by the matrix [[1, 0], [0, e^(iπ/4)]].
- Important for achieving precise control over qubit states in quantum circuits.
-
CNOT (Controlled-NOT) gate
- A two-qubit gate that flips the second qubit (target) if the first qubit (control) is |1⟩.
- Its matrix form is a 4x4 matrix: [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]].
- Crucial for creating entanglement between qubits.
-
SWAP gate
- Exchanges the states of two qubits.
- Its matrix representation is a 4x4 matrix that swaps the basis states: [[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]].
- Useful for rearranging qubits in quantum circuits.
-
Toffoli (CCNOT) gate
- A three-qubit gate that flips the third qubit (target) if the first two qubits (controls) are both |1⟩.
- Its matrix is a 8x8 matrix, maintaining the states of all other qubits.
- Important for error correction and implementing classical logic in quantum circuits.
-
Controlled-Z (CZ) gate
- Applies a phase flip to the target qubit if the control qubit is |1⟩.
- Represented by the matrix [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, -1]].
- Essential for creating entangled states and manipulating qubit phases in quantum algorithms.