Solution (source code)

= Solution

For a fixed input, the <Holevo–Helstrom theorem> gives the optimal error for the two output states. Optimizing the input and <quantum ancilla> therefore gives
$$
\boxed{
P_{\mathrm{err}}^{\mathrm{anc}}
=\frac12\left(1-\left\|pT_1-(1-p)T_2\right\|_\diamond\right)}.
$$
The stabilization in the <diamond norm> is exactly the optimization over ancillary systems. Without an ancilla the same argument instead gives
$$
\boxed{
P_{\mathrm{err}}^{\mathrm{no\ anc}}
=\frac12\left(1-\left\|pT_1-(1-p)T_2\right\|_1\right)},
$$
where $\|\cdot\|_1$ is the <induced trace norm>.