Solution (source code)

= Solution

The <Neyman-Pearson lemma> compares two simple hypotheses with densities $f_0,f_1$. Among all tests of size at most $\alpha$, a most powerful test rejects when $f_1(x)/f_0(x)>c$, accepts when it is below $c$, and may randomize on equality to attain the prescribed size. The threshold and any boundary randomization are chosen so the rejection <probability> under $H_0$ is $\alpha$.

The key inequality is $(\phi^*-\phi)(f_1-cf_0)\geq0$ pointwise for the likelihood-ratio test $\phi^*$. Integration shows its power is at least that of any competing test with no larger size. With continuous likelihood-ratio statistics, boundary randomization is unnecessary.