|q⟩ Bad Qubits

intermediate · Programming · The Hidden Subgroup Problem (Intro)

Deutsch–Jozsa as HSP

The Deutsch–Jozsa algorithm is historically the first quantum algorithm to demonstrate an exponential separation over deterministic classical computation. It solves a promise problem — is a black-box function constant or balanced? — in a single query where a classical deterministic algorithm needs up to 2n1+12^{n-1}+1 queries. Once you understand the Hidden Subgroup Problem (HSP), you gain a cleaner view of why the algorithm works: the constant case maps directly onto an HSP instance over the group Z2n\mathbb{Z}_2^n, and the algorithm's structure is that of the standard abelian HSP circuit.

The group structure

Recall from the previous lessons that the HSP asks us to identify a hidden subgroup HH of an abelian group GG given oracle access to a function f:GSf : G \to S that is constant on cosets of HH and takes distinct values on distinct cosets.

For the Deutsch–Jozsa problem the setting is:

The key observation is that the two cases relate differently to the subgroup structure of Z2n\mathbb{Z}_2^n:

| Case | Hidden subgroup HH | Cosets | |------|--------------------|--------| | Constant | All of Z2n\mathbb{Z}_2^n | Only one coset: GG itself | | Balanced | No HSP subgroup structure | — |

When ff is constant, it is trivially constant on every coset of GG (since there is only one coset, GG itself) — this is a valid HSP instance with H=GH = G. When ff is balanced, the function takes both values 00 and 11 equally, and there is in general no proper subgroup HH such that ff is constant on every coset of HH with distinct cosets mapping to distinct values. The balanced case is therefore not a standard HSP instance; instead, it is identified by the quantum algorithm via amplitude cancellation (see the circuit section below).

The quantum subroutine is Fourier sampling

The standard HSP algorithm for abelian groups runs the following circuit:

  1. Prepare an equal superposition over all group elements: apply HnH^{\otimes n} to 0n|0^n\rangle.
  2. Query the oracle in superposition to entangle the function value with the input register.
  3. Discard (trace out) the output register.
  4. Apply the Quantum Fourier Transform (QFT) over GG to the input register.
  5. Measure.

For G=Z2nG = \mathbb{Z}_2^n the QFT is again HnH^{\otimes n} (since the Hadamard transform is its own inverse and coincides with the Fourier transform over Z2n\mathbb{Z}_2^n). The resulting circuit is exactly the Deutsch–Jozsa circuit:

0n1  Hn+1  12nxZ2nx012  Uf  12nx(1)f(x)x012  Hn  |0^n\rangle|1\rangle \;\xrightarrow{H^{\otimes n+1}}\; \frac{1}{\sqrt{2^n}}\sum_{x \in \mathbb{Z}_2^n}|x\rangle\otimes\frac{|0\rangle - |1\rangle}{\sqrt{2}} \;\xrightarrow{U_f}\; \frac{1}{\sqrt{2^n}}\sum_x (-1)^{f(x)}|x\rangle\otimes\frac{|0\rangle - |1\rangle}{\sqrt{2}} \;\xrightarrow{H^{\otimes n}}\; \cdots

After the final HnH^{\otimes n}, the amplitude of the all-zeros string 0n|0^n\rangle is

α0n=12nxZ2n(1)f(x).\alpha_{0^n} = \frac{1}{2^n}\sum_{x \in \mathbb{Z}_2^n} (-1)^{f(x)}.

If ff is constant, every term in the sum has the same sign, so α0n2=1|\alpha_{0^n}|^2 = 1: we measure 0n0^n with certainty. If ff is balanced, the positive and negative terms cancel exactly, so α0n=0\alpha_{0^n} = 0: the all-zeros outcome never appears.

Why the HSP lens clarifies the algorithm

From the HSP perspective, the measurement in step 5 samples from the dual group G^=Z2n\hat{G} = \mathbb{Z}_2^n. The output distribution concentrates on characters χ\chi that are constant on HH — exactly the characters that are trivial on HH, i.e. elements of the annihilator HH^\perp of HH in G^\hat{G}.

Relationship to Simon's problem

Simon's problem (the next lesson) is the natural next step in the same family: instead of deciding whether ff is constant (i.e., H=GH = G) or not, we are given a genuine HSP promise — ff has hidden period ss with H={0n,s}H = \{0^n, s\} for an unknown ss — and must identify ss. The HSP Fourier-sampling strategy is the same, but now we need O(n)O(n) samples to pin down all nn bits of ss.

The progression

Deutsch (1 bit)    Deutsch–Jozsa    Simon    Shor (order-finding)\text{Deutsch (1 bit)} \;\subset\; \text{Deutsch–Jozsa} \;\subset\; \text{Simon} \;\subset\; \text{Shor (order-finding)}

is a chain of increasingly powerful HSP instances, all solved by the same conceptual strategy of quantum Fourier sampling over an abelian group.

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