liveBook · Manning

Phase shift

As explained in Building Quantum Software with Python

A phase shift is an angular change in the phase of a periodic or complex-valued quantity.

A phase shift changes the angular direction of a periodic or complex-valued quantity. In a quantum circuit, a phase gate rotates selected amplitudes without changing their magnitude. section 8.2

For a geometric sequence state, qubit j receives a phase shift of 2^jθ. Interference then gives outcome k an amplitude direction of kθ. section 8.2

A practical encoding pattern is:

  • Apply a Hadamard gate to every qubit to equalize amplitude magnitudes. section 8.2
  • Apply a phase gate with angle 2^jθ to qubit j. section 8.2
  • Read each outcome’s amplitude direction as the accumulated rotation along its tree path. section 8.2

Three-qubit encoding

With θ = π/3, phase gates use angles π/3, 2π/3, and 4π/3 on qubits 0, 1, and 2. Their combined rotations encode the geometric sequence state. section 8.2

Listing 8.1 Creating a circuit for encoding a geometric sequence state
from sim_circuit import QuantumRegister, QuantumCircuit

def geometric_sequence_circuit(n, theta):

    N = 2**n

    q = QuantumRegister(n)
    qc = QuantumCircuit(q)

    for j in range(n):            #1
        qc.h(q[j])

    for j in range(n):           #1
        qc.p(2 ** j * theta, q[j])

    return qc

Inspect the Python circuit that applies Hadamard gates and qubit-specific phase gates. section 8.2

How Building Quantum Software with Python covers it

How deep it goes
Explains amplitude rotations, binary outcome paths, and recursive gate construction, but stops short of a formal derivation.
Examples
Uses π/3, 2π/3, and 4π/3 rotations in three-qubit state tables and tree diagrams.
What it assumes
Assumes basic qubits, amplitudes, quantum gates, and outcome notation while illustrating the encoding pattern concretely.
What you can do after
Apply it via a Python circuit function that builds geometric sequence states from qubit count and angle.
How it connects
Connects phase gates with Hadamard gates, interference, quantum states, and the quantum Fourier transform.

This explainer was generated by Manning's knowledge graph from the text of Building Quantum Software with Python. The section links point to the parts of the book it draws on.