The Mixing Hamiltonian
QAOA alternates two unitaries: a cost unitary that encodes the objective, and a mixer unitary that drives the system away from a fixed point so it can explore the full solution space. Without the mixer, the optimizer would stay trapped in whatever initial state it started in.
The standard mixer Hamiltonian
Farhi, Goldstone, and Gutmann (2014) defined the mixing Hamiltonian as the sum of Pauli- operators over all qubits:
Because acting on qubit commutes with acting on any other qubit , the time evolution factorizes into independent single-qubit rotations:
where is the standard -axis rotation. The factor of 2 enters because the convention is , so matching requires the argument .
Why X is the right choice
The Pauli- operator generates rotations that mix and without preferred direction. An gate is just the gate — a full bit-flip. At intermediate angles it creates genuine superpositions. This means the mixer, parametrized by , can continuously tune how aggressively the quantum state tunnels between different bit-string configurations.
More formally, the mixer must not commute with the cost Hamiltonian , otherwise and the two unitaries could be absorbed into one, removing any quantum advantage. The standard -mixer satisfies this whenever the cost function is diagonal in the basis.
The circuit for two qubits
For qubits and mixing angle , the mixer layer is simply
No two-qubit gates are needed: the terms in each act on a single qubit, so the whole mixer decomposes into parallel single-qubit rotations.
Try it
Build the 2-qubit mixer unitary for . The grader checks the full unitary matrix, so returning an empty circuit will fail.
At each qubit undergoes , a 90-degree rotation about the -axis. The resulting unitary is
\otimes \frac{1}{\sqrt{2}}\begin{pmatrix}1 & -i \\ -i & 1\end{pmatrix}.$$ In a QAOA circuit you would choose $\beta$ as a free variational parameter and tune it classically; here we fix $\beta = \pi/4$ simply to make the expected unitary well-defined for the grader.Sign in on the full site to ask questions and join the discussion.