Skip to content
Matrices as gates

Matrices as gates

February 3, 2025

Single-qubit gates are 2×22 \times 2 unitaries. Common examples include

X=(0110),Z=(1001),H=12(1111). X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix},\quad Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix},\quad H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}.

Controlled operations

A CNOT flips the target conditioned on the control being 1\lvert 1 \rangle. Its matrix is a permutation on the computational basis of two qubits.

Matrix dimensions grow as 2n2^n for nn qubits. Simulators track the full state vector; real hardware executes the same mathematics with noise and limited connectivity.

Next

Go to Install Qiskit to run gates in code.