I suspect you mean to say you would reject $H_0$ when $\hat{X}=22$. You would also reject $H_0$ when $\hat{X}=21$ since that too is inconsistent with $N=20$.
You take $\alpha$ into account in deciding whether to reject $H_0$ when $\hat{X}=20$ or particular smaller values. For that you need some calculations
- If $H_0$ is true and $N=20$, then $P_{20}(\hat{X} \ge k) = \left(\frac{20}{20}\right)^n-\left(\frac{k-1}{20}\right)^{n}$.
- You want this to be as big as possible but less than or equal to $\alpha=0.05$.
- Solving $\left(\frac{20}{20}\right)^n-\left(\frac{k-1}{20}\right)^{n} \le 0.05$ requires $\left(\frac{k-1}{20}\right)^{n} \ge 0.95$ and so $k\ge 1+20\sqrt[n]{0.95}$
- This then gives a rejection region when $\hat{X} \ge 1+20\sqrt[n]{0.95}$
Note that the answer depends on $n$, which you have not specified.
In practice, since $\hat{X}$ is an integer and by the two hypotheses cannot exceed $22$, the rejection region for $\alpha=0.05$ would be when $\hat{X} \in \{20,21,22\}$ when $n=1$ and $\hat{X} \in \{21,22\}$ when $n \gt 1$
Suppose you have $n = 10$ trials with $x$ successes and you want
to test $H_0: p = 1/2$ vs $H_a: p \ne 1/2$ at (somewhere near) the 5% level.
I say 'somewhere near' because the binomial distribution is discrete, so
it is not possible in general to achieve an exact significance level.
Under $H_0,$ (that, is assuming the null hypothesis to be true) the number of successes $X \sim \mathsf{Binom}(n=10,\, p = 1/2).$
In your last inequality the fraction on the left-hand side is smallest when $\hat p = X/n$ is far from $1/2.$ So you need to reject when the number of successes $X$ is far from $n/2.$
n = 10; x = 1:(n-1)
p = x/n; frac=.5^n/(p^x*(1-p)^(n-x))
plot(x, frac, pch=19)
Accordingly, we might reject for $X = 0,1,9,10,$ the four values most removed from $10/2 = 5.$ A calculation using the binomial PDF gives $P(X \le 2) = P(X \ge 9) = 0.0214.$ So that rejection rule leads to a test at about the 2% level.
If we try to reject for $X = 0,1,2,8,9,10,$ then the significance level escalates to $0.109,$ so you would be testing at about the 11% level. If you want to keep the significance level below 5%, then you'll have to use
the rule to reject for $X = 0,1,9,10.$
Here is a graph of the relevant binomial PDF:
Computations using R statistical software:
rej = c(0,1,9,10); sum(dbinom(rej, 10, .5))
[1] 0.02148438
rej = c(0,1,2,8,9,10); sum(dbinom(rej, 10, .5))
[1] 0.109375
Note: For larger values of $n,$ one might approximate binomial probabilities using a normal distribution, but $n = 10$ is a bit too small for completely satisfactory normal approximations.
Best Answer
With $T(X)=\min\limits_{1\le i\le n} X_i$, we have the exact distribution $n(T-\theta)\sim \mathsf{Exp}(1)$, which is the same as$$2n(T-\theta)\sim \chi^2_2\tag{*}$$
There is more than one way to derive a test for testing $H_0:\theta\le\theta_0$ against $H_1:\theta>\theta_0$.
One elementary way is to find the test corresponding to a given confidence interval for $\theta$ based on $T$.
Using the pivot in $(*)$, we have $$P_{\theta}\left(2n(T-\theta)< \chi^2_{2,\alpha}\right)=1-\alpha\quad\forall\,\theta\in\mathbb R\,,$$
where $\chi^2_{2,\alpha}$ denotes the $(1-\alpha)$th quantile of a $\chi^2_2$ distribution.
Or, $$P_{\theta}\left(\theta> T-\frac{\chi^2_{2,\alpha}}{2n}\right)=1-\alpha\quad,\forall\,\theta\tag{**}$$
This says that a (one-sided) $100(1-\alpha)\%$ confidence interval for $\theta$ is $$I(X)=\left(T-\frac{\chi^2_{2,\alpha}}{2n},\infty\right)$$
From $(**)$, we can say that for some $\theta_0$,
$$P_{\theta_0}\left(\theta_0< T-\frac{\chi^2_{2,\alpha}}{2n}\right)=P_{\theta_0}\left(T>\theta_0+\frac{\chi^2_{2,\alpha}}{2n}\right)=\alpha$$
So the size $\alpha$ test obtained by 'inverting' the interval $I$ rejects $H_0$ whenever $T>\theta_0+\frac{\chi^2_{2,\alpha}}{2n}$.
It can be shown that this test is in fact the likelihood ratio test and also the uniformly most powerful test (via this result) for testing $H_0$ against $H_1$.