liveBook · Manning

Controlled quantum operation

As explained in Quantum Programming in Depth

A controlled gate is a quantum gate whose operation on a target system is conditioned on one or more control qubits.

A controlled quantum operation applies a unitary U to target qubits only when its control qubits match a specified pattern. In the standard all-ones form, U acts when every control is |1⟩; otherwise the basis state is unchanged. Linearity extends this rule to superpositions. A CNOT is the simplest case: a controlled X with one control and one target. section 2.3.1

Control choice is part of the operation. For two qubits, either the most or least significant qubit can control U, and a gate can be controlled on |1⟩ or on |0⟩. Matrix layouts therefore depend on the basis-index convention: Qiskit uses little-endian bit strings, while Q# uses big-endian ones. section 3.5.1

Figure 3.4 The row and column indices of \(4 \times 4\) matrices. The indices are written in binary using little-endian notation: the least significant bit is written first. You can see that the top-left and bottom-right blocks group the elements for which the most significant (the last) bit of the row index equals that of the column index: for the matrix \(A\) in the top-left block, the most significant bit is \(0\), and for the matrix \(B\) in the bottom-right block, the most significant bit is \(1\).
figure

Inspect the binary row and column indices to see why a controlled operation occupies an identity block for one control value and an operation block for the other. section 3.5.1

Controlled operations provide a direct construction tool for structured unitaries:

  • Implement a block-diagonal matrix diag(A, B) by combining controlled B with controlled-on-zero A on the same control. The operations commute because their control patterns are disjoint. section 3.5.2
  • Separate a two-qubit CS matrix into unitary pieces M0 and M1, then apply controlled M1 and controlled-on-zero M0. section 3.6.1
  • Extend a controlled single-qubit operation to n qubits by using n−1 controls whose little-endian pattern selects the affected pair of basis states. section 3.9.1

Making a global phase observable

A controlled operation can turn an otherwise unobservable global phase into a relative phase. Prepare |++⟩, apply a controlled unknown X-like gate, and compare the result: controlled X leaves the state unchanged, while controlled −X produces a relative minus sign on the control qubit. This supports distinguishing the two operations through a suitable measurement sequence. section 5.1.1

Converting a phase oracle into a marking oracle

Prepare an ancilla in |0⟩, apply H, use it as the control for a controlled phase oracle, then apply H again. A marked input gives the ancilla |1⟩; an unmarked input gives |0⟩, producing the marking-oracle behavior. section 7.1.1

How Quantum Programming in Depth covers it

How deep it goes
Defines basis-state and superposition behavior, derives matrix decompositions, and extends them to multiple controls through basis-index analysis.
Examples
Uses CNOT, controlled X versus controlled −X on |++⟩, CS matrices, and a phase-oracle-to-marking-oracle conversion.
What it assumes
Assumes Dirac notation and matrix-index reasoning while refreshing controlled-gate effects on basis states and superpositions.
What you can do after
Evaluate/understand controlled operations as state transformations and compose them to implement selected matrix blocks or oracle behavior.
How it connects
Connects CNOT, controlled-on-zero gates, block-diagonal matrices, CS matrices, global phase, phase kickback, and phase oracles.

Also explained in

Compare how 2 books explain controlled quantum operation →

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.