> [!definition]
>
> The maximum likelihood rule is a [[Decision Rule|decision rule]] that assigns each received [[Code|codeword]] the most likely sent codeword.
>
> Let $C = \list{x}{N}$ be the [[Set|set]] of all possible codewords, and $y$ be the codeword received. Consider the $N$ [[Conditional Probability|conditional probabilities]] $P_{y}(x_j\ \text{sent})$. We assign $x_j$ to be the sent codeword if
> $
> P_y(x_j\ \text{sent}) \gt P_y(x_k\ \text{sent}) \quad \forall j \ne k
> $
>
> If the code is optimal and the [[Probability Distribution|distribution]] of the codewords is [[Uniform Distribution|uniform]], then by [[Bayes' Theorem]],
> $
> \begin{align*}
> \frac{P(x_j\ \text{sent})P_{x_j}(y)}{P(y)} &\gt \frac{P(x_k\ \text{sent})P_{x_k}(y)}{P(y)} \quad \forall j \ne k \\
> P_{x_j}(y) &\gt P_{x_k}(y) \quad \forall j \ne k
> \end{align*}
> $
>
> If multiple codewords have the same maximum probability, then one will be chosen at random.