# P gate (Phase gate) **P gate** applies a phase $e^{i\theta}$ to the $|1\rangle$ state, leaving $|0\rangle$ unchanged. It is a parameterized single-qubit gate that rotates around the z-axis on the Bloch sphere. With specific angle choices, the P gate becomes S ($\theta = \pi/2$), T ($\theta = \pi/4$), or Z ($\theta = \pi$). Matrix: $$P(\theta) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\theta} \end{pmatrix}$$ Action: $P(\theta)|0\rangle = |0\rangle$, $P(\theta)|1\rangle = e^{i\theta}|1\rangle$ (adds phase $\theta$ to $|1\rangle$). ## Properties - **Parameterized**: $\theta$ is an arbitrary angle; different $\theta$ values give different gates - **Diagonal**: phase gates do not entangle or mix basis states - **Inverse**: $P(\theta)^\dagger = P(-\theta)$ - **Composition**: $P(\theta_1) P(\theta_2) = P(\theta_1 + \theta_2)$ (phases add) - **Periodicity**: $P(\theta + 2\pi) = P(\theta)$ (global phase equivalence) - **Clifford structure**: P is Clifford only for specific angles (e.g., $\theta = \pi/2$ (S), $\theta = \pi$ (Z)); non-Clifford for others (e.g., $\theta = \pi/4$ (T)) ## Special cases Common instances of the P gate with specific angles: - **S gate**: $P(\pi/2) = S = R_Z(\pi/2)$; applies 90° phase - **T gate**: $P(\pi/4) = T = R_Z(\pi/4)$; applies 45° phase - **Z gate**: $P(\pi) = Z = R_Z(\pi)$; applies 180° phase (Pauli Z) - **S† gate**: $P(-\pi/2) = S^\dagger = R_Z(-\pi/2)$; applies -90° phase - **T† gate**: $P(-\pi/4) = T^\dagger = R_Z(-\pi/4)$; applies -45° phase ## Relation to rotations The P gate is a special case of the [[quantum-gate-rz|RZ rotation gate]]: $$P(\theta) = R_Z(\theta) = \begin{pmatrix} e^{-i\theta/2} & 0 \\ 0 & e^{i\theta/2} \end{pmatrix} \times e^{i\theta/2}$$ The difference is a global phase factor that doesn't affect measurement outcomes. On superconducting qubits, P gates are typically implemented as virtual RZ rotations via reference frame adjustment. ## Uses - **State preparation**: rotate basis states to arbitrary phases - **Circuit synthesis**: build arbitrary unitaries from phase and bit-flip layers - **Variational algorithms**: parameterized phase gates in quantum circuits (VQE, QAOA) - **Algorithm implementation**: phase corrections in quantum algorithms - **Bloch sphere rotation**: explicit z-axis rotation without physical pulses (superconducting qubits) ## Implementation - **Superconducting qubits**: RZ($\theta$) is virtual (reference frame adjustment); essentially free - **Trapped ions**: detuned laser pulse applies phase without excitation - **Photonic**: optical phase shifter set to angle $\theta$ - **Cost**: free or near-free on most platforms (no physical pulse required if virtual); specific-angle gates (S, T) may be optimized ## Relations - [[quantum-gate-phase|Phase gates]]: category containing P and other parameterized phase gates - [[quantum-gate-s|S gate]]: special case $P(\pi/2)$ - [[quantum-gate-s-dagger|S† gate]]: special case $P(-\pi/2)$ - [[quantum-gate-t|T gate]]: special case $P(\pi/4)$ - [[quantum-gate-t-dagger|T† gate]]: special case $P(-\pi/4)$ - [[quantum-gate-z|Z gate]]: special case $P(\pi)$; Pauli Z - [[quantum-gate-rz|RZ gate]]: P gates are equivalent to RZ rotations (modulo global phase) - [[quantum-gate-clifford|Clifford gates]]: P is Clifford for specific angles (S, Z) but not others (T) - [[quantum-gate-single-qubit|Single-qubit gates]]: fundamental building block