The General Phase Gate P(λ)
The general phase gate multiplies the component of a qubit by the complex number while leaving untouched:
Its matrix representation in the computational basis is
This is a relative phase operation. A global phase — multiplying the entire state by — has no physical consequence, because probabilities depend only on amplitude magnitudes. But a relative phase between the and components changes the direction of the Bloch vector and can be detected by interference, making it physically meaningful.
Special cases you already know
Several gates you may have met are just at specific angles:
| Gate | | Effect on | |------|-----------|-----------------------| | | | | | | | | | | | |
In code, every one of these can equivalently be written as c.p(lambda, qubit) with the
appropriate , so the circuit library exposes P as the general primitive.
Relative phase in a superposition
only changes something observable when the qubit is in a superposition. Starting from , apply the Hadamard to get , then apply :
For in particular, the result is
which is the state — the eigenstate of the Pauli operator. The measurement probabilities are still , but the Bloch vector now points along instead of . The phase is invisible to a single -basis measurement; it reveals itself only in an - or -basis measurement, or through interference in a larger circuit.
Try it
Starting from , create the state using followed by . The grader compares your full statevector to the expected output.
After running, inspect the State panel: the amplitude should read (real, imaginary ) and the amplitude should read imaginary part , confirming that the relative phase is .
Sign in on the full site to ask questions and join the discussion.