# Qubit gates **Qubit gates** (single-qubit gates) are $2 \times 2$ unitary matrices that act on a single [[qubit]]. Every such gate corresponds to a rotation on the [[bloch-sphere|Bloch sphere]]. The most general single-qubit gate (up to global phase) is the [[u-gate|U gate]] $U(\theta, \phi, \lambda)$, which spans all of $SU(2)$; every named single-qubit gate is a special case of it. ## Pauli gates The [[pauli-gates|Pauli gates]] $I$, $X$, $Y$, $Z$ are $\pi$ rotations about the $x$-, $y$-, $z$-axes (and the trivial identity). $X$ is the quantum NOT — it swaps $\lvert 0\rangle \leftrightarrow \lvert 1\rangle$. $Z$ leaves $\lvert 0\rangle$ fixed and flips the sign of $\lvert 1\rangle$. $Y = iXZ$ does both simultaneously. All four are self-inverse: $X^2 = Y^2 = Z^2 = I$. ## Hadamard gate The [[h-gate|Hadamard gate]] maps the $Z$-basis to the $X$-basis and back: $H\lvert 0\rangle = \lvert +\rangle$, $H\lvert 1\rangle = \lvert -\rangle$. It is a $\pi$ rotation about the axis halfway between $x$ and $z$. Applying $H$ twice is the identity. $$H = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\\1 & -1\end{pmatrix}$$ ## Phase gates Phase gates leave $\lvert 0\rangle$ unchanged and multiply $\lvert 1\rangle$ by a phase — a rotation about the $z$-axis that acts only on one basis state: $$S = \begin{pmatrix}1 & 0\\0 & i\end{pmatrix} \qquad T = \begin{pmatrix}1 & 0\\0 & e^{i\pi/4}\end{pmatrix} \qquad P(\lambda) = \begin{pmatrix}1 & 0\\0 & e^{i\lambda}\end{pmatrix}$$ The [[s-gate|S gate]] applies a $\pi/2$ phase ($S^2 = Z$), the [[t-gate|T gate]] applies $\pi/4$ ($T^2 = S$), and the [[p-gate|P gate]] generalizes to an arbitrary angle $\lambda$. The $T$ gate is important for universality: Clifford gates alone (generated by $H$, $S$, CX) are efficiently simulable classically; adding $T$ makes the gate set universal. ## Rotation gates The [[rotation-gates|rotation gates]] $R_x(\theta)$, $R_y(\theta)$, $R_z(\theta)$ rotate the Bloch vector by a continuous angle $\theta$ about each axis, defined via $R_k(\theta) = e^{-i\theta\sigma_k/2}$. Any single-qubit unitary decomposes as $U = R_z(\alpha)R_y(\beta)R_z(\gamma)$ (Euler angle decomposition). The Pauli gates are the $\theta = \pi$ special cases: $X = iR_x(\pi)$, $Z = iR_z(\pi)$. ## Universal parameterization The [[u-gate|U gate]] $U(\theta, \phi, \lambda) = R_z(\phi)R_y(\theta)R_z(\lambda)$ covers all single-qubit rotations: $$U(\theta, \phi, \lambda) = \begin{pmatrix}\cos\frac{\theta}{2} & -e^{i\lambda}\sin\frac{\theta}{2}\\[4pt] e^{i\phi}\sin\frac{\theta}{2} & e^{i(\phi+\lambda)}\cos\frac{\theta}{2}\end{pmatrix}$$ Notable special cases: $H = U(\pi/2, 0, \pi)$, $X = U(\pi, 0, \pi)$, $S = U(0, 0, \pi/2)$. ## Gate list - [[pauli-gates]] — $I$, $X$, $Y$, $Z$ - [[i-gate]] — identity - [[x-gate]] — bit flip - [[y-gate]] — bit and phase flip - [[z-gate]] — phase flip - [[h-gate]] — Hadamard - [[s-gate]] — $\pi/2$ phase ($S^2 = Z$) - [[t-gate]] — $\pi/4$ phase ($T^2 = S$) - [[p-gate]] — arbitrary phase $P(\lambda)$ - [[rotation-gates]] — $R_x$, $R_y$, $R_z$ - [[rx-gate]] — $R_x(\theta)$ - [[ry-gate]] — $R_y(\theta)$ - [[rz-gate]] — $R_z(\theta)$ - [[u-gate]] — $U(\theta, \phi, \lambda)$