Solution (source code)

= Solution

The derivative of the log ratio is $\tfrac12(n/q-1)$, so $\lambda(q)$ increases from zero to one on $(0,n)$ and decreases to zero on $(n,\infty)$. Rejecting for a sufficiently small ratio therefore gives two tails with $0<q_1<n<q_2$.

Under $H_0$, <Cochran's theorem> gives the exact <sampling distribution> $Q=S/\sigma_0^2\sim\chi_{n-1}^2$, independently of the unknown mean. Writing $F_{n-1}$ for its <cumulative distribution function>, the two cutoffs are determined by
$$
\boxed{F_{n-1}(q_1)+1-F_{n-1}(q_2)=\alpha,\qquad n\log(q_2/q_1)=q_2-q_1}.
$$
The first equation calibrates the exact <size of a statistical test>. The second is $\lambda(q_1)=\lambda(q_2)$, so both tails belong to one <likelihood ratio> cutoff. Hence the exact <critical region> is $\boxed{\{q\leq q_1\}\cup\{q\geq q_2\}}$. Its two tail probabilities are not generally equal: equal-tailed chi-squared cutoffs give a different test.