|q⟩ Bad Qubits

beginner · Programming · Single-Qubit Gates II: H, S, T & Phase

Phase Gates on |+⟩

A qubit in the equal superposition +=12(0+1)|+\rangle = \tfrac{1}{\sqrt{2}}(|0\rangle + |1\rangle) sits exactly on the equator of the Bloch sphere, pointing along the +x+x axis. Phase gates leave the north and south poles fixed but rotate every equatorial state around the zz-axis, moving it to a new point on the equator.

Phase gates as zz-axis rotations

A phase gate P(λ)P(\lambda) multiplies the 1|1\rangle amplitude by eiλe^{i\lambda} while leaving 0|0\rangle unchanged:

P(λ)=(100eiλ).P(\lambda) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\lambda} \end{pmatrix}.

The three standard phase gates are special cases of P(λ)P(\lambda):

| Gate | λ\lambda | Effect on +|+\rangle | |------|-----------|----------------------| | TT | π/4\pi/4 | 12(0+eiπ/41)\tfrac{1}{\sqrt{2}}(|0\rangle + e^{i\pi/4}|1\rangle) — rotated 45° | | SS | π/2\pi/2 | 12(0+i1)\tfrac{1}{\sqrt{2}}(|0\rangle + i\,|1\rangle) — rotated 90° to +y+y axis | | ZZ | π\pi | 12(01)=\tfrac{1}{\sqrt{2}}(|0\rangle - |1\rangle) = |-\rangle — rotated 180° to x-x axis |

Starting from +|+\rangle and applying SS yields

S+=12(100i)(11)=12(1i).S|+\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 0\\0 & i\end{pmatrix}\begin{pmatrix}1\\1\end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\i\end{pmatrix}.

On the Bloch sphere this state points along +y+y, often written +i|{+i}\rangle or R|R\rangle.

Keeping track on the Bloch sphere

The Bloch sphere provides a clear picture: any state cos(θ/2)0+eiϕsin(θ/2)1\cos(\theta/2)|0\rangle + e^{i\phi}\sin(\theta/2)|1\rangle lives at polar angle θ\theta and azimuthal angle ϕ\phi. For equatorial states (θ=π/2\theta = \pi/2), P(λ)P(\lambda) shifts ϕ\phi by λ\lambda:

ϕ  P(λ)  ϕ+λ.\phi \;\xrightarrow{P(\lambda)}\; \phi + \lambda.

Starting from +|+\rangle with ϕ=0\phi = 0, applying TT gives ϕ=π/4\phi = \pi/4, applying SS gives ϕ=π/2\phi = \pi/2, and applying ZZ gives ϕ=π\phi = \pi, landing at |-\rangle.

Try it

Prepare +|+\rangle by applying HH to 0|0\rangle, then apply the SS gate to rotate it 90° to the +y+y axis. The grader checks the full state vector.

Run your code to see the quantum state.

After running, the amplitudes should be 120.707\tfrac{1}{\sqrt{2}} \approx 0.707 for 0|0\rangle and i2\tfrac{i}{\sqrt{2}} for 1|1\rangle, confirming the 90° equatorial rotation.

Sign in on the full site to ask questions and join the discussion.