Prepare , query the oracle, and measure or discard the output register. For , the input register becomes the coset state
Apply , the quantum Fourier transform over . The two amplitudes interfere destructively unless the binary inner product satisfies
and every vector in this orthogonal subspace is sampled uniformly. Repeat until independent equations have been collected, then use Gaussian elimination over to find their one-dimensional null space; its nonzero vector is . This is Simon's algorithm. It uses oracle queries with high probability and polynomial classical work. When , the function is injective and the samples eventually span all of , which distinguishes that case with arbitrarily high probability.