Solution (source code)

= Solution

For a received word $y$, the ideal-observer rule chooses a message $i$ maximizing the posterior probability
$$
\mathbb P(M=i\mid Y=y).
$$
Maximum-likelihood decoding chooses $i$ maximizing
$$
\mathbb P(Y=y\mid M=i),
$$
and minimum-distance decoding chooses a codeword minimizing its Hamming distance from $y$.

Bayes' formula gives
$$
\mathbb P(M=i\mid Y=y)
\propto \mathbb P(Y=y\mid M=i)\mathbb P(M=i).
$$
Equal message priors therefore make ideal-observer and maximum-likelihood decoding identical. On a <binary symmetric channel>, if $d=d_H(y,c_i)$, then
$$
\mathbb P(Y=y\mid M=i)=p^d(1-p)^{n-d}.
$$
For $p<1/2$, this strictly decreases with $d$, so maximum likelihood and minimum distance agree.