Skip to content
Quantum ComputingAN INTERACTIVE OPEN TEXTBOOK
charithj.com.au

Phase and rotation gates

Continuous changes of angle, and the phase conventions behind familiar gate names.

15 min readDr. Charith Jayasekara↓ Chapter PDF
By the end, you’ll be able to
  • Relate S and T to the phase gate P.
  • Calculate a Y rotation on the zero state.
P(ϕ)=(100eiϕ).P(\phi)=\begin{pmatrix}1&0\\0&e^{i\phi}\end{pmatrix}.

It leaves the magnitude of each amplitude unchanged. Therefore it does not change Z-basis probabilities immediately. S is P(π/2)P(\pi/2), T is P(π/4)P(\pi/4) and Z is P(π)P(\pi).

The interference experiment places P between two H gates so you can observe its effect.

Section titled “A rotation is related, but check its convention”
Rz(ϕ)=(e−iϕ/200eiϕ/2).R_z(\phi)=\begin{pmatrix}e^{-i\phi/2}&0\\0&e^{i\phi/2}\end{pmatrix}.

For a standalone one-qubit operation, P(ϕ)=eiϕ/2Rz(ϕ)P(\phi)=e^{i\phi/2}R_z(\phi), so they differ only by global phase. Controlled versions require more care: a phase on one controlled branch can become a relative phase in the larger system.

The Y rotation is

Ry(θ)=(cos⁡(θ/2)−sin⁡(θ/2)sin⁡(θ/2)cos⁡(θ/2)).R_y(\theta)=\begin{pmatrix}\cos(\theta/2)&-\sin(\theta/2)\\\sin(\theta/2)&\cos(\theta/2)\end{pmatrix}.

Applying it to zero gives amplitudes cos⁡(θ/2)\cos(\theta/2) and sin⁡(θ/2)\sin(\theta/2). At θ=2π/3\theta=2\pi/3, the probabilities are 1/41/4 and 3/43/4.

Set the qubit explorer’s polar angle to 120° and phase to 0°. Compare it with the Y-rotation example. Then apply S and T and explain why the displayed Z probabilities stay fixed while the arrow moves.

WORKED DIAGRAM · F17A phase gate rotates the 1-component in the complex plane
A phase gate rotates the 1-component in the complex planeFor β = 1/√2, applying S multiplies β by i: its phase moves counterclockwise by π/2 while its magnitude stays fixed. The 0-component is unchanged. The diagram is the complex plane of β, not the three-dimensional Bloch projection.ReImβiβS : β ↦ iβMagnitude stays 1/√2Relative phase increases by π/2
For β = 1/√2, applying S multiplies β by i: its phase moves counterclockwise by π/2 while its magnitude stays fixed. The 0-component is unchanged. The diagram is the complex plane of β, not the three-dimensional Bloch projection.

The S gate rotates the one amplitude by a quarter turn while leaving the zero amplitude fixed. Its magnitude does not change. Applying it to plus produces the positive-y state, whose Z probabilities are still equal. Another S produces minus, and two more return plus. The diagram follows the amplitude, while the Bloch sphere follows the corresponding physical state.

A phase gate does not rotate the entire statevector by a common factor unless the input has only one occupied basis component. On a general superposition, it changes the phase difference between components. A later H can reveal that difference as unequal probabilities. This is the same mechanism used by the interference lab, now expressed through named gates.

Begin with plus. T multiplies the one amplitude by a phase of 45 degrees. The state before readout has amplitudes one over the square root of two and one half plus i over two. After H, the output probabilities are

P(0)=cos⁡2(π/8)=2+24,P(1)=sin⁡2(π/8)=2−24.P(0)=\cos^2(\pi/8)=\frac{2+\sqrt2}{4},\qquad P(1)=\sin^2(\pi/8)=\frac{2-\sqrt2}{4}.

