= Solution
{c}
For second-<qubit> inputs $|0\rangle$ and $|1\rangle$, <5/c> gives control <expectation values> $\operatorname{Re}U_{00}$ and $\operatorname{Re}U_{11}$. Preparing the <maximally mixed state> $I/2$ is equivalent to choosing these inputs independently with equal <probability> and discarding the choice. Linearity of the <density operator> evolution and <quantum measurement> probabilities therefore gives
$$
\langle Z\rangle_{I/2}
=\tfrac12\operatorname{Re}U_{00}+\tfrac12\operatorname{Re}U_{11}
=\tfrac12\operatorname{Re}\operatorname{Tr}U.
$$
Hence
$$
\boxed{\operatorname{Re}\operatorname{Tr}U=2(P_0-P_1).}
$$
The factor two is essential: the <Hadamard test> directly estimates the normalized <trace>. More generally, a target <density operator> $\rho$ gives $\langle Z\rangle=\operatorname{Re}\operatorname{Tr}(\rho U)$. This argument never requires knowledge of the <eigenvectors> of $U$.
Back to article page