liveBook · Manning

W state

As explained in Quantum Programming in Depth

A W state is a multipartite quantum state that is an equal superposition of computational-basis states containing exactly one excited qubit.

A W state on N qubits is an equal superposition of the N computational-basis states containing exactly one 1 and N−1 zeros. In an N queens search, one W state represents one board row. section 8.2.1

Encoding an N queens search space

Prepare one |W_N⟩ state for each row and take their tensor product. Every basis state in the resulting mean state already places exactly one queen in every row, so Grover’s oracle can omit row-validity checks and focus on columns and diagonals. section 8.2.1

Using W states changes the validation workload:

  • Exclude placements with zero or multiple queens per row before the search begins. section 8.2.1
  • Check column uniqueness through parity rather than counting every column occupancy. section 8.2.1
  • Check diagonal conflicts pairwise across rows and combine the results with XOR. section 8.2.1
Figure 8.5 Check that each column has exactly one queen, knowing that each row has exactly one queen. We can count the parity of the number of queens in each column and check that it’s odd. Any placement for which this constraint is not satisfied will have at least one empty column with even parity.
figure

Shows how the row constraint supplied by W states lets the oracle test column validity using odd and even parities. section 8.2.1

How Quantum Programming in Depth covers it

How deep it goes
Defines the state mathematically and explains its effect on oracle constraints, without detailing state-preparation circuits.
Examples
Uses one W state per board row, then validates columns by parity and diagonals through pairwise XOR checks.
What it assumes
Uses computational-basis notation and tensor products while defining the W-state structure directly.
What you can do after
Apply it to encode row-valid N-queens candidates and simplify the corresponding Grover oracle.
How it connects
Connects W states with Grover’s algorithm, tensor products, quantum oracles, superposition, and the N queens puzzle.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quantum Programming in Depth. The section links point to the parts of the book it draws on.