Question 4: Quantum Operators (Translating a State Mapping to a Matrix)
Source: Chapter 02, slides 3-4, 7-9, 19, 21, 27, 32-33
Task type for every problem below: you are given a state mapping (where each input basis ket goes), and you must construct the operator matrix . Method for every problem, per chapter 02 slides 7-9:
- Write as an outer-product sum: .
- Take the adjoint (conjugate transpose) of each input ket to form its bra. Forgetting this step is the single most common mistake (slide 8’s explicit warning).
- Expand each bra in the basis and collect terms of the form ; each such term contributes its coefficient to row , column of the matrix (Trick 1).
- Assemble the full matrix and verify it is orthonormal (), which is what makes it a physically valid, reversible gate.
Problem 1: NOT gate from its mapping
Given: , .
Step 1, write the outer-product sum.
Step 2, place columns (Trick 1). The image of becomes column 0, the image of becomes column 1.
Step 3, assemble.
Step 4, verify orthonormality.
This is the Pauli / NOT gate.
Problem 2: Hadamard gate from its mapping (chapter 02 slide 8’s worked example)
Given: , .
Step 1, write the outer-product sum.
Since and are the plain standard basis, their bras need no extra phase work, only the transpose.
Step 2, place columns.
Step 3, assemble.
Step 4, verify.
This is the Hadamard gate .
Problem 3: complex-phase input basis (chapter 02 slide 9’s worked example)
Given: , . Here the input kets themselves carry a phase, so the adjoint step (Step 2 of the method) is not optional.
Step 1, take the adjoint of each input ket. The input kets are and . Their bras (conjugate transpose, which flips the sign of the phase) are and .
Step 2, write the outer-product sum.
Step 3, place columns. Column 0 (multiplies ): row 1 gets , row 0 gets . Column 1 (multiplies ): row 0 gets , row 1 gets .
Step 4, verify. The entry of is , and the entry is ; off-diagonal entries are . So . Valid.
Why the adjoint step cannot be skipped. If you had skipped the adjoint and used instead, would still equal (this particular case is symmetric), but the resulting matrix would map to instead of , which does not match the stated mapping at all. This is exactly the failure mode slide 8’s warning is protecting against.
Problem 4: controlled-NOT from its mapping (chapter 02 slide 32’s worked example)
Given: , , , .
Step 1, write the outer-product sum.
Step 2, place entries. Using basis order indexed : places a at ; at ; at ; at .
Step 3, assemble.
Step 4, verify. Each row and column has exactly one , so automatically (a permutation matrix is always orthonormal).
This is controlled-NOT (control = wire 1, target = wire 2), matching chapter 03 slide 11’s matrix exactly.
Problem 5: swap gate from its mapping (chapter 02 slide 33’s worked example)
Given: , , , .
Step 1, write the outer-product sum.
Step 2, place entries. at ; at ; at ; at .
Step 3, assemble.
Step 4, verify. Again a permutation matrix, so automatically.
This is swap, matching chapter 03 slide 38’s matrix.
Problem 6: non-standard input basis
Given: , , where and .
Step 1, write the outer-product sum.
Step 2, expand the bras. Since are real, and .
Step 3, substitute and collect terms.
Collecting by row and column: row0col0 , row0col1 , row1col0 , row1col1 .
Step 4, assemble.
Step 5, verify.
Step 6, check against the mapping directly.
Comparing to the rotation-gate table (chapter 04 slide 14), .
Problem 7: Pauli from its mapping
Given: , .
Step 1, write the outer-product sum.
Step 2, place columns.
Step 3, assemble.
Step 4, verify. The entry of is ; the entry is ; off-diagonal entries are . So . Valid.
This is the Pauli gate.
Problem 8: augmented operator on a 3-qubit register
Given, following chapter 03 slide 34’s augmentation notation: on 3 qubits, an operator acts as plain only on qubit 3, leaving qubits 1 and 2 completely untouched, for every value of qubits 1 and 2. In slide notation this is
Step 1, choose a basis ordering. Rather than writing four separate outer-product terms (one per pair) and merging them by hand, use the block structure directly. Order the 8-dimensional basis by the index ( is qubit 3, the least significant bit): at positions through .
Step 2, identify the pattern. The mapping only ever flips the last bit , and never touches or , so it is a permutation that swaps each consecutive pair:
Step 3, assemble as a block-diagonal matrix. This is a block-diagonal matrix made of four copies of the block along the diagonal (one block per fixed pair):
where denotes block-diagonal placement.
Why this matches the course pattern. This matches chapter 03 slide 34’s examples (, , , controlled-NOT), where a single-qubit or two-qubit gate is embedded into a larger register by leaving every other qubit as an identity block.
Step 4, verify. It is also a valid gate: each block on the diagonal is orthonormal, so the full block-diagonal matrix is orthonormal too.