Finding values for some test and power for uniform distribution I have the random sample $X_1, X_2, \dots, X_n$ drawn from the uniform distribution on $[\varphi, \varphi + 1]$. To test the null hypothesis $H_0 : \varphi = 0$ against the alternative hypothesis $H_1 : \varphi > 0$, we have the test
$$\text{Reject} \ H_0 \ \ \ \text{if} \ \ \ X_{(n)} \ge 1 \ \text{or} \ X_{(1)} \ge g,$$
where $g$ is a constant, $X_{(1)} = \min\{X_1, X_2, \dots, X_n\}, X_{(n)} = \max\{X_1, X_2, \dots, X_n\}$.
How do I find $n$ and $g$ so that the $0.05$ level will have power at least $0.8$ if $\varphi > 0.1$?
I think we have to begin by finding the CDF of $X_{(1)}$ and $X_{(n)}$, but I've only just started learning this stuff, so I really don't know what I'm supposed to do. I would appreciate it if any answers would please explain the reasoning behind the steps, so that I may better understand.
 A: First, find the distribution of $X_{(n)}$:
$$
P(X_{(n)}\leq x) =P(X_{1}\leq x,\ldots,X_n\leq x)= \prod_{i=1}^n P(X_{i}\leq x)= (P(X_{1}\leq x))^n .
$$
Now let us compute the joint probability that
$$
P( X_{(n)} \ge  a \ \text{or} \ X_{(1)} \ge b) = P(\ X_{(n)} \ge a)+P(\ X_{(n)} < a,\ X_{(1)} \ge b )
$$
Now
$$
P(\ X_{(n)} < a,\ X_{(1)} \ge b ) = P(X_1,\ldots,X_n \in (b,a]) = \left(P(X_1 \in (b,a])\right)^n
$$
Now the probability of rejecting $H_0$ when the true parameter is $\varphi$ is
$$
P(\ X_{(n)} \geq 1 \ \text{or}\ X_{(1)} \ge g) =1-(P(X_{1}\leq 1))^n + \left(P(X_1 \in (g,1])\right)^n. 
$$
Therefore under $H_0$ this probability is equal to (next equation gives the level)
$$
P(\ X_{(n)} \geq 1 \ \text{or}\ X_{(1)} \ge g) =1-1 + \left(P(X_1 \in (g,1])\right)^n \\
=(1-g)^n. 
$$
Now the  minimum power of this test when $\varphi>0.1$ is
$$
\inf_{\phi>0.1}P(\ X_{(n)} \geq 1 \ \text{or}\ X_{(1)} \ge g)
$$

*

*Case I: if $\varphi\geq 1$ then clearly
$$
P(\ X_{(n)} \geq 1 \ \text{or}\ X_{(1)} \ge g) =1-(P(X_{1}\leq 1))^n + \left(P(X_1 \in (g,1])\right)^n =1.
$$

*Case II: if $0.1\leq \varphi\leq 1$ then (next equation gives the power)
$$
P(\ X_{(n)} \geq 1 \ \text{or}\ X_{(1)} \ge g) =1-(P(X_{1}\leq 1))^n + \left(P(X_1 \in (g,1])\right)^n \\
= 1-(1-\varphi)^n+(1-\max(g,\varphi))^n
$$
Now coming to your question you want
$$
(1-g)^n \leq 0.05 \ \text{and}\ 1-(1-\varphi)^n+(1-\max(g,\varphi))^n \geq 0.8,
$$
There are multiple ways to choose $g$ and $n$ now. For example you can choose $g=0.01$ and $n$ such that
$$
0.99^{n} \leq 0.05,
$$
In this case, you will have power $1$ but the sample size might be bigger.
