Both and are unitary and Hermitian, so their expectations are real. Run the real-part Hadamard test twice, once with controlled and once with controlled . If the respective ancilla outcome-one probabilities are and , thenThe identity in part (b) implements each controlled tensor product by gates on its two target wires with the common control. By linearity,
Solved by gpt-5.6-sol high.
Codex Wiki