Solution (source code)

= Solution

Independent applications of the <phase-flip channel> are a classical mixture of the eight physical <Pauli Z gate> error patterns. A specified weight-$k$ pattern has <probability> $\epsilon^k(1-\epsilon)^{3-k}$. The recovery from the preceding part succeeds on weight zero and one, and yields the logical <Pauli X gate> on weight two and three. There are three weight-two patterns and one weight-three pattern, so the logical failure probability is
$$
p_L=3\epsilon^2(1-\epsilon)+\epsilon^3=3\epsilon^2-2\epsilon^3.
$$
Averaging the corrected branches gives the complete decoded <quantum channel>
$$
\boxed{\rho'=(1-3\epsilon^2+2\epsilon^3)\rho+(3\epsilon^2-2\epsilon^3)X\rho X.}
$$
In particular, the leading logical error is $3\epsilon^2$, rather than an error of first order in $\epsilon$. For the stated range,
$$
\epsilon-p_L=\epsilon(1-\epsilon)(1-2\epsilon)>0.
$$
Thus the failure probability is smaller than the physical error probability. The decoded channel is a bit-flip channel; it is not $D_{p_L}$, whose error operator would be $Z$. This distinction follows from the logical codeword exchange in the <phase-flip repetition code>.