These are approximately 85.4 percent and 14.6 percent. The immediate post-T histogram would have been equal, so the final H is essential to this readout. You can derive the result by adding the complex components or by using the half-angle interference formula. Agreement between those methods is a useful check on angle units and phase signs.

Applying T twice gives S, applying it four times gives Z, and applying it eight times gives the identity. These are exact identities for the stated phase convention. They do not imply that repeated physical gates have no errors or that a compiler should always implement an angle through repeated T gates. Native operations and fault-tolerant synthesis can change the best implementation.

P and the Z rotation differ by a common phase when acting alone on a one-qubit state. Their isolated measurement predictions therefore agree. Their printed amplitudes can differ because one convention fixes the zero amplitude while the other shares opposite half-angle phases between both components. Compare physical states rather than assuming identical matrices.

If the operation is controlled, that common phase can become relative between the control’s inactive and active branches. Replacing a controlled phase gate with a controlled Z rotation may require an additional correction on the control. This is a useful warning against dropping phases too early in a subroutine that will later be embedded in a larger circuit.

A Y rotation on zero has real amplitudes given by the cosine and sine of half its angle. At an angle of 60 degrees, the probabilities are three quarters and one quarter. At 180 degrees, the output is one. Unlike a diagonal phase gate, this rotation changes Z populations directly. The axis and sign convention must be stated before interpreting a rotation parameter.

The explorer’s polar slider prepares the standard angle state directly. It is not a general-purpose button applying an incremental Y rotation to whatever state is currently present. If you change a preparation angle after pressing gates, the slider defines a fresh state. Use the gate buttons for transformations and the sliders for preparation, and record which action produced your result.

This instance opens at plus. Predict the amplitudes after S, then reveal. Reset and apply T followed by H. Predict the probabilities using the worked result above. Compare the real and imaginary table entries before relying on rounded percentages. Applying H to the final state again should undo that last H and recover the phase-shifted plus preparation.

L01 · INTERACTIVE LABRuns on your device

Qubit explorer

Prepare a pure qubit, apply gates, then compare amplitudes, phases and Z-basis probabilities. Reset restores the initial preparation shown by the lesson’s controls.

Experiment controls

Predict the amplitudes and Z-basis probabilities for the preparation and gates you have chosen. If starting from |0⟩, what will H do?

Record a prediction to enable the results.

Results are hidden.

Prepare your experiment using the controls. Record a prediction, then reveal the statevector or run the experiment.

Changing the preparation or circuit starts a new prediction.

MODEL · Ideal pure-state vector, complex double precisionORDER · q0 is the leftmost bit
Take it further

Prepare θ = 120°, φ = 90°. Predict both complex amplitudes. Then change φ without changing θ.

For a rotation-style preparation, reset and choose polar angle 60 degrees with zero relative phase. Calculate both amplitudes and check the three-quarter/one-quarter distribution. Then change the phase to 90 degrees without changing the polar angle. Explain why the population stays fixed while the one amplitude becomes imaginary.

A student says S is its own inverse because applying it does not change Z probabilities. Calculate S squared on plus and compare with the original state. Find an inverse using only repeated S gates.

Check your reasoning

Two S gates produce Z, which maps plus to minus. Those are different physical states despite equal Z probabilities. Three S gates implement the inverse of one S, since four quarter turns make a full turn. A gate’s inverse must restore the entire state for every input, including relative phases, rather than merely preserving one chosen histogram.

When comparing phase conventions across tools, first test zero, plus and a state with an imaginary component. Zero exposes an overall phase choice, plus reveals relative phase, and the complex input catches conjugation or sign errors that real inputs can hide. State which differences are physically equivalent before changing a correct implementation merely to match another tool’s printed entries.

PAUSE & THINK

Is S its own inverse because it preserves Z probabilities?

Choose your answer

Reference: IBM Quantum — Quantum information.

ONE IDEA FURTHER

Ready for the next step?

Your progress stays in this browser.